var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height, toscroll)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.focus();
  }
	if (toscroll == ""){
		toscroll = 'no';
	}	
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+toscroll+',resizable='+toscroll+',copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

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 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 >=48 && event.keyCode <=57)) {
		return true
	} else {
		if(pwd == 1){alert("Carattere '" + String.fromCharCode(event.keyCode) + "' non consentito")};
		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 stop_indesidered_keys_nr_immobili(pwd) {
	if  (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 , 'mywin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=1000,height=500,left=0,top=0,screenX=0,screeny=0');
	mywin.focus();
}

function open_window_auto( n )
{
	mywin = window.open(n , 'mywin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=500,height=150,left=0,top=0,screenX=0,screeny=0');
	mywin.focus();
}

function openPopUp( n )
{
	mywin = window.open(n , 'mywin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=395,height=195,left=10,top=10,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 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 openLayer(layerID){
	if (document.all[layerID].style.overflow == "hidden" ){
		document.all[layerID].style.overflow = "visible"
		MM_swapImage('img_'+layerID,'','/img/layer_close.gif',1);
	}else{	
		document.all[layerID].style.overflow = "hidden"
		MM_swapImage('img_'+layerID,'','/img/layer_open.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 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.richiesta.value == "")
	{
		alert("Inserire un valore per il campo \"RICHIESTA\".");
		theForm.richiesta.focus();
		return (false);
	}	

	return (true);
}




//FORM REGISTRAZIONE
function controllaformRegistrazione(theForm)
{

	alert(theForm.azione.value);
	
if (theForm.azione.value == "X") 
{
	alert(theForm.azione.value);
	//return confirm("Confermi l'eliminazione dell'agenzia?");
	//return (true);
}

if (theForm.nominativo.value == "")
	{
		alert("Inserire un valore per il campo \"Nome Agenzia\".");
		theForm.nominativo.focus();
		return (false);
	}
if (theForm.comune.value == "")
	{
		alert("Inserire un valore per il campo \"Comune\".");
		theForm.comune.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.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 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.piva.value == "")
	{
		alert("Inserire un valore per il campo \"Partita IVA\".");
		theForm.piva.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.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.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);
}
//########################################################################################


//FORM IMMOBILI //#########################################################################
function controllaformImmobili(theForm)
{
if (theForm.riferimento.value == "")
	{
		alert("Inserire un valore per il campo \"Riferimento\".");
		theForm.riferimento.focus();
		return (false);
	}	
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);
	}



//CONTROLLO PORTALI	
/*
if (eval(theForm.h_id_portaliGratuiti.value) == 0)
	{ 
		alert("Selezionare almeno un Portale.");
		theForm.id_portaleGratuito[0].focus();		
		return (false);
	}

*/

	//var azione = confirm("CONFERMA PUBBLICAZIONE IMMOBILE\n\nL\'immobile verrà pubblicato su " + form.h_id_portaliGratuiti.value + " portali e verranno scalati " +  formatfloat(form.credito_necessario.value, 3) + " € dal tuo credito.\n\nClicca su OK per confermare l'inserimento e attendi di essere indirizzato alla pagina GESTIONE IMMOBILI")
	var azione = confirm("CONFERMA PUBBLICAZIONE IMMOBILE\n\nClicca su OK per confermare l'inserimento e attendi di essere indirizzato alla pagina IMMOBILI PUBBLICATI")	
	if (azione){
		document.getElementById('scheda_immobile').style.overflow = "hidden";
		document.getElementById('attendi').style.overflow = "visible";	
		return (true);
	}else{
		return (false);
	}
}


//FORM IMMOBILI //#########################################################################
function controllaformImmobiliAuto(theForm)
{
if (theForm.riferimento.value == "")
	{
		alert("Inserire un valore per il campo \"Riferimento\".");
		theForm.riferimento.focus();
		return (false);
	}	
if (theForm.id_agenzia.value == "")
	{
		alert("Inserire un valore per il campo \"Nome Agenzia\".");
		theForm.id_agenzia.focus();
		return (false);
	}
if (theForm.provincia.value == ""){
		alert("Inserire un valore per il campo \"Provincia\".");
		theForm.provincia.focus();
		return (false);
	}	
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);
	}


	var azione = confirm("CONFERMA PUBBLICAZIONE IMMOBILE.\n\nClicca su OK per confermare l'inserimento e attendi di essere indirizzato alla pagina IMMOBILI PUBBLICATI")
	if (azione){
		document.getElementById('scheda_immobile').style.overflow = "hidden";
		document.getElementById('attendi').style.overflow = "visible";	
		return (true);
	}else{
		return (false);
	}
	

}



function fineAttesa(){
		document.getElementById('scheda_immobile').style.overflow = "visible";
		document.getElementById('attendi').style.overflow = "hidden";	
	}

function apriPopupCentrata(nome, titolo, lar, alt, feat){
        var wdt = screen.width;
        var hgt = screen.height;
        var x = Math.round( (wdt / 2) - (lar / 2) );
        var y = Math.round( (hgt / 2) - (alt / 2) );
        window.open(nome, titolo, 'width=' + lar + ',height=' + alt + ',left=' + x + ',screenX=' + x + ',top=' + y + ',screenY=' + y + ',' + feat);
}


//########################################################################################

function controllaformAttivaCrediti(theForm)
{
//if (theForm.data_pagamento.value == "")
//	{
//		alert("Inserire un valore per il campo \"Data Pagamento\".");
//		theForm.data_pagamento.focus();
//		return (false);
//	}	
if (theForm.note_pagamento.value == "")
	{
		alert("Inserire un valore per il campo \"Note Pagamento\".");
		theForm.note_pagamento.focus();
		return (false);
	}
	
	return confirm("CONFERMA ATTIVAZIONE CREDITI\n\nVerranno attivati " + form.h_numero_crediti.value + " crediti all'agenzia " +  form.h_agenzia.value + ".\n\nClicca su OK per confermare l'attivazione.")
	return (true);
}

function controllaformInserisciPagamento(theForm)
{
if (theForm.dataPagamento.value == "")
	{
		alert("Inserire un valore per il campo \"Data Pagamento\".");
		theForm.dataPagamento.focus();
		return (false);
	}	
if (theForm.importo.value == "")
	{
		alert("Inserire un valore per il campo \"Importo\".");
		theForm.importo.focus();
		return (false);
	}	
if (theForm.note.value == "")
	{
		alert("Inserire un valore per il campo \"Note\".");
		theForm.note.focus();
		return (false);
	}
	
	return confirm("CONFERMI PAGAMENTO DI EURO " + theForm.importo.value + " in data " +  theForm.dataPagamento.value + "\nrelativo all'ordine " +  theForm.id_ordine_crediti.value) + "?"
	return (true);
}

function inputData(campo, data)
{
	campo.value = data;
}

function confermaAcquistoCrediti(theForm)
{
	return confirm("CONFERMI L'ACQUISTO DEI CREDITI?")
	return (true);
}

function confermaRichiestaInfoPacchetti(theForm, nomePacchetto)
{
	return confirm("Desideri maggiori informazioni sul " +nomePacchetto+ "?\n\nClicca su ok e verrai contattato al più presto da un nostro responsabile ")
	return (true);
}

function confermaRichiestaAcquistoPacchettoAuto(theForm, prezzo)
{
	return confirm("Desideri acquistare il pacchetto Automatizzato a " +prezzo+ ",00 euro + iva?\n\nClicca su ok e verrai contattato al più presto da un nostro responsabile ")
	return (true);
}

function proConfermaRichiestaAcquistoPacchettoAuto(theForm, prezzo)
{
	if (theForm.modalita_pagamento[0].checked == false && theForm.modalita_pagamento[1].checked == false && theForm.modalita_pagamento[2].checked == false)
		{
			alert("Seleziona una modalità di pagamento");
			theForm.modalita_pagamento[0].focus();
			return (false);
		}
	return confirm("Desideri acquistare il pacchetto Automatizzato a " +prezzo+ ",00 euro + iva?\n\nClicca su ok e verrai contattato al più presto da un nostro responsabile ")
	return (true);
}


function confermaRichiestaPacchettoGoogle(theForm)
{
	return confirm("Desideri ricevere maggiori informazioni sul Pacchetto Google?\n\nClicca su ok e verrai contattato al più presto da un nostro responsabile ")
	return (true);
}

function confermaRichiestaStatistiche(theForm)
{
	return confirm("Desideri ricevere maggiori informazioni sul Pacchetto Statistiche Accessi?\n\nClicca su ok e verrai contattato al più presto da un nostro responsabile ")
	return (true);
}

function confermaRichiestaPubblicitaPortali(theForm)
{
	return confirm("Desideri ricevere maggiori informazioni su come aumentare il numero dei Portali immobiliari?\n\nClicca su ok e verrai contattato al più presto da un nostro responsabile ")
	return (true);
}

function confermaRichiestaAumentaPortali(theForm)
{
	return confirm("Desideri ricevere maggiori informazioni sul servizio Promotore?\n\nClicca su ok e verrai contattato al più presto da un nostro responsabile ")
	return (true);
}

function confermaEliminazionePortale(theForm)
{
	return confirm("Ti informiamo che stai per eliminare il portale selezionato.\n\nCliccando su ok il portale verrà eliminato dalla lista dei portali attivati.")
	return (true);
}

function confermaAttivazioneAutomatizzati(theForm)
{
	return confirm("Desideri inviare la richiesta di attivazione dei Portali Automatizzati?\n\nClicca su ok e verrà inviata la mail di richiesta attivazione all'amministratore del sistema ")
	return (true);
}

function controllaformAttivaPortali(theForm)
{
if (theForm.id_portale.value == "")
	{
		alert("Selezionare un portale da attivare!");
		theForm.id_portale.focus();
		return (false);
	}	
if (theForm.username.value == "")
	{
		alert("Inserire un valore per il campo \"Username\".");
		theForm.username.focus();
		return (false);
	}
if (theForm.password.value == "")
	{
		alert("Inserire un valore per il campo \"Password\".");
		theForm.password.focus();
		return (false);
	}
	//return confirm("CONFERMI L'ATTIVAZIONE DEL PORTALE?"")
	return (true);
}

function controllaformCambioPortale(theForm)
{
if (theForm.id_portale.value == "")
	{
		alert("Selezionare un portale da attivare!");
		theForm.id_portale.focus();
		return (false);
	}	
	//return confirm("CONFERMI L'ATTIVAZIONE DEL PORTALE?"")
	return (true);
}

function controllaformAttivaNuovoPortale(theForm)
{
if (theForm.id_portale.value == "")
	{
		alert("Selezionare un portale da attivare!");
		theForm.id_portale.focus();
		return (false);
	}	
	//return confirm("CONFERMI L'ATTIVAZIONE DEL PORTALE?"")
	return (true);
}

function confermaEliminazioneRichiesta(theForm)
{
	return confirm("Vuoi eliminare la richiesta selezionata?")
	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, riferimento)
{
	return confirm("Confermi l'eliminazione dell'immobile \""+riferimento+"\"?");
		return (true);
}

//Modifica Immobile
function confermaModificaImmobile(theForm)
{
if (theForm.riferimento.value == "")
	{
		alert("Inserire un valore per il campo \"Riferimento\".");
		theForm.riferimento.focus();
		return (false);
	}	
if (theForm.id_agenzia.value == "")
	{
		alert("Inserire un valore per il campo \"Nome Agenzia\".");
		theForm.id_agenzia.focus();
		return (false);
	}
if (theForm.provincia.value == ""){
		alert("Inserire un valore per il campo \"Provincia\".");
		theForm.provincia.focus();
		return (false);
	}	
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);
	}

	var azione =  confirm("Confermi la modifica dell'immobile?")
	if (azione){
		document.getElementById('scheda_immobile').style.overflow = "hidden";
		document.getElementById('attendi').style.overflow = "visible";	
		return (true);
	}else{
		return (false);
	}
}

//Eliminazioe Immagine
function confermaEliminazioneImmagine(theForm)
{
	return confirm("Confermi l'eliminazione dell'immagine?");
	return (true);
}

//Eliminazioe Agenzia
function confermaEliminazioneAgenzia(theForm)
{
	return confirm("Confermi l'eliminazione dell'agenzia?");
	return (true);
}

//Eliminazioe Agenzia
function confermaInvioMail(theForm)
{
	return confirm("Confermi l'invio della mail?");
	return (true);
}

//Eliminazioe Agenzia
function alertContratto()
{
	return alert("Ricordarsi di eliminare nella mail il testo inerente il contratto!");
}
// #################################################################################################
// #################################################################################################


function check_green(controllo, hide, conta_crediti) {
	if (controllo.checked) {
		hide.value = eval(hide.value) + 1;
		conta_crediti.innerText = hide.value 
		return controllo.className = 'Green';
	}	else {
		hide.value = eval(hide.value) - 1;
		conta_crediti.innerText = hide.value 
		return controllo.className = '';		
	}
}

// Funzione per la selezione di tutti i portali
function select_all(Name, numPortali)
{
	//azzera il contatore
	form.h_id_portaliGratuiti.value = 0
	for(i=0; i<numPortali; i++) {			
			document.all.id_portaleGratuito[i].checked=true;
			check_green(document.all.id_portaleGratuito[i], form.h_id_portaliGratuiti, document.getElementById('crediti_utilizzati'))
	}
}
 
// Funzione per la deselezione di tutti i portali
function unSelect_all(Name, numPortali)
{
	document.getElementById('h_id_portaliGratuiti').value = numPortali
	for(i=0; i<numPortali; i++) {
	document.all.id_portaleGratuito[i].checked=false;
	check_green(document.all.id_portaleGratuito[i], document.getElementById('h_id_portaliGratuiti'), document.getElementById('crediti_utilizzati'))
	}
}

// Funzione per la selezione dei portali preferiti
function select_pref(Name, numPortali)
{	

	unSelect_all(Name, numPortali)
	form.h_id_portaliGratuiti.value = 0

	for(i=0; i<numPortali; i++) {	
			if (i == 0 || i == 1 || i == 3 || i == 12 || i == 7 || i == 11 || i == 22) { 
				document.all.id_portaleGratuito[i].checked=true;
				check_green(document.all.id_portaleGratuito[i], form.h_id_portaliGratuiti, document.getElementById('crediti_utilizzati'))
			}	
	}
}

function check_green(controllo, hide, conta_crediti) {
	if (controllo.checked) {
		hide.value = eval(hide.value) + 1;
		conta_crediti.innerText = hide.value 
		return controllo.className = 'Green';
	}	else {
		hide.value = eval(hide.value) - 1;
		conta_crediti.innerText = hide.value 
		return controllo.className = '';		
	}
}

//Funzione che aggiunge o sottrae da una casella
function preventivo_add_immobile(valore, campo, limiteMinimo){
	if(campo.value >= limiteMinimo){
		campo.value = eval(campo.value) + eval(valore);
		if(campo.value < limiteMinimo) campo.value = limiteMinimo
		
	}else{
		alert("Non è possibile inserire meno di " +limiteMinimo+ " immobili!")
	}
	document.getElementById("span_nr_immobili").innerText = campo.value;
	return calcola_preventivo(document.getElementById("span_nr_immobili"), document.getElementById("span_nr_portali"), 2)
}

//Funzione che aggiunge o sottrae da una casella
function preventivo_add_nr_portale(valore, campo, limiteMinimo, limiteMassimo){
	if((campo.value >= limiteMinimo) && (campo.value <= limiteMassimo) ){
		campo.value = eval(campo.value) + eval(valore);
		if(campo.value < limiteMinimo) campo.value = limiteMinimo
		if(campo.value > limiteMassimo) campo.value = limiteMassimo		
	}else{
		alert("Scegliere un numero di portali compreso tra " +limiteMinimo+ " e " + limiteMassimo)
	}
	
	document.getElementById("span_nr_portali").innerText = campo.value;
	document.getElementById("h_id_portaliGratuiti").innerText = campo.value;	
	return calcola_preventivo(document.getElementById("span_nr_immobili"), document.getElementById("span_nr_portali"), 2)
}

function preventivo_add_portale(controllo, hide, conta_crediti) {
	if (controllo.checked) {
		hide.value = eval(hide.value) + 1;
		conta_crediti.innerText = hide.value 
		controllo.className = 'Orange';
	}	else {
		hide.value = eval(hide.value) - 1;
		conta_crediti.innerText = hide.value 
		controllo.className = '';		
	}
	return calcola_preventivo(document.getElementById("span_nr_immobili"), document.getElementById("span_nr_portali"), 2)	
}

//preventivo acquisto pacchetto auto AGGIUNTA PORTALI
function auto_preventivo_add_portale(controllo, hide, conta_crediti, prezzo_portale_no_auto, defaultValue) {
	if (controllo.checked) {
		hide.value = eval(hide.value) + 1;
		conta_crediti.innerText = hide.value 
		controllo.className = 'Orange';
		document.getElementById("h_tot_prezzo_pacchetto_auto").value = eval(document.getElementById("h_tot_prezzo_pacchetto_auto").value) + eval(prezzo_portale_no_auto.value)
		prezzo_portale_no_auto.readOnly = false
		prezzo_portale_no_auto.style.visibility = "visible"
		prezzo_portale_no_auto.style.width = 32		
}	else {
		hide.value = eval(hide.value) - 1;
		conta_crediti.innerText = hide.value 
		controllo.className = '';		
		document.getElementById("h_tot_prezzo_pacchetto_auto").value = eval(document.getElementById("h_tot_prezzo_pacchetto_auto").value) - eval(prezzo_portale_no_auto.value)		
		prezzo_portale_no_auto.readOnly = true
		prezzo_portale_no_auto.style.visibility = "hidden"
		prezzo_portale_no_auto.style.width = 1		
		prezzo_portale_no_auto.value = defaultValue
	}	
	return auto_calcola_preventivo();
}


function spunto(controllo, hide, conta_crediti) {
	
	if (controllo.checked) {
		hide.value = eval(hide.value) + 1;
		conta_crediti.innerText = hide.value;
		controllo.className = 'Orange';
}	else {
		hide.value = eval(hide.value) - 1;
		conta_crediti.innerText = hide.value ;
		controllo.className = '';		
	}	
}



function tmp_price(oldPrice){
	 alert("123")
	 document.getElementById("tmp_price").value = oldPrice
}

function auto_aggiorna_preventivo(newPrice){
	document.getElementById("h_tot_prezzo_pacchetto_auto").value = eval(document.getElementById("h_tot_prezzo_pacchetto_auto").value) - eval(document.getElementById("tmp_price").value) + eval(newPrice)
	return auto_calcola_preventivo();	
}

//Funzione Calcola Preventivo Pacchetto Auto
function auto_calcola_preventivo(){
	document.getElementById("costo_totale").innerText = formatfloat( (eval(document.getElementById("h_tot_prezzo_pacchetto_auto").value)) , 3 )		
	document.getElementById('tmp_price').value = 0
	auto_applica_sconto(document.getElementById('sconto').value)	
}



function scelta_portali(controllo, hide, conta_crediti) {
	if (controllo.checked) {
		if (hide.value == 0){
			controllo.checked = false;
			return false;
		}  
		hide.value = eval(hide.value) - 1;
		conta_crediti.innerText = hide.value 
		controllo.className = 'Orange';
	}	else {
		hide.value = eval(hide.value) + 1;
		conta_crediti.innerText = hide.value 
		controllo.className = '';		
	}
	if (hide.value == 0){
			document.getElementById("conferma_portali").disabled = false
		}else{
			document.getElementById("conferma_portali").disabled = true
	}
	//return calcola_preventivo(document.getElementById("span_nr_immobili"), document.getElementById("span_nr_portali"), 2)	
}

//Aggiorna preventivo e valori, se scrivo il nr degli immobili
function aggiorna_preventivo_nr_immobili(valore, campo, limiteMinimo){
	if (valore == "") {valore = 0}
	
	if(campo.value >= limiteMinimo){
		campo.value = valore;
		if(campo.value < limiteMinimo) campo.value = limiteMinimo
		
	}else{
		alert("Non è possibile inserire meno di " +limiteMinimo+ " immobili!")
		campo.value = limiteMinimo;
	}
	document.getElementById("span_nr_immobili").innerText = campo.value;
	return calcola_preventivo(document.getElementById("span_nr_immobili"), document.getElementById("span_nr_portali"), 2)
}

//Aggiorna preventivo e valori, se scrivo il nr degli immobili In tempo reale
function aggiorna_preventivo_nr_immobili_rt(valore, campo){
	document.getElementById("span_nr_immobili").innerText = campo.value;
	document.getElementById("sconto").value = 0;
	return calcola_preventivo(document.getElementById("span_nr_immobili"), document.getElementById("span_nr_portali"), 2)
}

//Aggiorna preventivo e valori, se scrivo il nr dei portali
function aggiorna_preventivo_nr_portali(valore, campo, limiteMinimo, limiteMassimo){
	if (valore == "") {valore = 0}
	
	if((campo.value >= limiteMinimo) && (campo.value <= limiteMassimo) ){
		campo.value = valore;
		if(campo.value < limiteMinimo) campo.value = limiteMinimo
		if(campo.value > limiteMassimo) campo.value = limiteMassimo				
	}else{
		alert("Scegliere un numero di portali compreso tra " +limiteMinimo+ " e " + limiteMassimo)
		//alert("Non è possibile selezionare meno di " +limiteMinimo+ " portali!")
		campo.value = limiteMinimo;
	}
	document.getElementById("h_id_portaliGratuiti").innerText = campo.value;
	document.getElementById("span_nr_portali").innerText = campo.value;
	return calcola_preventivo(document.getElementById("span_nr_immobili"), document.getElementById("span_nr_portali"), 2)
}


//Aggiorna preventivo e valori, se scrivo il nr dei portali In tempo reale
function aggiorna_preventivo_nr_portali_rt(valore, campo){
	document.getElementById("span_nr_portali").innerText = campo.value;
	document.getElementById("h_id_portaliGratuiti").innerText = campo.value;
	document.getElementById("sconto").value = 0;	
	return calcola_preventivo(document.getElementById("span_nr_immobili"), document.getElementById("span_nr_portali"), 2)
}

//Applica Sconto
function applica_sconto(ScontoValue){
	if (!isNaN(ScontoValue)){
		return calcola_preventivo(document.getElementById("span_nr_immobili"), document.getElementById("span_nr_portali"), (2* ((100-ScontoValue)/100)))
	}
}

//Applica Sconto Paccyhetto Auto
function auto_applica_sconto(ScontoValue){
	if (!isNaN(ScontoValue)){
		document.getElementById("h_tot_prezzo_pacchetto_auto_scontato").value = eval(document.getElementById("h_tot_prezzo_pacchetto_auto").value) * ((100-ScontoValue)/100)
		document.getElementById("costo_totale").innerText = document.getElementById("h_tot_prezzo_pacchetto_auto_scontato").value 	
	}
}

//Funzione Calcola Preventivo
function calcola_preventivo(nr_immobili, nr_portali, costo_credito){
		//document.getElementById("costo_totale").innerText = printf( ("%6.2", (nr_immobili.innerText * costo_credito * nr_portali.innerText)  )
	document.getElementById("costo_totale").innerText = formatfloat( (nr_immobili.innerText * costo_credito * nr_portali.innerText) , 3 )	
}

function formatfloat(fl, dec){
        str=""+fl;
        i = str.indexOf(".");
        if (i<0){
                i=str.length;
                str=str+",00000000000";
        }else{
                if(i==0){
                        i=1;
                        str="0"+str;
                }else{
                        str=str+"00000000000";
                }
        }
        return str.substring(0,i+dec);
}

function openLayerSceltaPortali(apri, chiudi, sino, nrPortali, minimoNrPortali){
	document.all[apri].style.overflow = "visible"
	document.all[chiudi].style.overflow = "hidden"	
	//document.location.href = "#formAcquisto";
	
	if (sino == 'si'){

	if (document.getElementById('h_scelta_portali').value == "no"){
		document.getElementById('h_id_portaliGratuiti').value = minimoNrPortali
		document.getElementById("span_nr_portali").innerText = minimoNrPortali
		document.getElementById("nr_portali").innerText = minimoNrPortali
	}
		document.getElementById('h_scelta_portali').value = "si"


		for(i=0; i<nrPortali-1; i++) {
			document.all.id_portaleGratuito[i].checked=false;
			document.all.id_portaleGratuito[i].className = '';
		//	return check_green(document.all.id_portaleGratuito[i], document.all.h_id_portaliGratuiti.value' document.getElementById('crediti_utilizzati'));
		}
	}else{
			// Quando clicco sul mouse per la scelta dei portali
			
			document.all["titolo_pacchetti"].style.overflow = "hidden"	
			document.all["pacchetti"].style.overflow = "hidden"
			
			document.getElementById('nr_portali').value = 0
			document.getElementById('h_id_portaliGratuiti').value = 0
			document.getElementById("span_nr_portali").innerText = 0	
			document.getElementById('h_scelta_portali').value = "no"
			
			document.all.scelta_portali[1].checked=true;
			document.all.scelta_portali[1].value=1;
	}
	
	calcola_preventivo(document.getElementById("span_nr_immobili"), document.getElementById("span_nr_portali"), 2)		
	
}

function alertSceltaPortali(apri, chiudi, nrPortali, minimoNrPortali){
	alert("Dopo aver acquistato il pacchetto, riceverai via e-mail le istruzioni per scegliere \ni portali dove pubblicare i tuoi immobili dalla lista dei " + nrPortali + " portali partners!");
	document.all[apri].style.overflow = "visible"
	document.all[chiudi].style.overflow = "hidden"	
	//document.location.href = "#formAcquisto";

	if (document.getElementById('h_scelta_portali').value == "no"){
		document.getElementById('h_id_portaliGratuiti').value = minimoNrPortali
		document.getElementById("span_nr_portali").innerText = minimoNrPortali	
		document.getElementById("nr_portali").innerText = minimoNrPortali				
	}

		document.getElementById('h_scelta_portali').value = "si"

		document.all.scelta_portali[1].value=2;

		for(i=0; i<nrPortali-1; i++) {
		
			document.all.id_portaleGratuito[i].checked=false;
			document.all.id_portaleGratuito[i].className = '';		
		//	return check_green(document.all.id_portaleGratuito[i], document.all.h_id_portaliGratuiti.value' document.getElementById('crediti_utilizzati'));
		}
	
	calcola_preventivo(document.getElementById("span_nr_immobili"), document.getElementById("span_nr_portali"), 2)		
	
}


function confermaAcquistoPacchetto(theForm, minimoPortali)
{
	//CONTROLLO PORTALI	
	if (eval(theForm.h_id_portaliGratuiti.value) < minimoPortali)
		{ 
			alert("Selezionare almeno " + minimoPortali + " Portali!");
			theForm.id_portaleGratuito[0].focus();		
			return (false);
		}

		//0 immobili
		if (document.getElementById('nr_immobili').value == 0){
				alert("Non hai indicato il numero degli Immobili!");
				theForm.nr_immobili.focus();
				return (false);
			}			

		//0 Portali
		if (document.getElementById('h_id_portaliGratuiti').value == 0){

			if (document.getElementById('h_scelta_portali').value == "no"){
						alert("Selezionare almeno un Portale!");
						theForm.id_portaleGratuito[0].focus();
				}else{
						alert("Non hai indicato il numero dei Portali!");
						theForm.nr_portali.focus();
					}			
				return (false);
			}


	return confirm("Confermi l\'acquisto del pacchetto?")
	//return confirm("CONFERMA PUBBLICAZIONE IMMOBILE\n\nL\'immobile verrà pubblicato su " + form.h_id_portaliGratuiti.value + " portali e verranno scalati " +  form.h_id_portaliGratuiti.value + " Crediti.\n\nClicca su OK per confermare l'inserimento.")
	return (true);
}


function confermaAttivazionePacchettoProva(theForm, minimoPortali)
{
		//0 immobili
		if (document.getElementById('nr_immobili').value == 0){
				alert("Non hai indicato il numero degli Immobili!");
				theForm.nr_immobili.focus();
				return (false);
			}			

		//0 Portali
		if (document.getElementById('h_id_portaliGratuiti').value == 0){

			if (document.getElementById('h_scelta_portali').value == "no"){
						alert("Selezionare almeno un Portale!");
						theForm.id_portaleGratuito[0].focus();
				}else{
						alert("Non hai indicato il numero dei Portali!");
						theForm.nr_portali.focus();
					}			
				return (false);
			}


	return confirm("Confermi l\'attivazione del pacchetto PROVA?")
	//return confirm("CONFERMA PUBBLICAZIONE IMMOBILE\n\nL\'immobile verrà pubblicato su " + form.h_id_portaliGratuiti.value + " portali e verranno scalati " +  form.h_id_portaliGratuiti.value + " Crediti.\n\nClicca su OK per confermare l'inserimento.")
	return (true);
}


function confermaCreazionePacchetto(theForm)
{
	//CONTROLLO PORTALI	
	if (eval(theForm.h_id_portaliGratuiti.value) == 0 )
		{ 
			alert("Selezionare almeno un Portale!");
			theForm.id_portaleGratuito[0].focus();		
			return (false);
		}

	//CONTROLLO IMMOBILI	
	if (eval(theForm.nr_immobili.value) == 0 )
		{ 
			alert("Indicare il nr di immobili pubblicati!");
			theForm.nr_immobili.focus();		
			return (false);
		}


	return confirm("Confermi l\'attivazione del Catalogo Madre?")
	return (true);
}


function get_pagina_registrazione(id_portale){
	if (id_portale != ""){
		var newWin = window.open("","new");
		newWin.location.href = "goto_reg_page.asp?id_portale=" + id_portale
		newWin.focus();
	}
}

function ApriImmagini(file)
{
  var prop = "top=20, left=20, width=1, height=1";
  mywin = window.open(file, null, prop);
 // mywin.focus();
}

//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()", 700)
	}
	
	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

function mostraSconto(){
	if (document.getElementById('spanSconto').style.visibility == "hidden") {
		document.getElementById('spanSconto').style.visibility = "visible"
	}else{
		document.getElementById('spanSconto').style.visibility = "hidden"
	}
}

function open_Folder(layer){
	if (document.all[layer].style.overflow == "hidden" ){
		document.all[layer].style.overflow = "visible"
		MM_swapImage('img'+layer,'','/img/cart_o.gif',1);
	}else{	
		document.all[layer].style.overflow = "hidden"
		MM_swapImage('img'+layer,'','/img/cart_c.gif',1);
	}
}

function confermaCambioStatus(theForm)
{
	return confirm("Confermi il cambio dello stato?");
	return (true);
}

function AlertEliminaFoto(layerID){
	if (document.all[layerID].style.overflow == "hidden" ){
		document.all[layerID].style.overflow = "visible"
	}else{	
		document.all[layerID].style.overflow = "hidden"
	}
}

function applica_provvigione_dvd(ProvvValue, idPagamento){
	if (!isNaN(ProvvValue)){
		document.getElementById("h_provv_dvd_"+idPagamento).value =  eval(document.getElementById("h_importo_"+idPagamento).value) * ((ProvvValue)/100) 
		document.getElementById("provv_dvd_"+idPagamento).innerText = "€ " + formatfloat(document.getElementById("h_provv_dvd_"+idPagamento).value,2)
	}
}

function sott_provv_dvd_tot(controllo, idPagamento){
	if (controllo.checked) {
		document.getElementById("h_provv_dvd_tot").value = eval(document.getElementById("h_provv_dvd_tot").value) - eval(document.getElementById("h_provv_dvd_"+idPagamento).value);
		document.getElementById("provv_dvd_tot").innerText = "€ " + formatfloat(document.getElementById("h_provv_dvd_tot").value,2)
		controllo.className = '';
		controllo.checked = false;
	}
}

function provv_dvd_tot(controllo, idPagamento){
	if (controllo.checked) {
		document.getElementById("h_provv_dvd_tot").value = eval(document.getElementById("h_provv_dvd_tot").value) + eval(document.getElementById("h_provv_dvd_"+idPagamento).value);
		document.getElementById("provv_dvd_tot").innerText = "€ " + formatfloat(document.getElementById("h_provv_dvd_tot").value,2)		
		controllo.className = 'Orange';
	}else {
		document.getElementById("h_provv_dvd_tot").value = eval(document.getElementById("h_provv_dvd_tot").value) - eval(document.getElementById("h_provv_dvd_"+idPagamento).value);
		document.getElementById("provv_dvd_tot").innerText = "€ " + formatfloat(document.getElementById("h_provv_dvd_tot").value,2)
		controllo.className = '';		
	}
}
	
function confermaPubblicaImmobileGoogle()
{
	var bRet
	bRet = confirm("Confermi la pubblicazione dell'immobile su Google?");
	return(bRet);
}

//FORM REGISTRAZIONE EDITORE
function controllaFormRegistrazioneAgenziaEditore(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.piva.value == "")
	{
		alert("Inserire un valore per il campo \"Partita IVA\".");
		theForm.piva.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\".");
		return (false);
	}			
if (theForm.provincia.value == "")
	{
		alert("Inserire un valore per il campo \"Provincia\".");
		return (false);
	}	
if (theForm.regione.value == "")
	{
		alert("Inserire un valore per il campo \"Regione\".");
		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);
}
