﻿// JScript File
//google maps init
//read url lat, long, zoom
//zoom - 3
// overview Map... Limited version of the main Map javascript. Will only show the markers
// on a fixed viewport map that is centered on the selected object

var DrilldownMap; 
var fltStartLat;
var fltStartLng;
var intStartZoom;

//Load the map and do necessary work to get desired view
function loadDDMap()
{   
    try {   
        if (GBrowserIsCompatible()) {
 		    //start values...same as other map
 		    var strStartLat  = '45.33670';
            var strStartLng  = '13.09570';
            var strStartZoom = '4';
           
            fltStartLat = parseFloat(strStartLat);
            fltStartLng = parseFloat(strStartLng);
            intStartZoom = parseInt(strStartZoom);

            //If we have some values in the URL, overwrite provided start values
            if (getURLParam("lat") != "")
            {
                fltStartLat = parseFloat(getURLParam("lat"));
            }
            if (getURLParam("lon") != "")
            {
                fltStartLng = parseFloat(getURLParam("lon"))
            }
            if (getURLParam("z") != "")
            {
                intStartZoom = parseInt(getURLParam("z"));
            }

            DrilldownMap = new GMap2(document.getElementById("DrilldownMap"));
            
            //Set initial map center
            //value after intStartZoom is the adjuster for the zoomlevel... as this map is way smaller than the real one
            DrilldownMap.setCenter(new GLatLng(fltStartLat,fltStartLng), intStartZoom-2);
            DrilldownMap.setMapType(G_NORMAL_MAP);
            DrilldownMap.disableDragging();
            DrilldownMap.disableDoubleClickZoom();
            DrilldownMap.disableInfoWindow();
            DrilldownMap.disableContinuousZoom();
            DrilldownMap.disableScrollWheelZoom();
        }
        else
        {
            //No working Google Maps... bailout with a 'friendly' message
            alert("Sorry, the Google Maps API is not compatible with this browser");
        }
    }
    catch(err)
    {
        alert('Error loading map: '+ err.description);
    }
}
