	var map;
	var nome;
    var geocoder;
    
    function srcmap(lat, long, zoom) {
	 //document.write(zoom);
     map = new GMap2(document.getElementById("map"));
     map.setCenter(new GLatLng(lat, long), 14, G_NORMAL_MAP );
	 map.setZoom(zoom-(-2)); 
	 var customUI = map.getDefaultUI();
        // Remove MapType.G_HYBRID_MAP
        //customUI.maptypes.hybrid = false;
     map.setUI(customUI);
	 var minMapScale = 5;
	 var maxMapScale = 20;
	 // get array of map types
	 var mapTypes = map.getMapTypes();
	 // overwrite the getMinimumResolution() and getMaximumResolution() methods for each map type
	 for (var i=0; i<mapTypes.length; i++) {
	 mapTypes[i].getMinimumResolution = function() {return minMapScale;}
	 mapTypes[i].getMaximumResolution = function() {return maxMapScale;}
	 }
	 
     if (!lat || !long) {
       alert("Sorry, we were unable to geocode that address");
     } else {
       //place = response.Placemark[0];
       point = new GLatLng(lat,long);
                           
     var icona = new GIcon();
        icona.image = "images/city_marker.png";
        //icona.shadow = "http://www.example.com/PERCORSO_OMBRA_ICONA.png";
        icona.iconSize = new GSize(24, 36);
        //icona.shadowSize = new GSize(37, 34);
        icona.iconAnchor = new GPoint(24 >> 1, 36 >> 1);
		//icona.infoWindowAnchor = new GPoint(16, 0);
        // imposta l'oggetto GMarkerOptions
        markerOptions = { icon:icona };
        // imposta il punto in cui visualizzare il marker
        var point = new GLatLng(lat,long);
        // crea e visualizza il marker sulla mappa
        var marker = new GMarker(point, markerOptions);
        //map.addOverlay(marker);	
		}
    }
	
	function add_m(lat, long, aid, nomea, logo) {
	 if (GBrowserIsCompatible()) {
	//document.write(dettagli);
	 	var icona = new GIcon();
        icona.image = "images/map_point.png";
        //icona.shadow = "http://www.example.com/PERCORSO_OMBRA_ICONA.png";
        icona.iconSize = new GSize(30, 30);
        //icona.shadowSize = new GSize(37, 34);
        icona.iconAnchor = new GPoint(100 >> 1, 0 >> 1);
		//icona.infoWindowAnchor = new GPoint(16, 0);
        // imposta l'oggetto GMarkerOptions
        markerOptions = { icon:icona };
        // imposta il punto in cui visualizzare il marker
        var point = new GLatLng(lat,long);
		lati=lat-(-0.004);
		//alert(lat+lati);
        var pointm = new GLatLng(lati,long);
        // crea e visualizza il marker sulla mappa
        //var marker = new GMarker(point, markerOptions); 
		var mm = new GMarkerManager(map); 
		var marker=new GMarker(point, markerOptions);
       	mm.addMarker(marker,10,17); 
		
		
		
		//xmap(hid,'descrizione');
		GEvent.addListener(marker, 'mouseover', function(){ 
            map.openExtInfoWindow(
              point,
              "simple_example_window",
              "<div class='titless'><span>"+nomea+"</span></div><div class='clear'></div><div class='desc_mappa'><div class='logo_mappa'><img src='images/loghi/"+logo+"' /></div><div class='dettagli_mappa' id='desc_"+aid+"'></div><div class='clear'></div><div class='categ_mappa' id='catmap_"+aid+"'></div></div>",
              xmap(aid)
			  ); 
          });
       // map.addOverlay(marker);
		GEvent.addListener(marker, 'mouseout', function(){map.closeExtInfoWindow(point);});
		GEvent.addListener(marker, 'click', function(){window.location="azienda-"+aid+"-"+nomea+".html";});

		
		
		/*GEvent.addListener(marker,"mouseover", function() {
        	var myHtml = "<b>" + nome + "</b><br/>" + indirizzo;
          	map.openInfoWindowHtml(point, myHtml);
        });  */
	 }
    }
	
	function add_mh(lat, long, tip, hid, dbname, citta, lng) {
	 if (GBrowserIsCompatible()) {
	//document.write(minMapScale);
	 	var icona = new GIcon();
        icona.image = "obs/images/marker_"+tip+".png";
        //icona.shadow = "http://www.example.com/PERCORSO_OMBRA_ICONA.png";
        icona.iconSize = new GSize(30, 30);
        //icona.shadowSize = new GSize(37, 34);
        icona.iconAnchor = new GPoint(1 >> 1, 1 >> 1);
		//icona.infoWindowAnchor = new GPoint(16, 0);
        // imposta l'oggetto GMarkerOptions
        markerOptions = { icon:icona };
        // imposta il punto in cui visualizzare il marker
        var point = new GLatLng(lat,long);
		lati=lat-(-0.004);
		//alert(lat+lati);
        var pointm = new GLatLng(lati,long);
        // crea e visualizza il marker sulla mappa
        //var marker = new GMarker(point, markerOptions); 
		var mm = new GMarkerManager(map); 
		var marker=new GMarker(point, markerOptions);
       	mm.addMarker(marker,10,17); 
		
		
		//xmap(hid,'descrizione');
		GEvent.addListener(marker, 'mouseover', function(){ 
            map.openExtInfoWindow(
              point,
              "simple_example_window",
              "<div class='titless' id='nome_"+hid+"'></div><div class='desc' id='desc_"+hid+"'></div>",
              xmap(hid, lng)
            ); 
          });
       // map.addOverlay(marker);
		GEvent.addListener(marker, 'mouseout', function(){map.closeExtInfoWindow(point);});
		GEvent.addListener(marker, 'click', function(){window.location=citta+".html";});

		
		
		/*GEvent.addListener(marker,"mouseover", function() {
        	var myHtml = "<b>" + nome + "</b><br/>" + indirizzo;
          	map.openInfoWindowHtml(point, myHtml);
        });  */
	 }
    }
	
	
		function add_c(lat, long, tip, nome) {
	 if (GBrowserIsCompatible()) {
	//document.write(lat, long, tip, nome);
	 	var icona = new GIcon();
        icona.image = "images/city_marker.png";
        //icona.shadow = "http://www.example.com/PERCORSO_OMBRA_ICONA.png";
        icona.iconSize = new GSize(24, 36);
        //icona.shadowSize = new GSize(37, 34);
        icona.iconAnchor = new GPoint(100 >> 1, 0 >> 1);
		//icona.infoWindowAnchor = new GPoint(16, 0);
        // imposta l'oggetto GMarkerOptions
        markerOptions = { icon:icona };
        // imposta il punto in cui visualizzare il marker
        var point = new GLatLng(lat,long);
		//lati=lat-(-0.004);
		//alert(lat+lati);
        var pointm = new GLatLng(lat,long);
        // crea e visualizza il marker sulla mappa
        //var marker = new GMarker(point, markerOptions);
		var mm = new GMarkerManager(map); 
		var marker=new GMarker(point, markerOptions);
       	mm.addMarker(marker,5,14);
		
		//xmap(hid,'descrizione');
		GEvent.addListener(marker, 'mouseover', function(){ 
            map.openExtInfoWindow(
              pointm,
              "simple_example_window",
              "<div style='background-color:blue;'><div style='color:#FFFFFF;font-weight:bold;margin-left:5px;margin-right:5px;'>"+nome+"</div></div>"
            ); 
          });
         // map.addOverlay(marker);
		GEvent.addListener(marker, 'mouseout', function(){map.closeExtInfoWindow();});
		
		//document.write(permcit);
		GEvent.addListener(marker, 'click', function(){window.location=permcit+".html?&ckin=on";});

		
		
		/*GEvent.addListener(marker,"mouseover", function() {
        	var myHtml = "<b>" + nome + "</b><br/>" + indirizzo;
          	map.openInfoWindowHtml(point, myHtml);
        });  */
	 }
    }
		
