function addLoadEvent(func){
  var oldonload=window.onload;
  if(typeof window.onload!='function') {
    window.onload = func;
  }
  else {
    window.onload=function() {
        oldonload();
      func();
    }
  }
}

function caricamappe(){
	if (GBrowserIsCompatible()) { 
	
	  var icona = new GIcon();
      icona.image = "http://www.fidessrl.com/wp-content/themes/tema_dreamaboutit/map/mappa.png";
      icona.shadow = "mappashadow.png";
      icona.iconSize = new GSize(35, 35);
      icona.shadowSize = new GSize(35, 5);
      icona.iconAnchor = new GPoint(14, 15);
      icona.infoWindowAnchor = new GPoint(5, 2);
      icona.infoShadowAnchor = new GPoint(14, 35);
      icona.transparent = "fingertran.png";
      icona.printImage = "fingerie.gif";
      icona.mozPrintImage = "fingerff.gif";
	  
	  function createMarker(point,html) {
		var marker = new GMarker(point,icona);
		GEvent.addListener(marker, "click", function() {
		  marker.openInfoWindowHtml(html);
		});
		return marker;
	  }
	
	// Display the map, with some controls and set the initial location 
	  var map_ct = new GMap2(document.getElementById("map_catania"));
	  map_ct.addControl(new GLargeMapControl());
	  map_ct.addControl(new GMapTypeControl());
	  map_ct.setCenter(new GLatLng(37.513334,15.081825),8);
	  var point = new GLatLng(37.513334,15.081825);
	  var marker = createMarker(point,'<div style="width:240px"><strong>Sede di Catania<\/strong><br>Viale Regina Margherita, 8/a<br>95123 - Catania (CT)<\/div>')
	  map_ct.addOverlay(marker);
	  
	  var map_po = new GMap2(document.getElementById("map_prato"));
	  map_po.addControl(new GLargeMapControl());
	  map_po.addControl(new GMapTypeControl());
	  map_po.setCenter(new GLatLng(43.863356,11.110761),8);
	  var point = new GLatLng(43.863356,11.110761);
	  var marker = createMarker(point,'<div style="width:240px"><strong>Sede di Prato<\/strong><br>Via Modigliani, 7<br>59100 - Prato (PO)<\/div>')
	  map_po.addOverlay(marker);  
	
	}

	else {
	  alert("Sorry, the Google Maps API is not compatible with this browser");
	}

}

addLoadEvent(caricamappe);