﻿//////////////////////////////////////////////////////////////
// Created By; JForst 06-05-09
// Displays GIS data overlays on Google Map
// Revisions: 06-11-09 Copy and paste from main ACHD Site
//
//////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////
// PARK AND RIDE LOTS
//////////////////////////////////////////////////////////////
function showParkRideLots() {
    //showLoadingBox("allevents", "true");
    var map = new GMap2(document.getElementById("map"));

    map.setCenter(new GLatLng(43.60478912945408, -116.3140702040286), 10);
    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.enableDoubleClickZoom();

    // Create overlays
    var kml = new GGeoXml("http://www.achdidaho.org/gis/MapFiles/Park_and_Ride.kml");
    //var kml = new GGeoXml("http://www.achdidaho.org/gis/MapFiles/Park_and_Ride.kml?" + new Date().getMilliseconds());
    map.addOverlay(kml);

    GEvent.addListener(map, "moveend", function() {
        var center = map.getCenter();
        document.getElementById("message").innerHTML = center.toString();
    });
    // I'm setting the button color independently.  May need to find a way to do this on a conditional basis.
//    document.getElementById("RITA").style.backgroundColor = "#FFCC66";
//    document.getElementById("BikeLanes").style.backgroundColor = "#FFCC66";
//    document.getElementById("CommissionDistricts").style.backgroundColor = "#FFCC66";
    //document.getElementById("ParkRideLots").style.backgroundColor = "#CBCC99";
//    document.getElementById("CountyLimits").style.backgroundColor = "#FFCC66";
//    document.getElementById("CityLimits").style.backgroundColor = "#FFCC66";
//    document.getElementById("ChipSealZones").style.backgroundColor = "#FFCC66";
//    document.getElementById("ChipsealZonesByYear").style.backgroundColor = "#FFCC66";
//    document.getElementById("ClearMaap").style.backgroundColor = "#FFCC66";

    // Show appropriate legend
    //document.mapLegend.src = "Images/legend_blank.gif";

   // showLoadingBox("allevents", "false");
}






/////////////////////////////////////////////////////////
// CLEAR MAP
/////////////////////////////////////////////////////////
function clearMap() {
    showLoadingBox("allevents", "true");
    var map = new GMap2(document.getElementById("map"));

    map.setCenter(new GLatLng(43.60478912945408, -116.3140702040286), 12);
    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.enableDoubleClickZoom();

    // Create overlays
    //    var kml = new GGeoXml("http://www.achdidaho.org/gis/MapFiles/CommissionDistricts.kml?" + new Date().getMilliseconds());
    //    map.addOverlay(kml);

    GEvent.addListener(map, "moveend", function() {
        var center = map.getCenter();
        document.getElementById("message").innerHTML = center.toString();
    });
    // I'm setting the button color independently.  May need to find a way to do this on a conditional basis.
//    document.getElementById("RITA").style.backgroundColor = "#FFCC66";
//    document.getElementById("BikeLanes").style.backgroundColor = "#FFCC66";
//    document.getElementById("CommissionDistricts").style.backgroundColor = "#FFCC66";
    document.getElementById("ParkRideLots").style.backgroundColor = "#FFCC66";
//    document.getElementById("CountyLimits").style.backgroundColor = "#FFCC66";
//    document.getElementById("CityLimits").style.backgroundColor = "#FFCC66";
//    document.getElementById("ChipSealZones").style.backgroundColor = "#FFCC66";
//    document.getElementById("ChipsealZonesByYear").style.backgroundColor = "#FFCC66";
//    document.getElementById("ClearMaap").style.backgroundColor = "#FFCC66";

    // Show appropriate legend
    document.mapLegend.src = "Images/legend_blank.gif";

    showLoadingBox("allevents", "false");
}









////*************************************
function showLoadingBox(cbIn, strShowbox) {
    //  alert("FOO");
    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
// *****************************************************************************
// *****************************************************************************