/*--------------------------------------------------------
the maps and markers that are available (based on the page id)
--------------------------------------------------------*/
var contactMarkerList = [{"marker": 'hispanicarts',"geo": [51.065121,-113.98656]}];
var venueMarkersList = [{"marker": 'island',"geo": [51.054742,-114.075476]}];
var venueMarkersList2 = [{"marker": 'bombazo',"geo": [51.051336,-114.065573]}];
var contactPage = [
	{"mapname":'gmap',"startpos":[51.065121,-113.98656,13],"markers": contactMarkerList}
];
var venuePage = [
	{"mapname":'gmap',"startpos":[51.054742,-114.075476,13],"markers": venueMarkersList},
	{"mapname":'gmap2',"startpos":[51.051336,-114.065573,13],"markers": venueMarkersList2}
];
/*--------------------------------------------------------
loops through the markerList array to add the individual markers
--------------------------------------------------------*/
function loadMarkers(map,markerList){
	//loop through the marker array
	for(var i=0;i<markerList.length;i++){
		//set the current array item into variable
		var marker = markerList[i];
		//get the point on the map using the latitude and longitude
		var point = new GLatLng(marker['geo'][0],marker['geo'][1]);
		//create a marker at the specified point
		var gmarker = new GMarker(point)
		//add the marker to the map
		map.addOverlay(gmarker);		
	}
}
/*--------------------------------------------------------
load the maps and the markers
--------------------------------------------------------*/
function load(){
	//if the browser is able to display maps
	if (GBrowserIsCompatible()) {
		//save the HTML id for the page
		var idname = document.getElementsByTagName('HTML')[0].id;
		//if the page is the contact page
		if(idname=='contact')
			var mapinfo = contactPage;
		//if the page is the venue page
		else if(idname=='venue')
			var mapinfo = venuePage;
		//if the page is anything else, exit function
		else return;
		//loop through each array item for the map information
		for(var i=0;i<mapinfo.length;i++){
			//create a map in the specified element
			var map = new GMap2(document.getElementById(mapinfo[i]['mapname']));
			//add controls for the type of map (satellite, map, hybrid)
			var mapControl = new GMapTypeControl();
        			map.addControl(mapControl);
			//add controls for the map (zoom, up, down, etc)
			map.addControl(new GSmallMapControl());
			//center the map to the specified position/level
			map.setCenter(new GLatLng(mapinfo[i]['startpos'][0],mapinfo[i]['startpos'][1]), mapinfo[i]['startpos'][2]);
			//load the markers for the map
			loadMarkers(map,mapinfo[i]['markers']);
		}
	}
}