﻿    var map = null;
    var geocoder = null;
    var icon = new GIcon();
	var trafficInfo;

	function ResetButton() {
	}
	ResetButton.prototype = new GControl();
	ResetButton.prototype.initialize = function(map) {
	 var container = document.createElement("div");  
	 var ResetDiv = document.createElement("div");
	 this.setButtonStyle_(ResetDiv);
	 container.appendChild(ResetDiv);
	 ResetDiv.appendChild(document.createTextNode("Reset"));
	 GEvent.addDomListener(ResetDiv, "click", function() {
	  map.setCenter(new GLatLng( 38.9305, -77.0388), 15);
	  map.setZoom( 10 );
	  resetTime();
	 });
	 map.getContainer().appendChild(container);
	 return container;
	}
	ResetButton.prototype.getDefaultPosition = function() {
	 return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(2, 2));
	}

	ResetButton.prototype.setButtonStyle_ = function(button) {
	  button.style.textDecoration = "none";
	  button.style.color = "#000000";
	  button.style.backgroundColor = "white";
	  button.style.font = "8pt verdana";
	  button.style.border = "1px solid black";
	  button.style.padding = "2px";
	  button.style.marginBottom = "3px";
	  button.style.textAlign = "center";
	  button.style.width = "4em";
	  button.style.cursor = "hand";
	}
    function initialize() {
	  resetTime();
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng( 38.9305, -77.0388), 15);
		map.setZoom( 10 );
		//map.addControl(new GMapTypeControl());
		//map.addControl(new GSmallMapControl());
		map.enableScrollWheelZoom();
		map.addControl(new ResetButton());
		var trafficOptions = {incidents:true};
		trafficInfo = new GTrafficOverlay(trafficOptions);
		map.addOverlay(trafficInfo);
      }
    }
	function initServiceArea() {
	  resetTime();
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng( 38.9305, -77.0388), 15);
		map.setZoom( 8 );
		//map.addControl(new GMapTypeControl());
		//map.addControl(new GSmallMapControl());
		map.enableScrollWheelZoom();
		map.addControl(new ResetButton());
      }
    }
	function showArea(a) {
     if (GBrowserIsCompatible()) {
     	var a1 = document.getElementById("link1");
     	var a2 = document.getElementById("link2");
     	if (a=='balt') {
		  map.setCenter(new GLatLng( 39.288, -76.615), 15);
		  map.setZoom( 11 );
		  resetTime();
		  if (a1 && a2) {a2.style.color='#000000';a2.style.textDecoration='none';a1.style.color='3366FF';a1.style.textDecoration='underline';}
		  } else {
		  map.setCenter(new GLatLng( 38.9305, -77.0388), 15);
		  map.setZoom( 10 );
		  resetTime();	
		  if (a1 && a2) {a1.style.color='#000000';a1.style.textDecoration='none';a2.style.color='3366FF';a2.style.textDecoration='underline';}		  
		  }
      }
    }    
function resetTime() {
	var theDate = new Date( )
	var day = theDate.getDate();
	var month = theDate.getMonth()+1;
	var year = theDate.getYear();
	var minute = theDate.getMinutes();
	var hour = theDate.getHours();
	var seconds = theDate.getSeconds();
	var ampm;
	if (minute.toString().length<2) minute = '0' + minute;
	if (seconds.toString().length<2) seconds = '0' + seconds;
	if ((hour-0)>11) ampm = ' PM';
		else ampm = ' AM';
	timeStr = month + '/' + day + '/' + year + '&nbsp;&nbsp;' + hour + ':' + minute + ':' + seconds + ampm;
	if (document.getElementById) {
		var title = document.getElementById("timeDiv");
		timeDiv.innerHTML = timeStr;
	  }
}
