var map = null;
	var geocoder = null;
	var icona = null;

function load() 
{
  	if (GBrowserIsCompatible()) 
 	{
      	map = new GMap2(document.getElementById("map"));
      	
		geocoder = new GClientGeocoder();
	
		map.setCenter(new GLatLng(46.167334,9.872954), 9);
		
		map.setZoom(9); 
		map.setMapType(G_HYBRID_MAP);
		
		map.addControl(new GLargeMapControl());
		
		map.addControl(new GMapTypeControl());
		
		icona = new GIcon();
		icona.image = "img/icona_mappa.png";
		icona.iconSize = new GSize(30, 46);
		icona.iconAnchor = new GPoint(6, 48);
		icona.infoWindowAnchor = new GPoint(30, 30);
		
		showAddress("23100 Sondrio Piazzale Bertacchi, 66");
    }
}
   


function createMarker(point, label) 
{
	/*
	var marker = new GMarker(point, icona);
  	
	GEvent.addListener(marker, "click", function() 
	{
    	html = "<img src='img/logo_googlemaps.gif'style='border: 0px;'><div style='color: #000;'><b>Talkeetna Viaggi Sas</b></div>Piazzale Bertacchi, 66<br />23100 Sondrio (SO)<br />Italia";
		html += '<br><br> <a href="http://maps.google.com/maps?saddr=&daddr='+ point.toUrlValue() + '" target ="_blank">Calcola come arrivare da noi</a>';
		
    	marker.openInfoWindowHtml(html);
  	});
  
  	return marker;
	*/
}
   


function showAddress(address) 
{
	geocoder.getLatLng(address,
    function(point) 
	{
    	if (!point) 
		{
        	alert(address + " non trovato!");
      	} 
		else 
		{
        	map.setCenter(point);
			map.addOverlay(createMarker(point, address));
      	}
    });
}


