var g_aMapLocations = new Array();

function initialize(x, y, zoom, element){
  if (GBrowserIsCompatible()){
		var map;
		var control1;
		var control2;
		var brunelMarker;
		var brunelMarkerIcon;
    map = new GMap2(document.getElementById(element));
    map.setCenter(new GLatLng(x, y), zoom);
    control1 = new GLargeMapControl(false,false);
    map.addControl(control1);
    control2 = new GOverviewMapControl(false,false);
    map.addControl(control2);
    brunelMarkerIcon = new GIcon(G_DEFAULT_ICON,'/media/default/layout/icons/brunel_googlemap.gif');
    brunelMarkerIcon.iconSize = new GSize(53,36);
    brunelMarkerIcon.iconAnchor = new GPoint(26,34);
    brunelMarkerIcon.shadow = '';

    brunelMarker = new GMarker(new GLatLng(x,y),brunelMarkerIcon);
    map.addOverlay(brunelMarker);
  }
}
function windowonload(){
}

function gmap_setup(x, y, zoom, element){
  if(typeof element == 'undefined'){
		element = 'map_canvas';
	}
	g_aMapLocations.push({aMapLocation:[x,y,zoom], sElement:element});
}

var g_oOnloadBeforeGoogleMaps = window.onload;
window.onload = function(){
  // first: try calling previous onload function
  if(typeof g_oOnloadBeforeGoogleMaps == 'function'){
    g_oOnloadBeforeGoogleMaps();
  }
  
  // second: call function initialize.
	for(var i = 0; i < g_aMapLocations.length; i++){
		initialize(g_aMapLocations[i].aMapLocation[0], g_aMapLocations[i].aMapLocation[1], g_aMapLocations[i].aMapLocation[2], g_aMapLocations[i].sElement);
	}
}
window.onunload = GUnload;