
<!-- block error

function blockError(){return true;}
window.onerror = blockError;

// -->



<!-- map functions

    var map = null;
    var ge = null;
    var geocoder = null;
    var localsearch = null;
    var directionsPanel;
    var directions;
    var precision = 6;
    var geoXml;

   
    
 	function initialize() {
     	if (GBrowserIsCompatible()) {
     	//Google Map Canvas
       		map = new GMap2(document.getElementById("map_canvas"));
      		map.setCenter(new GLatLng(39.435513525268654, -104.91207361221316), 9);
      		
      		var mapControl = new GMapTypeControl();
      		map.addControl(mapControl);
      		map.addControl(new GLargeMapControl());
      		map.addMapType(G_SATELLITE_3D_MAP);
      		//map.openInfoWindow(map.getCenter(),document.createTextNode("Geotechnologies, Inc"));
      		geocoder = new GClientGeocoder();
      		localsearch = new google.maps.LocalSearch();
      		directionsPanel = document.getElementById("route");
      		directions = new GDirections(map, directionsPanel);  
      		
      		//Google Earth
      		//google.earth.createInstance("map3d", initCB, failureCB);
		}
 	}
/* 	
 	function initCB(object) {
	  ge = object;
	  ge.getWindow().setVisibility(true);
	  var options = ge.getOptions();
	  options.setStatusBarVisibility(true);
	  ge.getNavigationControl().setVisibility(ge.VISIBILITY_SHOW);
	  options.setMouseNavigationEnabled(true);
	}

	function failureCB(object) {
	  alert('load failed');
	}
*/	

    		
function MenuOn(){

		target = window.event.srcElement;
		target.background = "pix/buttonon.gif"
	
}

function MenuOff(){

		target = window.event.srcElement;
		target.background = "pix/button.gif"

}

function MenuClick(evt){
	var evt = evt || window.event; // event object
	var target = evt.target || window.event.srcElement; // event target
	var menu = target.innerText;
	//reset to map view
	
	
	//turn off all menus
	document.getElementById('MenuFindLocation').style.display = 'none';
	document.getElementById('MenuFindDirections').style.display = 'none';
	document.getElementById('MenuAddShape').style.display = 'none';
	document.getElementById('MenuImportGeoRSS').style.display = 'none';
	document.getElementById('MenuGoToLatLong').style.display = 'none';
	document.getElementById('MenuDisplayLatLong').style.display = 'none';
	document.getElementById('MenuStormTracksGeoRSS').style.display = 'none';
	document.getElementById('MenuStormTracksKML').style.display = 'none';
	document.getElementById('MenuGMTIKML').style.display = 'none';
	document.getElementById('MenuImageTile').style.display = 'none';
	document.getElementById('MenuWMSTile').style.display = 'none';
	document.getElementById('routedirections').style.display = 'none';
	GEvent.clearListeners(map, 'click');
	map.clearOverlays();

	if(menu=='Find Location'){
		document.getElementById('MenuFindLocation').style.display = 'inline';
	}
	else if(target.innerText == "Find Directions"){
		document.getElementById('MenuFindDirections').style.display = 'inline';

	}
	else if(target.innerText == "Add Shape"){
		document.getElementById('MenuAddShape').style.display = 'inline';
	}
	else if(target.innerText == "Import GeoRSS"){
		document.getElementById('MenuImportGeoRSS').style.display = 'inline';
	}
	else if(target.innerText == "Go To Lat,Long"){
		document.getElementById('MenuGoToLatLong').style.display = 'inline';
	}
	else if(target.innerText == "Display Lat,Long"){
		document.getElementById('MenuDisplayLatLong').style.display = 'inline';
		var point = map.getCenter();
		GEvent.addListener(map, 'click', function(overlay, point){
		   var pointA = new GLatLng(point.lat(), point.lng());
		   var mark = createMarker(pointA,"lat,long = " + point.lat().toFixed(precision)  + ", " + point.lng().toFixed(precision));
		   map.addOverlay(mark);
		   map.panTo(pointA);
		   GEvent.addListener(mark, 'click', function(){
		      mark.openInfoWindowHtml("long = " + point.x.toFixed(precision)  + ", lat = " + point.y.toFixed(precision) );
		      });
		   mark.openInfoWindowHtml("lat,long = " + point.lat().toFixed(precision) + ", " + point.lng().toFixed(precision));
		});


	}
	else if(target.innerText == "Storm Tracks GeoRSS"){
		document.getElementById('MenuStormTracksGeoRSS').style.display = 'inline';
		map.setCenter(new GLatLng(49.496675,-102.65625), 1);
	}
	else if(target.innerText == "Storm Tracks KML"){
		document.getElementById('MenuStormTracksKML').style.display = 'inline';
		map.setCenter(new GLatLng(49.496675,-102.65625), 1);
	}
	else if(target.innerText == "GMTI KML"){
		document.getElementById('MenuGMTIKML').style.display = 'inline';
		map.setCenter(new GLatLng(49.496675,-102.65625), 1);
	}
	
	else if(target.innerText == "Image Tile"){
		document.getElementById('MenuImageTile').style.display = 'inline';
	}
	else if(target.innerText == "WMS Tile"){
		document.getElementById('MenuWMSTile').style.display = 'inline';
	}
}

	function resetMapType(evt){
		map.setMapType(G_NORMAL_MAP);
		map.clearOverlays();
	}
	
    function createMarker(point,html) 
        {
            var marker = new GMarker(point);
            GEvent.addListener(marker, "click", function() {
            	marker.openInfoWindowHtml(html);
            	});
            return marker;
        }
	
	function FindLoc() {
		var address = document.getElementById('txtWhere').value;
		//alert(address);
		if (geocoder) {
        	geocoder.getLatLng(
          	address,
          	function(point) {
            	if (!point) {
              		alert(address + " not found");
            	}
            	else {
             		map.setCenter(point, 13);
              		var marker = new GMarker(point);
              		map.addOverlay(marker);
              		marker.openInfoWindowHtml(address);
            	}
          	}
        	);
      	}
	}
                                
	function FindNearby(){
		map.addControl(localsearch);
	}

	function FindDirections(){
		document.getElementById('routedirections').style.display = 'inline';
		directions.load(document.getElementById('txtFrom').value+" to "+document.getElementById('txtTo').value);
	}
	
	function FindLatLong(){
		var x = document.getElementById('txtLongitude').value;
		var y = document.getElementById('txtLatitude').value;
		var lvl = document.getElementById('zoomLevel').value;
		var point = new GLatLng(y, x);
		map.setCenter(point, parseInt(lvl));
		var mark = createMarker(point,"lat,long = " + point.lat() + ", " + point.lng());
		map.addOverlay(mark);
		mark.openInfoWindowHtml("lat,long = " + point.lat() + ", " + point.lng());
	}
	
	function AddStormLayerGeoRSS(){
			map.clearOverlays();
            var storm = document.getElementById('stormtype1');
            var year = document.getElementById('stormyear1');
            var url = "http://www.web-demographics.com/MapServicesGoogle/servlet/GetGeoRSS?feed="+storm.options[storm.selectedIndex].value+"&url=http://www.solar.ifa.hawaii.edu/tropical/Data/tropical"+year.options[year.selectedIndex].value+"&title=Storm%20Tracks&format=georss";
            //url = "http://mapgadgets.googlepages.com/cta.kml";
            //url = "http://api.flickr.com/services/feeds/groups_pool.gne?id=322338@N20&format=rss_200&georss=1";
            //url = "http://rkgeorge-pc/MapServicesGoogle/transit.kml";
            //url = "http://www.web-demographics.com/MapService/transit.kml";
            //map.setCenter(new GLatLng(41.875696,-87.624207), 11);
            //alert(url);
            geoXml = new GGeoXml(url);
            map.addOverlay(geoXml);  
        }      

	function AddStormLayerKML(){
			map.clearOverlays();
            var storm = document.getElementById('stormtype2');
            var year = document.getElementById('stormyear2');
            var url = "http://www.web-demographics.com/MapServicesGoogle/servlet/GetGeoRSS?feed="+storm.options[storm.selectedIndex].value+"&url=http://www.solar.ifa.hawaii.edu/tropical/Data/tropical"+year.options[year.selectedIndex].value+"&title=Storm%20Tracks&format=kml";
            //alert(url);
            geoXml = new GGeoXml(url);
            map.addOverlay(geoXml);  
        } 
        
        
        
		function  LoadGMTI(){
			//map.clearOverlays();
			var geoXml = new GGeoXml(document.getElementById('txtGMTI').value);
		    GEvent.addListener(geoXml, 'load', function() {
		      if (geoXml.loadedCorrectly()) {
		        geoXml.gotoDefaultViewport(map);
		        document.getElementById("status").innerHTML = "";
		      }
		    });
		    map.addOverlay(geoXml);
		    document.getElementById("status").innerHTML = "Loading...";
        } 

	
// -->