function avviaRicerca() {
	document.getElementById('hTxtWhere').value = "";
	document.formSearch.submit();
}

function svuotaRicerca() {
	document.getElementById('hTxtWhere').value = "";
	document.getElementById('PRV_CD_PROVINCIA').value = "";
	document.getElementById('FAT_DESCRIZIONE').value = "";
	document.getElementById('LTA_ID_TARGET_ATTIVITA').value = "";
	document.getElementById('FAT_FLAG_STRUTTURE_DISABILI').checked = false;
	document.getElementById('FAT_FLAG_PUNTO_VENDITA').checked = false;
	document.getElementById('FAT_ATTIVITA_SPORTIVE').checked = false;
	document.getElementById('FAT_FLAG_PRODOTTI_BIOLOGICI').checked = false;
	document.getElementById('FAT_FLAG_RISTORAZIONE').checked = false;
	document.getElementById('FAT_FLAG_PERNOTTAMENTO').checked = false;
}

function cambiaPagina(start,pagina) {
	document.formSearch.action = document.formSearch.action + "&start=" + start + "&pagina=" + pagina;
	document.formSearch.submit();
}

function scrollWin(){
$('html, body').animate({
	scrollTop: $("#mapG").offset().top
	}, 2000);
}

function load(lat,lon,gallery,photo,extension) {

	if (GBrowserIsCompatible()) { 
		// A function to create the marker and set up the event window
		// Dont try to unroll this function. It has to be here for the function closure
		// Each instance of the function preserves the contends of a different instance
		// of the "marker" and "html" variables which will be needed later when the event triggers.    
		function createMarker(point,html) {
			var marker = new GMarker(point);
			GEvent.addListener(marker, "click", function() {
				marker.openInfoWindowHtml(html);
			});
			return marker;
		}

		// Display the map, with some controls and set the initial location 
		var map = new GMap2(document.getElementById("mapGooDetail"));
		// Visualizza controlli - ZOOM GRANDE
		map.addControl(new GLargeMapControl());
		// Visualizza controlli - TIPO MAPPA
		map.addControl(new GMapTypeControl());
		// Imposta centro Mappa
		map.setCenter(new GLatLng(lat,lon),15);
		//map.setUIToDefault();
		//Imposto il tipo di Mappa:
		//G_SATELLITE_MAP mappa satellite
		//G_NORMAL_MAP mappa normale
		//G_HYBRID_MAP mappa ibrida
		map.setMapType(G_HYBRID_MAP);

		// Set up three markers with info windows 
		var point = new GLatLng(lat,lon);
		var image = '';
		if ((gallery != '') && (photo != '')) {
			image = '<img src="images/Gallery/'+gallery+'/'+photo+'_s.'+extension+'" \/>';
		}

		var linkWeb = '';
		if(parent.document.getElementById('txtLinkWeb').value != '') {
			linkWeb = "<a href='http:\/\/" + parent.document.getElementById('txtLinkWeb').value + "' target='_blank'>"+ parent.document.getElementById('txtLinkWeb').value +"<\/a>";
		}
		var marker = createMarker(point,'<div style="width:240px">'+parent.document.getElementById('nomeFattoria').innerHTML+'<br \/>'+image+'<br \/>'+ linkWeb + '<\/div>')
		map.addOverlay(marker);
	}
	// display a warning if the browser was not compatible
	else {
		alert("Sorry, the Google Maps API is not compatible with this browser");
	}
}
