function goto(idelem,invio){
	if (!invio) {
		var indice = document.getElementById(idelem).selectedIndex;
		var valore = document.getElementById(idelem).options[indice].value;
		document.location.href = valore;
	}
	else document.getElementById(idelem).submit();
}



function avvisoprivacy(lang) { 	   	
	var finestra = window.open("","Privacy","height=230,width=450");
	
	if (lang == "en") {
		finestra.document.write("<h2>Privacy statement:</h2>");
		finestra.document.write("Sartoni Real Estate is a fully registered company in Italy. All personal data will be handled in paper and/or electronic format by Network Link and its authorised collaborators in conformance to the Italian privacy law act D.lgs 196/2003. Network Link guarantees confidentiality in managing my personal data and I can request cancellation and/or modification at any time from the company?s records. The sending of this message automatically constitutes acceptance of the confidentiality terms & conditions.");
		finestra.document.close();
	}
	else {
		finestra.document.write("<h2>Dichiarazione sulla privacy:</h2>");
		finestra.document.write("Autorizzo Immobiliare Sartoni al trattamento dei dati personali, essi verranno trattati in forma cartacea e/o informatica e verranno utilizzati esclusivamente presso la stessa o presso i soggetti incaricati in virtù del D.lgs. 196/2003. L'azienda garantisce la massima riservatezza nel trattare i dati e la possibilità di richiederne la cancellazione (o la rettifica) dall'archivio. L'invio del presente messaggio costituisce accettazione della presente Informativa e consenso al trattamento dei dati personali forniti.");
		finestra.document.close();
	}
}





function selFasciaPrezzo(fascia,extfrm){
	var stroption="<select name='prezzo' style='width:150px'>";
	if (fascia == "affitto"){
		stroption += "<option value=\"0\" selected > - Qualsiasi - </option>";
		stroption += "<option value=\"6\">da 0 a 500</option>";
		stroption += "<option value=\"7\">da 500 a 800</option>";
		stroption += "<option value=\"8\">da 800 a 1000</option>";
		stroption += "<option value=\"9\">da 1000 a 2000</option>";
		stroption += "<option value=\"10\">oltre 2000</option>";
	}
	else {
		stroption += "<option value=\"0\" selected > - Qualsiasi - </option>";
		stroption += "<option value=\"1\">da 0 a 100000</option>";
		stroption += "<option value=\"2\">da 100000 a 200000</option>";
		stroption += "<option value=\"3\">da 200000 a 300000</option>";
		stroption += "<option value=\"4\">da 300000 a 500000</option>";
		stroption += "<option value=\"5\">oltre 500000</option>";
	}
	stroption += "</select>";
	var obj = document.getElementById('idprezzo'+extfrm);
	obj.innerHTML = stroption;
}


function checkSecurityCode(security_code, lang){
	var inserted_number = document.getElementById("security_code").value;
	var msg = "Impossibile inviare la richiesta!\nIl codice di sicurezza inserito non è corretto."
	if(lang != null && lang == "eng") msg = "Unable to send request!Uncorrect security code!";
		 
	if(security_code != inserted_number ) {
		alert(msg);											
		return false;	
	}
	else return true;
	
}
	
function cambia_prezzi(tipo, lang) {
	if(lang != null && lang == "eng"){
		var opzioni_vendite = new Array({text:" - Any - ", value:'0'}, {text:"from 0 to 100000", value:'1'},{text:"from 100000 to 200000",value:'2'},{text:"from 200000 to 300000",value:'3'},{text:"from 300000 to 500000",value:'4'},{text:"up 500000",value:'5'});
		var opzioni_affitti = new Array({text:" - Any - ", value:'0'},{text:"from 0 to 500", value:'1'},{text:"from 500 to 800",value:'2'},{text:"from 800 to 1000",value:'3'},{text:"from 1000 to 2000",value:'4'},{text:"up 2000",value:'5'});
	}
	else {
		var opzioni_vendite = new Array({text:" - Qualsiasi - ", value:'0'}, {text:"da 0 a 100000", value:'1'},{text:"da 100000 a 200000",value:'2'},{text:"da 200000 a 300000",value:'3'},{text:"da 300000 a 500000",value:'4'},{text:"oltre 500000",value:'5'});
		var opzioni_affitti = new Array({text:" - Qualsiasi - ", value:'0'}, {text:"da 0 a 500", value:'1'},{text:"da 500 a 800",value:'2'},{text:"da 800 a 1000",value:'3'},{text:"da 1000 a 2000",value:'4'},{text:"oltre 2000",value:'5'});
	}
	switch(tipo){
		case '1':			   
			var opt = document.ricerca_immobili.prezzo.options;
			for(var i=0;i<opzioni_vendite.length;i++){
				opt[i].value = opzioni_vendite[i]['value'];
				opt[i].text = opzioni_vendite[i]['text'];
			}				
			break;
		case '2':	
			var opt = document.ricerca_immobili.prezzo.options;
			for(var i=0;i<opzioni_affitti.length;i++){
				opt[i].value = opzioni_affitti[i]['value'];
				opt[i].text = opzioni_affitti[i]['text'];
			}				
			 break;
		default: break;
	}
}
