var objLongitude;
var objLatitude;
var strVenueTitle = '';
var strVenueDesc = '';
var icons = [];

function loadMap( ) 
{
    initControls(); // function written from .net page 
    //get map values from .net page
    var dLat, dLong, sDescription;
    dLat = objLatitude.value;
    dLong = objLongitude.value;
    // sDescription = objVenueDesc.value;
       
    if (GBrowserIsCompatible() && dLat != "") 
    {

        // Create some custom icons

        var myIcon = new GIcon();
        myIcon.image = 'bm_markers/image.png';
        myIcon.printImage = 'bm_markers/printImage.gif';
        myIcon.mozPrintImage = 'bm_markers/mozPrintImage.gif';
        myIcon.iconSize = new GSize(67, 79);
        myIcon.shadow = 'bm_markers/shadow.png';
        myIcon.transparent = 'bm_markers/transparent.png';
        myIcon.shadowSize = new GSize(107, 79);
        myIcon.printShadow = 'bm_markers/printShadow.gif';
        myIcon.iconAnchor = new GPoint(67, 79);
        myIcon.infoWindowAnchor = new GPoint(34, 0);
        myIcon.imageMap = [53, 0, 59, 1, 61, 2, 62, 3, 62, 4, 62, 5, 62, 6, 62, 7, 62, 8, 62, 9, 62, 10, 63, 11, 63, 12, 63, 13, 63, 14, 63, 15, 63, 16, 63, 17, 62, 18, 62, 19, 61, 20, 61, 21, 60, 22, 59, 23, 59, 24, 58, 25, 58, 26, 58, 27, 57, 28, 57, 29, 57, 30, 57, 31, 57, 32, 57, 33, 57, 34, 57, 35, 57, 36, 57, 37, 57, 38, 57, 39, 57, 40, 57, 41, 58, 42, 58, 43, 58, 44, 58, 45, 59, 46, 59, 47, 60, 48, 60, 49, 60, 50, 61, 51, 61, 52, 62, 53, 62, 54, 63, 55, 63, 56, 64, 57, 64, 58, 65, 59, 65, 60, 65, 61, 66, 62, 66, 63, 65, 64, 65, 65, 65, 66, 64, 67, 64, 68, 63, 69, 63, 70, 63, 71, 62, 72, 62, 73, 61, 74, 61, 75, 61, 76, 60, 77, 60, 78, 58, 78, 58, 77, 57, 76, 57, 75, 57, 74, 56, 73, 56, 72, 56, 71, 55, 70, 55, 69, 54, 68, 53, 67, 52, 66, 51, 65, 50, 64, 49, 63, 47, 62, 46, 61, 44, 60, 43, 59, 41, 58, 40, 57, 14, 56, 6, 55, 4, 54, 3, 53, 2, 52, 1, 51, 1, 50, 1, 49, 1, 48, 1, 47, 1, 46, 0, 45, 0, 44, 0, 43, 0, 42, 0, 41, 0, 40, 0, 39, 0, 38, 0, 37, 1, 36, 1, 35, 2, 34, 3, 33, 3, 32, 4, 31, 4, 30, 5, 29, 5, 28, 5, 27, 6, 26, 7, 25, 7, 24, 8, 23, 9, 22, 10, 21, 11, 20, 13, 19, 13, 18, 14, 17, 15, 16, 16, 15, 17, 14, 18, 13, 19, 12, 21, 11, 23, 10, 25, 9, 26, 8, 27, 7, 28, 6, 30, 5, 31, 4, 34, 3, 38, 2, 41, 1, 43, 0];

        // An array of GIcons, to make the selection easier
        
        icons[1] = myIcon;
        
        // create map
        var map = new GMap2(document.getElementById("google_map"));
        // create map controls
        var uiMapOptions = map.getDefaultUI();
        uiMapOptions.zoom.scrollwheel = false;
        uiMapOptions.controls.smallmapcontrol3d = true;
        map.setUI(uiMapOptions)

        // add marker
        var point = new GLatLng(dLat, dLong);
        var marker = createMarker(point, '<span class="google-title">'+strVenueTitle+'</span><br />' + strVenueDesc, '1')
        map.addOverlay(marker);
        map.setCenter(point, 15);
    	
    }
}

function createMarker(point, html, icontype) {
    var marker = new GMarker(point, icons[icontype]);
    GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); });
    return marker;
}



