<!--
    	var map = null;	
		var geocoder = null;
		var lines = [];
		var mima = [];
		var indx = null;
		var html = null;
		var limiti = null;
		var opac = null;
//Parametri immagine e griglia
		//griglia fine, all'origine
		latmin=44.5;
		lonmin=8.4;
		passo_lat=.001375;
		passo_lon=.0019375;
		n_pti=1600;
		
		// coordinate per ancoraggio immagine
		latmax_imm=latmin + (n_pti-1)*(passo_lat);
		lonmax_imm=lonmin + (n_pti-1)*(passo_lon);		
		
		//coordinate griglia dati
		rappo=10;
		lonmin_dati=lonmin+(rappo-1)*passo_lon;
		latmax_dati=latmin+(n_pti-rappo)*passo_lat;
		
//Definisce le icone
    var icoTrova = new GIcon(); 
		icoTrova.image = 'simboli/mm_20_red.png';
		icoTrova.shadow = 'simboli/mm_20_shadow.png';
		icoTrova.iconSize = new GSize(12, 20);
		icoTrova.shadowSize = new GSize(22, 20);
		icoTrova.iconAnchor = new GPoint(6, 20);
		icoTrova.infoWindowAnchor = new GPoint(5, 1);	
		
	// Definisce le mappette delle fasce orarie	
	var map_oremin = new GScreenOverlay('tminmax/hminime.png',
        new GScreenPoint(605, 355),  // screenXY
        new GScreenPoint(0, 0),  // overlayXY
        new GScreenSize(145, 136));  // size on screen
		
	var map_oremax = new GScreenOverlay('tminmax/hmassime.png',
        new GScreenPoint(605, 355),  // screenXY
        new GScreenPoint(0, 0),  // overlayXY
        new GScreenSize(145, 136));  // size on screen	

	var map_ore = map_oremin;	
		
	// Definisce le scale di colore	
	var scala_t = new GScreenOverlay('tminmax/scalatempv.png',
        new GScreenPoint(763, 20),  // screenXY
        new GScreenPoint(0, 0),  // overlayXY
        new GScreenSize(28, 480));  // size on screen

	var scala_h = new GScreenOverlay('tminmax/scalaorenew.png',
        new GScreenPoint(605, 330),  // screenXY
        new GScreenPoint(0, 0),  // overlayXY
        new GScreenSize(145, 23));  // size on screen				
        	
	// Carica l'immagine 
	var campo = new TPhoto();
	campo.id = 'campo';
	campo.src = 'tminmax/minime.png';
	opac = 70;
	campo.percentOpacity = opac;
	campo.anchorTopLeft = new GLatLng(latmax_imm,lonmin);
	campo.anchorBottomRight = new GLatLng(latmin,lonmax_imm);
		
	function load() {
			var m_lat=45.7;
			var m_lon=10.2;
			var zoom_iniz=8;
//			var baseIcon = new GIcon();
//			baseIcon.infoWindowAnchor = new GPoint(9, 2);
			map = new GMap2(document.getElementById("map_canvas"));
			map.enableScrollWheelZoom();
			map.addMapType(G_PHYSICAL_MAP);
			//map.addControl(new GOverviewMapControl());
			map.addControl(new GScaleControl());
			map.setCenter(new GLatLng(m_lat, m_lon), zoom_iniz);
			map.addControl(new GLargeMapControl());
			map.addControl(new GMapTypeControl());
			
//	------- Vista Earth		
		    // map.addMapType(G_SATELLITE_3D_MAP);
			// //map.addControl(new GHierarchicalMapTypeControl());

			// // Uncomment the following line to start the map with 3D enabled.
			// // map.setMapType(G_SATELLITE_3D_MAP);
          
			// // Obtain a pointer to the Google Earth instance attached to
			// // your map.
			// map.getEarthInstance(getEarthInstanceCB);
    
			// var ge;
			// function getEarthInstanceCB(object) {
			// ge = object;
			// // You can now manipulate ge using the full Google Earth API.
			// }	
//	------- Fine vista Earth
			
			limiti = map.getBounds();
			map.addTPhoto(campo);
			map.setMapType(G_PHYSICAL_MAP);
			map.addOverlay(map_ore);
			map.addOverlay(scala_t);
			map.addOverlay(scala_h);
//			Termometro
			var centro = new GLatLng(45.6, 9.8);
			var termometro = new GMarker(centro, {draggable: true});
			GEvent.addListener(termometro, "click", function() {
			termometro.openInfoWindowHtml("<font face=\"Verdana, Arial, Helvetica, sans-serif\"><font size=2><br>Per vedere l'andamento della temperatura<br>in un punto della regione trascinaci sopra<br>questo marker");
			});
			GEvent.addListener(termometro, "dragstart", function() {
			termometro.closeInfoWindow();
			});
			//GEvent.addListener(termometro, "dragend", function() {
			//termometro.openInfoWindowHtml("Just bouncing along...");
			//});
			GEvent.addListener(termometro, "dragend", function () {
				pt=termometro.getLatLng();
				NR = Math.round((latmax_dati - pt.lat())/(passo_lat*rappo));
				NC = Math.round((pt.lng()-lonmin_dati)/(passo_lon*rappo));
				var chart = "\"http://chart.apis.google.com/chart?chst=d_fnote&chld=sticky_y|1|3366FF|h|CAMPO|NON|DEFINITO|\"";
				if (NR >= 0 && NR <= 159 && NC >= 0 && NC <= 159) {
					indx=(NR+1)*n_pti/rappo+NC; // è ancora da capire perchè va bene (NR+1) e non NR
					if (mima[indx] !=  "-99,-99") {
						var chart = "\"http://chart.apis.google.com/chart?chs=165x120&amp;cht=lc&amp;chxt=x,y&amp;chxl=0:|0|4|8|12|16|20|24&amp;chxr=1,"+mima[indx]+",5&amp;chg=16.66,100&amp;chxtc=1,-180&amp;chls=3,1,0&amp;chf=bg,s,EFEFEFF0&amp;chd=t:"+lines[indx]+"&amp;chds="+mima[indx]+"&amp;chtt=Temperatura&amp;chts=000000,10\"";
					}
					//var html = "<div style=\"width:170; height: 120\"><img src=" + chart+ "<\/div>";
					
				}
				var html = "<img src=" + chart+ "\/>";
				document.getElementById("dove").innerHTML = html;
				//termometro.openInfoWindowHtml(html);
				//document.getElementById("bug").innerHTML = "pirla, NR= "+NR+"  NC= "+NC + "   indx= "+indx;
				//document.getElementById("bug").innerHTML = "i dati sono = "+lines[indx];
				//mark.openInfoWindowHtml("<br>lat: "+pt.lat()+"<br>lon: "+pt.lng());
			});			
			map.addOverlay(termometro);
//............................................................................................................................................................................................			
//			Campo termico			
			// === Define the functions  to process the text file ===
			process_it = function(doc) {
			lines = doc.split("\n");  // === split the document into lines ===
			}          
			process_it2 = function(doc) {
			mima = doc.split("\n");  // === split the document into lines ===
			}                    
			GDownloadUrl("xml/t2m_hour_google_ll.txt", process_it);
			GDownloadUrl("xml/t2m_bound_google.txt", process_it2);
//...........................................................................................................................................................................................			
//			Geocoder
			geocoder = new GClientGeocoder();
			geocoder.setBaseCountryCode("it");
						
	}

// Funzione per cambiare la mappa visualizzata	
	function scambia(map_vis) {
		map.removeTPhoto(campo);
		map.removeOverlay(map_ore);
		campo.src = map_vis;
		campo.percentOpacity = opac;
		map.addTPhoto(campo);
		if (map_vis=='tminmax/massime.png') {map_ore=map_oremax;} else {map_ore=map_oremin;}
		map.addOverlay(map_ore);
		//document.getElementById('bug').innerHTML=map_vis;
	}  
  
// Funzione per la variazione di opacità		
    function Opa(perc) {
		opac = perc;
		campo.setOpacity(opac);
    }	  
	
//Funzione per la ricerca di località	
		function showAddress(address) {
			geocoder.setViewport(limiti);
			var indirizzo = address + ", Italia";
			if (geocoder) {geocoder.getLatLng (indirizzo, function(pt) {
				if (!pt) {
					alert(indirizzo + " : non esiste!");
				} else {
					var mark = new GMarker(pt,icoTrova);
					//gruppoSensore["search"].push(mark);
					map.setCenter(pt, 8);
					//map.setZoom(9);
					map.addOverlay(mark);
					//map.panTo(pt);
					GEvent.addListener(mark, "click", function crealink() {
					mark.openInfoWindowHtml(address+"<br>lat: "+pt.lat()+"<br>lon: "+pt.lng());
					});
					mark.openInfoWindowHtml(address+"<br>lat: "+pt.lat()+"<br>lon: "+pt.lng());
				}
			}
			);
			}
		}

// -->