
var map;
var markers = [];

$(function() {
	if (GBrowserIsCompatible()) {
// Initialize the map.

		map = new GMap2(document.getElementById("map"));
		map.addControl(new GLargeMapControl());
		//map.setCenter(new GLatLng(39.1,-94.595), 9);

		$.ajax({type:"GET",url:"/shared/files/map_files/markers.xml",dataType:"xml",
			success:function(data,textStatus) {
				
				$("marker",data).each(function(){
					var lat = parseFloat($(this).attr("lat"));
					var lng = parseFloat($(this).attr("lng"));
					var id = parseInt($(this).attr("venueId"));
					if(id == DataBridge.venueId) {
						
						map.setCenter(new GLatLng(lat,lng), 15);
					}
				});
				
				$("marker",data).each(function() {

					// Attributes for each marker.
					
					
					var lat = parseFloat($(this).attr("lat"));
					var lng = parseFloat($(this).attr("lng"));
					
					
					var point = new GLatLng(lat,lng);
					var html = $("html",this).text();

// Create the marker.

					var marker = new GMarker(point);             
					GEvent.addListener(marker, "mouseover", function() {
						marker.openInfoWindowHtml(html);
					});

					map.addOverlay(marker);
					
					
				});
			},

				error:function(XMLHTTPRequest,textStatus,errorThrow){
				alert("There was an error retrieving the marker information.");
			}
		});

	}
});

$(document.body).unload(function() {
if (GBrowserIsCompatible()) {
GUnload();
}
});

