var map;
var directionsPanel;
var directions;
var rout;


function addMarker(latitude, longitude, description, iconImage) {
	//var lonlat = new GLatLng(latitude, longitude);
	if(iconImage!='') {
		var icon = new GIcon();
		icon.image = iconImage;
		icon.iconSize = new GSize(25, 25);
		icon.iconAnchor = new GPoint(14, 25);
		icon.infoWindowAnchor = new GPoint(14, 14);
		var marker = new GMarker(new GLatLng(latitude, longitude), icon);
	} else {
		var marker = new GMarker(new GLatLng(latitude, longitude));
	}
	GEvent.addListener(marker, 'mouseover',
		function() {
			marker.openInfoWindowHtml(description);
		}
	);
	map.addOverlay(marker);
}

function init() {
	if (GBrowserIsCompatible()) {
		directionsPanel = document.getElementById("my_textual_div");
		map = new GMap2(document.getElementById("map"));
		map.addControl(new GLargeMapControl());
		map.addControl(new GMapTypeControl());	
		map.addControl(new ExtMapTypeControl({showTraffic: true, showTrafficKey: true}));
		map.setCenter(new GLatLng(centerLatitude, centerLongitude), startZoom);
		if (showUR == 'TRUE') { 
			//addMarker(centerLatitude, centerLongitude, "You Are Here");
		}
		for(id in markers) {
			addMarker(markers[id].latitude, markers[id].longitude, markers[id].name, markers[id].iconImage);
		}
	}
}



window.onload = init;
window.onunload = GUnload;