
function open_info(){
	if (document.all["info"].style.overflow == "hidden" ){
				document.all["info"].style.visibility = "visible"
				document.all["info"].style.overflow = "visible"
	}else{
				document.all["info"].style.visibility = "hidden"
				document.all["info"].style.overflow = "hidden"	
	}
}

function open_div(div){
	if (document.all[""+div+""].style.overflow == "hidden" ){
				document.all[""+div+""].style.visibility = "visible"
				document.all[""+div+""].style.overflow = "visible"
	}else{
				document.all[""+div+""].style.visibility = "hidden"
				document.all[""+div+""].style.overflow = "hidden"	
	}
}


function MostraTabella(idTabella) {
	if (idTabella != "") {
		document.getElementById("Casa_" + idTabella).style.display = "inline";  // (block o inline per vederlo)
	}
}

function addbookmark(){
	if (document.all)
	window.external.AddFavorite("http://www.trova-casa.net","Trova-Casa.net - Portale Immobiliare Italiano")
}

// JavaScript Document
function stop_indesidered_keys_numeri(pwd) {
	if (event.keyCode == 13 || (event.keyCode >=48 && event.keyCode <=57)) {
		return true
	} else {
		if(pwd == 1){alert("Carattere '" + String.fromCharCode(event.keyCode) + "' non consentito, inserire soltanto NUMERI. Grazie.")};
		return false		
	}
}

// JavaScript Document
function stop_indesidered_keys_prezzo(pwd) {
	if (event.keyCode == 44 || (event.keyCode >=48 && event.keyCode <=57) ) {
		return true
	} else {
		if(pwd == 1){alert("Carattere '" + String.fromCharCode(event.keyCode) + "' non consentito")};
		return false		
	}
}

function open_window( n )
{
	mywin = window.open(n , '', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=700,height=535,left=0,top=0,screenX=0,screeny=0');
	mywin.focus();
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}


function open_layer(){
	if (document.all["mappa"].style.overflow == "hidden" ){
		document.all["mappa"].style.visibility = "visible"
		document.all["filtro"].style.overflow = "hidden"
		document.all["mappa"].style.overflow = "visible"
		document.all["testo"].label = "FILTRO"
//		MM_swapImage(img,'','zzz/Layout/su.gif',1);
	}else{	
		document.all["mappa"].style.overflow = "hidden"
		document.all["filtro"].style.overflow = "visible"		
//		MM_swapImage(img,'','zzz/Layout/giu.gif',1);		
	}
}

function open_DemoHelp(){
	if (document.all["demoHelp"].style.overflow == "hidden" ){
		document.all["demoHelp"].style.overflow = "visible"
		MM_swapImage('imgDH','','img/demoHelp.gif',1);
	}else{	
		document.all["demoHelp"].style.overflow = "hidden"
		MM_swapImage('imgDH','','img/demoHelpC.gif',1);
	}
}


function Stampa()
	{
		if(confirm("Stampare la pagina?"))
	{
		self.print()
	}
}


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.overflow=v;}
}






// JavaScript Document
function stop_indesidered_keys(pwd) {
	if (event.keyCode==45 || event.keyCode == 46 || event.keyCode == 64 || event.keyCode == 95 || (event.keyCode >=65 && event.keyCode <=90) || (event.keyCode >=97 && event.keyCode <=122) || (event.keyCode >=48 && event.keyCode <=57)|| (event.keyCode >=1 && event.keyCode <=31)) {
		return true
	} else {
		if(pwd == 1){alert("Carattere '" + String.fromCharCode(event.keyCode) + "' non consentito")};
		return false		
	}
}

function scrivi_ASCII() {
	for (i=0; i<127; i++){
//	document.write(i)
		document.write(i + " " + String.fromCharCode(i) + "<br>");
	} 
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

// #################################################################################################
// #################################### STATS ######################################################
// #################################################################################################
// Define the location of count.asp
// Using a path, you may use this code in any subfolder
/*
var file='/statcountex/count.asp';

var d=new Date(); 
var s=d.getSeconds(); 
var m=d.getMinutes();
var x=s*m;
f='' + escape(document.referrer);
if (navigator.appName=='Netscape'){b='NS';} 
if (navigator.appName=='Microsoft Internet Explorer'){b='MSIE';} 
if (navigator.appVersion.indexOf('MSIE 3')>0) {b='MSIE';}
u='' + escape(document.URL); w=screen.width; h=screen.height; 
v=navigator.appName; 
fs = window.screen.fontSmoothingEnabled;
if (v != 'Netscape') {c=screen.colorDepth;}
else {c=screen.pixelDepth;}
j=navigator.javaEnabled();
info='w=' + w + '&h=' + h + '&c=' + c + '&r=' + f + '&u='+ u + '&fs=' + fs + '&b=' + b + '&x=' + x;
document.write('<img src="' + file + '?'+info+ '" width=1 height=1 border=0><br>');

// #################################################################################################
// #################################################################################################
*/

// #################################################################################################
// ########################################### CONTROLLI FORM ######################################
// #################################################################################################

// VERIFICA EMAIL
function isEmail(what)
{
   var i=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$");
   if(!i.test(what.value)) { alert("Il campo EMAIL non č valido."); what.focus(); return false}   
   return true;
}


//FORM DI LOGIN
function controllaformLogin(theForm)
{
if (theForm.UserID.value == "")
	{
		alert("Inserire un valore per il campo \"username\".");
		theForm.UserID.focus();
		return (false);
	}
if (theForm.Password.value == "")
	{
		alert("Inserire un valore per il campo \"password\".");
		theForm.Password.focus();
		return (false);
	}

	return (true);
}

//RICERCA ANNUNCI HOME PAGE
function controllaFormHome(theForm)
{
if (theForm.provincia.value == "" && theForm.comune.value == "")
	{
		alert("Indicare una Provincia o un Comune");
		theForm.provincia.focus();
		return (false);
	}
if (theForm.provincia.value == "" && theForm.comune.value.length < 3)
	{
		alert("Inserire almeno 3 lettere nel campo comune");
		theForm.comune.focus();
		return (false);
	}
	return (true);
}

//RICERCA ANNUNCI AVANZATA
function controllaFormRicercaAvanzata(theForm)
{
if (theForm.nazione.value == "")
	{
		alert("Selezionare una Nazione dall'elenco");
		theForm.nazione.focus();
		return (false);
	}
if (theForm.nazione.value == "IT"){
	if (theForm.provincia.value == "" && theForm.comune.value == "")
		{
			alert("Indicare una Provincia o un Comune");
			theForm.provincia.focus();
			return (false);
		}
	if (theForm.provincia.value == "" && theForm.comune.value.length < 3)
		{
			alert("Inserire almeno 3 lettere nel campo comune");
			theForm.comune.focus();
			return (false);
		}
}
	
	
	return (true);
}

//RICERCA PER CODICE
function controllaformTC(theForm)
{
if (theForm.id_immobile.value == "")
	{
		alert("Inserire il codice dell'annuncio da cercare!");
		theForm.id_immobile.focus();
		return (false);
	}
	return (true);
}


function controllaFormRichiestaInfo(theForm)
{
if (theForm.nominativo.value == "")
	{
		alert("Inserire un valore per il campo \"NOME\".");
		theForm.nominativo.focus();
		return (false);
	}
if (theForm.mail.value == "")
	{
		alert("Inserire un valore per il campo \"INDIRIZZO E-MAIL\".");
		theForm.mail.focus();
		return (false);
	}
	
if(!isEmail(theForm.mail)) return false;
	
if (theForm.telefono.value == "")
	{
		alert("Inserire un valore per il campo \"TELEFONO\".");
		theForm.telefono.focus();
		return (false);
	}	


if (theForm.richiesta.value == "")
	{
		alert("Inserire un valore per il campo \"RICHIESTA\".");
		theForm.richiesta.focus();
		return (false);
	}	

//if (theForm.confermalettura.checked == false)
//	{
//		alert("Attenzione: devi confermare di aver preso visione dell'informativa circa il trattamento dei dati personali.");
//		theForm.confermalettura.focus();
//		return (false);
//	}	

if (theForm.privacy.checked == false)
	{
		alert("Attenzione: negando il consenso al trattamento dei dati personali non sarā possibile inviare la richiesta di informazioni.");
		theForm.privacy.focus();
		return (false);
	}	

	//return confirm("Confermi l'invio della richiesta?");
	return (true);
}




//FORM REGISTRAZIONE
function controllaformRegistrazione(theForm)
{
if (theForm.nominativo.value == "")
	{
		alert("Inserire un valore per il campo \"Nome Agenzia\".");
		theForm.nominativo.focus();
		return (false);
	}
if (theForm.provincia.value == "")
	{
		alert("Inserire un valore per il campo \"Provincia\".");
		theForm.provincia.focus();
		return (false);
	}		
if (theForm.citta.value == "")
	{
		alert("Inserire un valore per il campo \"Cittā\".");
		theForm.citta.focus();
		return (false);
	}
if (theForm.cap.value == "")
	{
		alert("Inserire un valore per il campo \"CAP\".");
		theForm.cap.focus();
		return (false);
	}	
if (theForm.indirizzo.value == "")
	{
		alert("Inserire un valore per il campo \"Indirizzo\".");
		theForm.indirizzo.focus();
		return (false);
	}	
//if (theForm.responsabile.value == "")
//	{
//		alert("Inserire un valore per il campo \"Titolare\".");
//		theForm.responsabile.focus();
//		return (false);
//	}	
if (theForm.telefono1.value == "")
	{
		alert("Inserire un valore per il campo \"Nr. di Telefono\".");
		theForm.telefono1.focus();
		return (false);
	}	
if (theForm.email.value == "")
	{
		alert("Inserire un valore per il campo \"Indirizzo e-mail\".");
		theForm.email.focus();
		return (false);
	}	
if (theForm.password.value == "")
	{
		alert("Inserire un valore per il campo \"Password\".");
		theForm.password.focus();
		return (false);
	}
	
	return (true);
}
//########################################################################################

//FORM REGISTRAZIONE
function controllaFormPromo(theForm)
{
if (theForm.nome.value == "")
	{
		alert("Inserire un valore per il campo \"Nome Agenzia\".");
		theForm.nome.focus();
		return (false);
	}
if (theForm.ragione.value == "")
	{
		alert("Inserire un valore per il campo \"Ragione Sociale\".");
		theForm.ragione.focus();
		return (false);
	}		
if (theForm.piva.value == "")
	{
		alert("Inserire un valore per il campo \"Partita IVA\".");
		theForm.piva.focus();
		return (false);
	}
if (theForm.titolare.value == "")
	{
		alert("Inserire un valore per il campo \"Titolare/referente\".");
		theForm.titolare.focus();
		return (false);
	}
if (theForm.indirizzo.value == "")
	{
		alert("Inserire un valore per il campo \"Indirizzo\".");
		theForm.indirizzo.focus();
		return (false);
	}		
if (theForm.cap.value == "")
	{
		alert("Inserire un valore per il campo \"CAP\".");
		theForm.cap.focus();
		return (false);
	}
if (theForm.comune.value == "")
	{
		alert("Inserire un valore per il campo \"Comune\".");
		theForm.comune.focus();
		return (false);
	}			
if (theForm.provincia.value == "")
	{
		alert("Inserire un valore per il campo \"Provincia\".");
		theForm.provincia.focus();
		return (false);
	}	
if (theForm.regione.value == "")
	{
		alert("Inserire un valore per il campo \"Regione\".");
		theForm.regione.focus();
		return (false);
	}	
if (theForm.mail.value == "")
	{
		alert("Inserire un valore per il campo \"Indirizzo e-mail\".");
		theForm.mail.focus();
		return (false);
	}	
if(!isEmail(theForm.mail)) return false;	
if (theForm.tel.value == "")
	{
		alert("Inserire un valore per il campo \"Nr. di Telefono\".");
		theForm.tel.focus();
		return (false);
	}	
	
	return (true);
}
//########################################################################################


//FORM IMMOBILE //########################################################################################
function controllaformImmobili(theForm)
{
if (theForm.id_agenzia.value == "")
	{
		alert("Inserire un valore per il campo \"Nome Agenzia\".");
		theForm.id_agenzia.focus();
		return (false);
	}
if (theForm.nazione.value == "IT"){
		if (theForm.provincia.value == ""){
				alert("Inserire un valore per il campo \"Provincia\".");
				theForm.provincia.focus();
				return (false);
			}	
		}else{
		theForm.provincia.value = ""
}		
if (theForm.comune.value == "" || theForm.comune.value == "undefined")
	{
		alert("Inserire un valore per il campo \"Comune\".");
		theForm.comune.focus();
		return (false);
	}	
if (theForm.descrizione.value == "")
	{
		alert("Inserire un valore per il campo \"Descrizione\".");
		theForm.descrizione.focus();
		return (false);
	}
	return (true);
}
//########################################################################################


//FORM REGISTRAZIONE UTENTE ########################################################################################
function controllaformRegistrazioneUtente(theForm)
{
if (theForm.nome.value == "")
	{
		alert("Inserire un valore per il campo \"Nome\".");
		theForm.nome.focus();
		return (false);
	}
if (theForm.cognome.value == "")
	{
		alert("Inserire un valore per il campo \"Cognome\".");
		theForm.cognome.focus();
		return (false);
	}
if (theForm.citta.value == "")
	{
		alert("Inserire un valore per il campo \"Cittā\".");
		theForm.citta.focus();
		return (false);
	}	
if (theForm.cap.value == "")
	{
		alert("Inserire un valore per il campo \"CAP\".");
		theForm.cap.focus();
		return (false);
	}	
if (theForm.provincia.value == "")
	{
		alert("Inserire un valore per il campo \"Provincia\".");
		theForm.provincia.focus();
		return (false);
	}	
if (theForm.email.value == "")
	{
		alert("Inserire un valore per il campo \"Indirizzo e-mail\".");
		theForm.email.focus();
		return (false);
	}	
if (theForm.conferma_mail.value == "")
	{
		alert("Inserire un valore per il campo \"Conferma indirizzo e-mail\".");
		theForm.conferma_mail.focus();
		return (false);
	}	
if (eval(theForm.h_id_motivazione.value) == 0)
	{ 
		alert("Selezionare almeno una preferenza per \"Tipo Contratto\".");
		theForm.id_motivazione[0].focus();		
		return (false);
	}		
if (eval(theForm.h_id_tipologia.value) == 0)
	{
		alert("Inserire almeno una preferenza per \"Tipologia Immobile\".");
		theForm.id_tipologia[0].focus();				
		return (false);
	}		
if (eval(theForm.h_id_provincia.value) == 0)
	{
		alert("Inserire almeno una preferenza per \"Provincia Immobile\".");
		theForm.id_provincia[0].focus();				
		return (false);
	}		
if (eval(theForm.h_prezzo.value) == 0)
	{
		alert("Inserire almeno una preferenza per \"Fascia di prezzo\".");
		theForm.prezzo[0].focus();				
		return (false);
	}		
	return (true);
}
//########################################################################################

//Eliminazioe Immobile
function confermaEliminazioneImmobile(theForm)
{
	return confirm("Confermi l'eliminazione dell'immobile?");
	return (true);
}

//Eliminazioe Immagine
function confermaEliminazioneImmagine(theForm)
{
	return confirm("Confermi l'eliminazione dell'immagine?");
	return (true);
}

// #################################################################################################
// #################################################################################################


function check_green(controllo, hide, maxopt) {
	if (controllo.checked) {
	if ( eval(hide.value) >= maxopt ){alert("E' possibile selezionare un massimo di "+maxopt+" opzioni!"); return false;}	if ( eval(hide.value) >= maxopt ){alert("E' possibile selezionare un massimo di "+maxopt+" opzioni!"); return false;}
		hide.value = eval(hide.value) + 1;
		return controllo.className = 'Green';
	}	else {
			hide.value = eval(hide.value) - 1;
			return controllo.className = '';		
		}
	}

function check_orange(controllo) {
	if (controllo.checked) {
		return controllo.className = 'Orange';
	}	else {
			return controllo.className = '';		
		}
	}


function getXMLHttp() {
var xmlhttp = null;
if (window.ActiveXObject) {
  if (navigator.userAgent.toLowerCase().indexOf("msie 5") != -1) {
  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } else {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  }
}
if (!xmlhttp && typeof(XMLHttpRequest) != 'undefined') {
  xmlhttp = new XMLHttpRequest()
}
return xmlhttp
}

function green(controllo, hide) {
	if (controllo.checked) {
		hide.value = eval(hide.value) + 1;
		return controllo.className = 'Green';
	}	else {
		hide.value = eval(hide.value) - 1;
		return controllo.className = '';		
	}
}

//FORM CERCO IMMOBILE ########################################################################################
function controllaformCercoImmobile(theForm)
{
	
if (theForm.provincia.value == "")
	{
		alert("Selezionare una Provincia.");
		theForm.provincia.focus();
		return (false);
	}

if (! document.all.h_id_localita)
	{ 
		display(theForm.provincia.value);
		alert("Selezionare almeno un Comune.");
		theForm.id_localita[0].focus();		
		return (false);
	}		

if (eval(theForm.h_id_localita.value) == 0)
	{ 
		alert("Selezionare almeno un Comune.");
		theForm.id_localita[0].focus();		
		return (false);
	}		


if (eval(theForm.h_id_tipologia.value) == 0)
	{
		alert("Inserire almeno una preferenza per \"Tipologia Immobile\".");
		theForm.id_tipologia[0].focus();				
		return (false);
	}		

if (theForm.prezzo.value == "")
	{
		alert("Inserire il prezzo massimo dell'immobile.");
		theForm.prezzo.focus();				
		return (false);
	}		

if (theForm.mq.value == "")
	{
		alert("Inserire i metri quadri indicativi dell'immobile cercato.");
		theForm.mq.focus();				
		return (false);
	}		


if (theForm.descrizione.value == "")
	{
		alert("Inserire il testo dell'annuncio.");
		theForm.descrizione.focus();				
		return (false);
	}		

if (theForm.nome.value == "")
	{
		alert("Inserire un valore per il campo \"Nome\".");
		theForm.nome.focus();
		return (false);
	}
if (theForm.cognome.value == "")
	{
		alert("Inserire un valore per il campo \"Cognome\".");
		theForm.cognome.focus();
		return (false);
	}
if (theForm.telefono.value == "")
	{
		alert("Inserire un valore per il campo \"Telefono\".");
		theForm.telefono.focus();
		return (false);
	}
if (theForm.email.value == "")
	{
		alert("Inserire un valore per il campo \"Indirizzo e-mail\".");
		theForm.email.focus();
		return (false);
	}	
	
if(!isEmail(theForm.email)) return false;	
	
if (theForm.conferma_mail.value == "")
	{
		alert("Inserire un valore per il campo \"Conferma indirizzo e-mail\".");
		theForm.conferma_mail.focus();
		return (false);
	}		
if (theForm.email.value != theForm.conferma_mail.value)
	{
		alert("I campi e-mail e conferma e-mail non corrispondono!");
		theForm.email.focus();
		return (false);
	}		
	
//if (theForm.confermalettura.checked == false)
//	{
//		alert("Attenzione: devi confermare di aver preso visione dell'informativa circa il trattamento dei dati personali.");
//		theForm.confermalettura.focus();
//		return (false);
//	}	

if (theForm.privacy[0].checked == false)
	{
		alert("Attenzione: negando il consenso al trattamento dei dati personali non sarā possibile usufruire del servizio.");
		theForm.privacy[0].focus();
		return (false);
	}	
	
	return confirm("Confermi l'invio della richiesta?");	
	return (true);
}
//########################################################################################


//FORM OFFRO IMMOBILE ########################################################################################
function controllaformOffroImmobile(theForm)
{

if (theForm.provincia.value == "")
	{
		alert("Selezionare una Provincia.");
		theForm.provincia.focus();
		return (false);
	}

if (! document.all.id_localita)
	{ 
		display(theForm.provincia.value);
		alert("Selezionare il Comune dell'immobile.");
		theForm.id_localita.focus();		
		return (false);
	}		


if (theForm.id_localita.value == "")
	{ 
		alert("Selezionare il Comune dell'immobile.");
		theForm.id_localita.focus();
		return (false);
	}		


if (theForm.id_tipologia.value == "")
	{
		alert("Selezionare la tipologia dell'immobile.");
		theForm.id_tipologia.focus();				
		return (false);
	}		

if (theForm.prezzo.value == "")
	{
		alert("Inserire il prezzo dell'immobile.");
		theForm.prezzo.focus();				
		return (false);
	}		
if (theForm.descrizione.value == "")
	{
		alert("Inserire il testo dell'annuncio.");
		theForm.descrizione.focus();				
		return (false);
	}		

if (theForm.nome.value == "")
	{
		alert("Inserire un valore per il campo \"Nome\".");
		theForm.nome.focus();
		return (false);
	}
if (theForm.cognome.value == "")
	{
		alert("Inserire un valore per il campo \"Cognome\".");
		theForm.cognome.focus();
		return (false);
	}
if (theForm.telefono.value == "")
	{
		alert("Inserire un valore per il campo \"Telefono\".");
		theForm.telefono.focus();
		return (false);
	}
if (theForm.email.value == "")
	{
		alert("Inserire un valore per il campo \"Indirizzo e-mail\".");
		theForm.email.focus();
		return (false);
	}	

if(!isEmail(theForm.email)) return false;
	
if (theForm.conferma_mail.value == "")
	{
		alert("Inserire un valore per il campo \"Conferma indirizzo e-mail\".");
		theForm.conferma_mail.focus();
		return (false);
	}		
if (theForm.email.value != theForm.conferma_mail.value)
	{
		alert("I campi e-mail e conferma e-mail non corrispondono!");
		theForm.email.focus();
		return (false);
	}		
	
	
//if (theForm.confermalettura.checked == false)
//	{
//		alert("Attenzione: devi confermare di aver preso visione dell'informativa circa il trattamento dei dati personali.");
//		theForm.confermalettura.focus();
//		return (false);
//	}	

if (theForm.privacy[0].checked == false)
	{
		alert("Attenzione: negando il consenso al trattamento dei dati personali non sarā possibile usufruire del servizio.");
		theForm.privacy[0].focus();
		return (false);
	}		
	
	return confirm("Confermi l'invio della richiesta?");	
	return (true);
}
//########################################################################################

//FLASH LINK

	var flashlinks=new Array()
	
	function changelinkcolor(){
	for (iFlash=0; iFlash< flashlinks.length; iFlash++){
	var flashtype=document.getElementById? flashlinks[iFlash].getAttribute("flashtype")*1 : flashlinks[iFlash].flashtype*1
	var flashcolor=document.getElementById? flashlinks[iFlash].getAttribute("flashcolor") : flashlinks[iFlash].flashcolor
	if (flashtype==0){
	if (flashlinks[iFlash].style.color!=flashcolor)
	flashlinks[iFlash].style.color=flashcolor
	else
	flashlinks[iFlash].style.color=''
	}
	else if (flashtype==1){
	if (flashlinks[iFlash].style.backgroundColor!=flashcolor)
	flashlinks[iFlash].style.backgroundColor=flashcolor
	else
	flashlinks[iFlash].style.backgroundColor=''
	}
	}
	}
	
	function init(){
	var i=0
	if (document.all){
	while (eval("document.all.flashlink"+i)!=null){
	flashlinks[i]= eval("document.all.flashlink"+i)
	i++
	} 
	}
	else if (document.getElementById){
	while (document.getElementById("flashlink"+i)!=null){
	flashlinks[i]= document.getElementById("flashlink"+i)
	i++
	}
	}
	setInterval("changelinkcolor()", 500)
	}
	
	if (window.addEventListener)
	window.addEventListener("load", init, false)
	else if (window.attachEvent)
	window.attachEvent("onload", init)
	else if (document.all)
	window.onload=init
// FINE FLASH LINK

//FORM REGISTRAZIONE Portali Immobiliarei (pag registrazione_agenzie_PI.asp)
function controllaFormRegistrazioneAgenzia(theForm)
{
if (theForm.nominativo.value == "")
	{
		alert("Inserire un valore per il campo \"Nome Agenzia\".");
		theForm.nominativo.focus();
		return (false);
	}
if (theForm.ragione_sociale.value == "")
	{
		alert("Inserire un valore per il campo \"Ragione Sociale\".");
		theForm.ragione_sociale.focus();
		return (false);
	}		
if (theForm.responsabile.value == "")
	{
		alert("Inserire un valore per il campo \"Titolare/referente\".");
		theForm.responsabile.focus();
		return (false);
	}
if (theForm.indirizzo.value == "")
	{
		alert("Inserire un valore per il campo \"Indirizzo\".");
		theForm.indirizzo.focus();
		return (false);
	}		
if (theForm.cap.value == "")
	{
		alert("Inserire un valore per il campo \"CAP\".");
		theForm.cap.focus();
		return (false);
	}
if (theForm.comune.value == "")
	{
		alert("Inserire un valore per il campo \"Comune\".");
		theForm.comune.focus();
		return (false);
	}			
if (theForm.provincia.value == "")
	{
		alert("Inserire un valore per il campo \"Provincia\".");
		theForm.provincia.focus();
		return (false);
	}	
if (theForm.mail.value == "")
	{
		alert("Inserire un valore per il campo \"Indirizzo e-mail\".");
		theForm.mail.focus();
		return (false);
	}	
if(!isEmail(theForm.mail)) return false;
	
if (theForm.telefono1.value == "")
	{
		alert("Inserire un valore per il campo \"Nr. di Telefono\".");
		theForm.telefono1.focus();
		return (false);
	}	
if (theForm.password.value == "")
	{
		alert("Inserire un valore per il campo \"Password\".");
		theForm.password.focus();
		return (false);
	}		
	
	return confirm("Confermi l'invio dei dati?");
	return (true);
}
//########################################################################################

function disable_ctrlv(){
  // current pressed key
  var pressedKey = String.fromCharCode(event.keyCode).toLowerCase();
	
  if (event.ctrlKey && (pressedKey == "c" || pressedKey == "v")) {
    event.returnValue = false;
  }
	if (event.shiftKey && (event.keyCode == 45)){
    event.returnValue = false;		
	} 
}
//v1.0
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}

function controllaformAppuntamento(theForm)
{
if (theForm.agenzia.value == "" || theForm.persona.value == "" || theForm.telefono.value == "" || theForm.mail.value == "" || theForm.note.value == "")
	{
		alert("Compilare tutti i campi del modulo!");
		theForm.agenzia.focus();
		return (false);
	}
	return (true);
}

//Eliminazioe provincia
function confermaEliminazioneProvinciaPreferenze()
{
	return confirm("Confermi l'eliminazione della provincia?");
	return (true);
}


function changeBox(cbox) {
	box = eval(cbox);
	box.checked = !box.checked;
}

//Finestra Modale
	var myWin=null,	isBlocked=false;	
	
	function checkFocus(){
		if (myWin && !myWin.closed){
			myWin.focus();
			return false;			
		}else if (isBlocked) {
			document.releaseEvents(Event.MOUSEDOWN);
			document.onmousedown=null;			
			isBlocked=false;
		}
	}

	function openModalDialog(url, t,l,w,h){
		if (document.layers){
			document.captureEvents(Event.MOUSEDOWN);
			document.onmousedown=checkFocus;
			isBlocked=true;
			
			//myWin=window.open(url,"newWin","top="+t+",left="+l+",width="+w+",height="+h);
			myWin=window.open(url,"newWin","width="+w+",height="+h);			
			myWin.focus();
		}
		if (document.all)
			//window.showModalDialog(url,"","dialogTop:"+t+"px;dialogLeft:"+l+"px;dialogWidth:"+w+"px;dialogHeight:"+h+"px");
			window.showModalDialog(url,"","dialogWidth:"+w+"px;dialogHeight:"+h+"px");
	}
	
//Invio Generico
function confermaInvioDati(theForm)
{
	return confirm("Confermi l'invio dei dati?");
	return (true);
}
	



	
	