﻿
function Load() {
    if (GBrowserIsCompatible()) {
        //========== Container =========== // 
        // display the loading message
        //showLoadingBox("allevents", "true");



        // ===== Create the map ===== //
        var map = new GMap2(document.getElementById("map"));
        map.addControl(new GLargeMapControl()); // Map cross navigation top left
        map.addControl(new GMapTypeControl()); // Map buttons on top right
        map.addMapType(G_PHYSICAL_MAP); // Terrain Added to above buttons
        map.addControl(new GOverviewMapControl()); // Little map in bottom right
        map.addControl(new GScaleControl()); // Map Scale in bottom left

        //map.addControl(new GSmallZoomControl()); // Tiny one on top left
        //map.addControl(new GHierarchicalMapTypeControl());

        map.enableDoubleClickZoom();
        //map.enableScrollWheelZoom()
        map.setCenter(new GLatLng(43.60478912945408, -116.3140702040286), 12);

        map.clearOverlays(); // Reset the works
        showParkRideLots();
        // Create overlays
        //    var kml = new GGeoXml("http://www.achdidaho.org/Cartography/MapFiles/AdaCountyBoundary.kml");
        //    var kml = new GGeoXml("http://www.achdidaho.org/gis/MapFiles/BikeLanes.kml");
        ////    var kml = new GGeoXml("http://www.achdidaho.org/Cartography/MapFiles/ChipsealZones.kml");
        ////    var kml = new GGeoXml("http://www.achdidaho.org/Cartography/MapFiles/CommissionDistricts.kml");
        ////    var kml = new GGeoXml("http://www.achdidaho.org/Cartography/MapFiles/RITA.kml");
        ////    var kml = new GGeoXml("http://www.achdidaho.org/Cartography/MapFiles/RITAprojects2.kml");    
        ////    var kml = new GGeoXml("http://www.achdidaho.org/Cartography/MapFiles/SanderZones.kml");
        //var kml = new GGeoXml("http://www.achdidaho.org/gis/MapFiles/SweeperZones.kml");
        //map.addOverlay(kml);

        // Clear loading box
        //showLoadingBox("allevents", "false");

        GEvent.addListener(map, "moveend", function() {
            var center = map.getCenter();
            document.getElementById("message").innerHTML = center.toString();
        });


        //========== END Container =========== //
    } else {
        alert("Sorry, the Google Maps API is not compatible with this browser");
    } // end compatable browser
    //
} //end load function
// *****************************************************************************
// *****************************************************************************

// *****************************************************************************
// *****************************************************************************
function showLoadingBox(cbIn, strShowbox) {
    if (strShowbox == "true") {
        document.getElementById("loadingbox").style.visibility = "visible";
        ////    if (cbIn == "allevents") {  // disable all together
        ////    document.getElementById('Camsbox').disabled = true;
        ////	document.getElementById('Incidentsbox').disabled = true;
        ////	document.getElementById('DMSbox').disabled = true;
        ////	document.getElementById('Roadworkbox').disabled = true;
        //////	} else if (cbIn == "alltprest") {  // disable all together
        //////	  document.getElementById('cbTravelplazas').disabled = true;
        //////	  document.getElementById('cbRestareas').disabled = true;
        ////	} else {
        ////	  document.getElementById(cbIn).disabled = true;
        ////	} //end if cbIn
    } else {
        document.getElementById("loadingbox").style.visibility = "hidden";
        ////    if (cbIn == "allevents") { // enable all together
        ////    document.getElementById('Camsbox').disabled = false;
        ////	document.getElementById('Incidentsbox').disabled = false;
        ////	document.getElementById('DMSbox').disabled = false;
        ////	document.getElementById('Roadworkbox').disabled = false;
        ////	} else if (cbIn == "alltprest") {  // disable all together
        ////	  document.getElementById('cbTravelplazas').disabled = false;
        ////	  document.getElementById('cbRestareas').disabled = false;
        //	} else {
        //      //document.getElementById(cbIn).disabled = false;
        //	} //end if cbIn

    } // end if strShow
} // end of function
// END SHOW LOADING BOX
// *****************************************************************************
// *****************************************************************************


