var map = null;
var geocoder = null;
var icon = icon;

function load() {
  if (GBrowserIsCompatible()) {
	map = new GMap2(document.getElementById("map"));
	map.addControl(new GSmallMapControl());
	map.addControl(new GMapTypeControl());
	map.setCenter(new GLatLng(42.784819,10.274963), 11);
	icon = new GIcon();
        icon.image = "images/freccia.png";
        icon.iconSize = new GSize(22, 26);
        icon.iconAnchor = new GPoint(6, 20);
       icon.infoWindowAnchor = new GPoint(5, 1);	//map.setMapType(G_SATELLITE_MAP );
	geocoder = new GClientGeocoder();
  }
}


function showAddress(address, hotel, link, foto) {

	icon.iconSize = new GSize(22, 26);
	icon.iconAnchor = new GPoint(6, 20);
	icon.infoWindowAnchor = new GPoint(5, 1);
	if (geocoder) {
		geocoder.getLatLng(
	  	address,
	  	function(point) {
			if (!point) {
		  		//alert(address + " L'indirizzo segnalato per la mappa non è corretto" );
			} 
			else {
				var marker = new GMarker(point, icon);
				map.addOverlay(marker);
				//I TRE RIGHI SOTTOSTANTI SERVONO PER CLICCARE SUL MARKER E FAR APPARIRE IL FUMETTO
				var html =  '<table cellpadding="1" align="left"><tr><td valign="top"><img src=images/foto/'+arrayfoto[address]+' width="120px" align="left" border="1"></td> <td><table width="250">  <tr><td><span class="txt4" align="left"><div align="justify">'+arraytxt[address]+'</div></span></td></tr></table></td></tr></table>';		 
				GEvent.addListener(marker, "click", function() {
					marker.openInfoWindowHtml(html);
				});
			}
	  	}
		);
  	}
}
var arrayfoto = Array();
var arraytxt = Array();
