

    var iconturi = new GIcon(); 
    iconturi.image = 'http://labs.google.com/ridefinder/images/mm_20_white.png';
    iconturi.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iconturi.iconSize = new GSize(12, 20);
    iconturi.shadowSize = new GSize(22, 20);
    iconturi.iconAnchor = new GPoint(6, 20);
    iconturi.infoWindowAnchor = new GPoint(5, 1);

    var iconnat = new GIcon(); 
    iconnat.image = 'http://labs.google.com/ridefinder/images/mm_20_green.png';
    iconnat.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iconnat.iconSize = new GSize(12, 20);
    iconnat.shadowSize = new GSize(22, 20);
    iconnat.iconAnchor = new GPoint(6, 20);
    iconnat.infoWindowAnchor = new GPoint(5, 1);

	 var iconstor = new GIcon(); 
    iconstor.image = 'http://labs.google.com/ridefinder/images/mm_20_yellow.png';
    iconstor.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iconstor.iconSize = new GSize(12, 20);
    iconstor.shadowSize = new GSize(22, 20);
    iconstor.iconAnchor = new GPoint(6, 20);
    iconstor.infoWindowAnchor = new GPoint(5, 1);

	var iconcult = new GIcon(); 
    iconcult.image = 'http://labs.google.com/ridefinder/images/mm_20_orange.png';
    iconcult.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iconcult.iconSize = new GSize(12, 20);
    iconcult.shadowSize = new GSize(22, 20);
    iconcult.iconAnchor = new GPoint(6, 20);
    iconcult.infoWindowAnchor = new GPoint(5, 1);

	var iconrelig = new GIcon(); 
    iconrelig.image = 'http://labs.google.com/ridefinder/images/mm_20_black.png';
    iconrelig.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iconrelig.iconSize = new GSize(12, 20);
    iconrelig.shadowSize = new GSize(22, 20);
    iconrelig.iconAnchor = new GPoint(6, 20);
    iconrelig.infoWindowAnchor = new GPoint(5, 1);

	 var iconarc = new GIcon(); 
    iconarc.image = 'http://labs.google.com/ridefinder/images/mm_20_brown.png';
    iconarc.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iconarc.iconSize = new GSize(12, 20);
    iconarc.shadowSize = new GSize(22, 20);
    iconarc.iconAnchor = new GPoint(6, 20);
    iconarc.infoWindowAnchor = new GPoint(5, 1);

	 var iconccitt = new GIcon(); 
    iconccitt.image = 'http://labs.google.com/ridefinder/images/mm_20_red.png';
    iconccitt.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iconccitt.iconSize = new GSize(12, 20);
    iconccitt.shadowSize = new GSize(22, 20);
    iconccitt.iconAnchor = new GPoint(6, 20);
    iconccitt.infoWindowAnchor = new GPoint(5, 1);
    
    var iconterm = new GIcon(); 
    iconterm.image = 'http://labs.google.com/ridefinder/images/mm_20_blue.png';
    iconterm.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iconterm.iconSize = new GSize(12, 20);
    iconterm.shadowSize = new GSize(22, 20);
    iconterm.iconAnchor = new GPoint(6, 20);
    iconterm.infoWindowAnchor = new GPoint(5, 1);
    
    var iconfolk = new GIcon(); 
    iconfolk.image = 'http://labs.google.com/ridefinder/images/mm_20_purple.png';
    iconfolk.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iconfolk.iconSize = new GSize(12, 20);
    iconfolk.shadowSize = new GSize(22, 20);
    iconfolk.iconAnchor = new GPoint(6, 20);
    iconfolk.infoWindowAnchor = new GPoint(5, 1);
    
    var iconstr = new GIcon(); 
    iconstr.image = 'http://www.google.com/mapfiles/arrow.png';
    iconstr.shadow = 'http://www.google.com/mapfiles/arrowshadow.png';
    iconstr.iconSize = new GSize(39, 34);
    iconstr.shadowSize = new GSize(39, 34);
    iconstr.iconAnchor = new GPoint(8, 34);
    iconstr.infoWindowAnchor = new GPoint(8, 1);

    var customIcons = [];
    customIcons["turistico"] = iconturi;
    customIcons["naturalistico"] = iconnat;
    customIcons["storico-artistico"] = iconstor;
    customIcons["archeologico"] = iconarc;
    customIcons["cittadino"] = iconccitt;
    customIcons["termale"] = iconterm;
    customIcons["struttura"] = iconstr;
	  customIcons["artistico-culturale"] = iconcult;
	  customIcons["religioso"] = iconrelig;
    customIcons["folkloristico"] = iconfolk;


    function load(via,comune,struttura,lat_manuale,long_manuale,id_strut,descrizione,lingua,id_abb,leggi,immpred,numstelle,prov){
    
    var dett = descrizione.substring(0,200); //prende i primi 200 caratteri della descrizione per il baloon
dett+= "...";

document.getElementById("map").style.display="block";
document.getElementById("non_t").style.display="block";

//crea una stringa per html per visualizzare le stelle
var vistel = "";
for ($i=1;$i<=numstelle;$i++)
		{
		vistel+= "<img  src=\"images/vota_stella.gif\">";
		}
    var html2= "<table width='300px'><tr><td><table width='98%' align=center><tr><td><table width='100%'><tr><td><img width='100px' src=\""+immpred+"\"></td><td>"+vistel+"<br><b>"+struttura+"</b><br>"+via+"<br>"+comune+" ("+prov+")<br></td></tr></table></td></tr><tr><td><p align=\"justify\">"+dett+"<br><br><a href=\"javascript:scelta_div('dettagli','"+lingua+"','"+id_abb+"');\">"+leggi+"</a><br></p></td></tr></table></td></tr></table>";
    
      if (GBrowserIsCompatible()){
      var map = new GMap2(document.getElementById("map"));
      var geocoder = new GClientGeocoder();

        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(lat_manuale,long_manuale), 9);
        geocoder.getLatLng(via+','+comune, 
				function(point){
					//funzionamento dati manuali
					if ((lat_manuale!='') && (long_manuale != '')){						
						var marker = new GMarker(new GLatLng(lat_manuale, long_manuale),customIcons["struttura"]);
						GEvent.addListener(marker, "click", 
								function(){
									marker.openInfoWindowHtml(html2);
								}
								);
						map.addOverlay(marker);
						marker.openInfoWindowHtml(html2);
          }else {
						if (!point){
							geocoder.getLatLng(comune,
								function(point){
									map.setCenter(point, 9);
									document.getElementById('non_t').innerHTML="<br>Il sistema non è riuscito a localizzare la struttura sulla mappa";
								}
							) 

						//funzionamento dati struttura
						} else {
							map.setCenter(point, 9);
							var marker = new GMarker(point,customIcons["struttura"]);
							GEvent.addListener(marker, "click", 
								function(){
									marker.openInfoWindowHtml(html2);
								}
								);
							map.addOverlay(marker);
							marker.openInfoWindowHtml(html2);
							            
						}
					}
}
);
        GDownloadUrl(("xmlitin/itin_"+id_strut+".xml"),function(data){var xml = GXml.parse(data);
        var markers = xml.documentElement.getElementsByTagName("marker");
        for (var i = 0; i < markers.length; i++){
            var name = markers[i].getAttribute("name");
            var localita = markers[i].getAttribute("localita");
            var tipo = markers[i].getAttribute("type");
            var iditin = markers[i].getAttribute("id_it");
			//var dett = markers[i].getAttribute("dett");
            var path = markers[i].getAttribute("foto");
			//var numstelle = markers[i].getAttribute("stelle");
            var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
                                    parseFloat(markers[i].getAttribute("lng")));
            var marker = createMarker(point, name, localita, tipo, lingua, id_abb, iditin, path, prov);
            map.addOverlay(marker);          
          }
        });
      }
    }

    function createMarker(point, name, localita, tipo, lingua, id_abb, iditin, path, prov) {
      var marker = new GMarker(point, customIcons[tipo]);
      if (path != ""){
      var immagine = "<img width=\"200\" src=\""+path+"\">";
      }else{
      var immagine = "";
      }
      var html = "<div width=\"200\"><table width=\"200\" border=\"0\"><tr><td>"+immagine+"</td></tr><tr><td>Luogo d'interesse <b>"+tipo+ "</b></td></tr><tr><td><br><b><a href=\"javascript:scelta_div('itinerari','"+lingua+"','"+id_abb+"');cerca_itin(0,'ris_ricerca',0,'si');itinerario('"+iditin+"','dettagli_itin','si');\">"+name+"</a></b></td></tr><tr><td><br>"+localita+" ("+prov+")</td></tr></table></div>";

	//	dett= html_entity_decode(mb_convert_encoding($dettagli, 'Windows-1252', 'UTF-8'), ENT_NOQUOTES, 'Windows-1252');
		/*var vistel = "";
		for ($i=1;$i<=numstelle;$i++)
			{
			vistel+= "<img  src=\"images/vota_stella.gif\">";
			}*/
	  
	/*  var html= "<table width='300px'><tr><td><table width='98%' align=center><tr><td><table width='100%'><tr><td><img width='100px' align='texttop' src=\""+path+"\"></td><td><br>"+vistel+"<br><b>"+name+"</b><br>"+address+"<br><br></td></tr></table></td></tr><tr><td><p align=justify>"+dett+"<br><br><a href=\"javascript:scelta_div('dettagli','+lingua+','+id_abb+');\">+leggi+</a><br></p></td></tr></table></td></tr></table>";*/
      GEvent.addListener(marker, 'click', function() {
        marker.openInfoWindowHtml(html);
        
      });
      return marker;
    }
