// SLT Google Maps JS
	var map = null;
	var geocoder = null;
	var bounds = new GLatLngBounds();
	
	// Create a base icon for all of our markers that specifies the
	// shadow, icon dimensions, etc.
	var baseIcon = new GIcon(G_DEFAULT_ICON);
	baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
	baseIcon.iconSize = new GSize(20, 34);
	baseIcon.shadowSize = new GSize(37, 34);
	baseIcon.iconAnchor = new GPoint(9, 34);
	baseIcon.infoWindowAnchor = new GPoint(9, 2);
	
	// Creates a marker whose info window displays the letter corresponding to the given index.
	function createMarker(point, address, index) {
		// Create a lettered icon for this point using our icon class
		var letter = String.fromCharCode("A".charCodeAt(0) + index);
		var letteredIcon = new GIcon(baseIcon);
		letteredIcon.image = "http://www.google.com/mapfiles/marker" + letter + ".png";

		// Set up our GMarkerOptions object
		markerOptions = { icon:letteredIcon };
		var marker = new GMarker(point, markerOptions);

		GEvent.addListener(
			marker, 
			"click", 
			function() {
				marker.openInfoWindowHtml("<b>" + address + "</b>");
			}
		);
		return marker;
	}

	function showAddress(address,i) { // Old for addresses without Lat/Long
		geocoder.getLatLng(
			address,
			function(point) {
				if (!point) {
					alert(address + " not found");
				} else {
					map.setCenter(point, 14); // map and zoom should be centered to show all markers.
					var marker = new GMarker(point);
					map.addOverlay(marker);
					map.addOverlay(createMarker(point, address, i));

					// marker.openInfoWindowHtml(address);
				}
			}
		);
	}
	function initializeMap() {
		if (GBrowserIsCompatible()) {
			map = new GMap2(document.getElementById("map_canvas"));
			geocoder = new GClientGeocoder();
			map.setUIToDefault();
			print_addresses();
		}
	}
	function focusOnMarker(){
		map.panTo(new GLatLng(37.4569, -122.1569));
		marker.openInfoWindow(); 
	}

	function print_addresses(){
		var num = 0;
		for( var i in Locations) {
		//	alert(Locations[i].Name);
			var letter = String.fromCharCode("A".charCodeAt(0) + num);
			html = '<li onclick="javascript:map.panTo(new GLatLng(' + Locations[i].Lat + ',' + Locations[i].Long + '));"><img src="/media/elements/transparent.png" class="Gmp Gmp' + letter + '" height="38" width="24" alt="' + Locations[i].Name + '" />' + "\r\n";
			html += '<b>'+Locations[i].Name + "</b><br />\r\n";
			html += Locations[i].Address + "<br />\r\n";
			html += Locations[i].City + ", " + Locations[i].State + ' ' + Locations[i].Zip + "\r\n";
			html += "</li>\r\n";
			
			document.getElementById('addresses').innerHTML += html;
			
			
			mapAddress(Locations[i].Lat, Locations[i].Long, Locations[i].Name, num);
			num++;
		}
	}
	function mapAddress(lat, long, name, i) {
		var point = new GLatLng(lat, long);
		map.setCenter(point, 14); // map and zoom should be centered to show all markers. // Optional parameter: , G_HYBRID_MAP
		var marker = new GMarker(point);
		map.addOverlay(marker);
		map.addOverlay(createMarker(point, name, i));
		bounds.extend(point);
		newzoom = map.getBoundsZoomLevel(bounds)-1;
		newcenter = bounds.getCenter();
		if(newzoom < map.getZoom()){ // Zoom out if needed. Prevent zooming in, which it would if there was only one location to be mapped.
			map.setCenter(newcenter,newzoom); // Optional parameter: , G_HYBRID_MAP
		} else {
			map.setCenter(newcenter); // stay at current zoom. Prevents zooming in.
		}
	}
	// alert (Locations[0].Name);
