
 
   var map;
    var gdir;
    var geocoder = null;
    var addressMarker; 
   function setDirections(fromAddress, toAddress, locale) {
      gdir.load("from: " + fromAddress + " to: " + toAddress,
                { "locale": locale });
	}
	
	    function handleErrors(){
	   if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
	     alert("Nessuna posizione geografica è stata trovata per uno degli indirizzi specificati. Questo perché l'indirizzo potrebbe essere relativamente nuovo o potrebbe essere errato.");
	   else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
	     alert("Errore interno al server Google.");
	   
	   else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
	     alert("Nessuna informazione da visualizzare.");
 
	//   else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS)  <--- Doc bug... this is either not defined, or Doc is wrong
	//     alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.\n Error code: " + gdir.getStatus().code);
	     
	   else if (gdir.getStatus().code == G_GEO_BAD_KEY)
	     alert("Errore di configurazione.");
 
	   else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
	     alert("Nessuna informazione da visualizzare.");
	    
	   else alert("Si è verificato un errore.");
	   
	}
	
		function onGDirectionsLoad(){ 
      
	}
	function showAddress(address) {
	      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_canvas"));
		      map.setCenter(new GLatLng(14.188929,40.835421), 15);

		gdir = new GDirections(map, document.getElementById("directions"));
		GEvent.addListener(gdir, "load", onGDirectionsLoad);
		map.addControl(new GLargeMapControl());
	  geocoder = new GClientGeocoder();
	  GEvent.addListener(gdir, "error", handleErrors);
      }

      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " non trovato");
            } else {
              map.setCenter(point, 13);
              var marker = new GMarker(point);
              map.addOverlay(marker);
			marker.openInfoWindowHtml('<img src="images/logo_w.gif"><br><strong>CLINIC CENTER S.P.A.</strong><br>'+ address);

            }
			
          }
        );
      }
    }
 

