<!--
function controlliFormaliRegistra() {   
var stringa="";
var spazi="";
var selIndex;
//	controllaSpaziUtente();
   //  CONSENSI   
   if ( (!document.frmregistra.privacy[0].checked) ||
        (!document.frmregistra.declino[0].checked)  ) {
      stringa = stringa + " - E' necessario concedere tutti i consensi per procedere con la registrazione "
   }
   //Campi Obbligatori
   //  Nome Utente
   if ((document.frmregistra.utente.value==spazi) || (document.frmregistra.utente.value=='Utente')) {
      document.frmregistra.utente.focus();
      document.getElementById("txtutente").style.color='#ff0000';
      stringa = stringa + " - Utente "
   } else if (soloNumeriLettere(document.frmregistra.utente.value)==false) {
      document.frmregistra.utente.focus();
      document.getElementById("txtutente").style.color='#ff0000';
      stringa = stringa + " - Utente non accetta lo spazio "
   } else {
    document.getElementById("txtutente").style.color='#000000';
   }
   //  Password
   if ((document.frmregistra.psw1.value==spazi) || (document.frmregistra.psw1.value=='Password')) {
      document.frmregistra.psw1.focus();
      document.getElementById("txtpassword").style.color='#ff0000';
      stringa = stringa + " - Password "
   } else if (soloNumeriLettere(document.frmregistra.psw1.value)==false) {
      document.frmregistra.psw1.focus();
      document.getElementById("txtpassword").style.color='#ff0000';
      stringa = stringa + " - Password non accetta lo spazio "
   } else {
      document.getElementById("txtpassword").style.color='#000000';
   }
   //  Password2
   if ((document.frmregistra.psw2.value==spazi) || (document.frmregistra.psw2.value=='Conferma Psw')) {
      document.frmregistra.psw2.focus();
      document.getElementById("txtpassword2").style.color='#ff0000';
      stringa = stringa + " - Password di conferma "
   } else if (soloNumeriLettere(document.frmregistra.psw2.value)==false) {
      document.frmregistra.psw2.focus();
      document.getElementById("txtpassword2").style.color='#ff0000';
      stringa = stringa + " - Password2 non accetta lo spazio "
   } else {
      document.getElementById("txtpassword2").style.color='#000000';
   }
   //Controlli di Congruenza
   //  Le Password devonoessere uguali
   if ((document.frmregistra.psw1.value!=document.frmregistra.psw2.value)) {
      document.frmregistra.psw2.focus();
      document.getElementById("txtpassword").style.color='#ff0000';
      document.getElementById("txtpassword2").style.color='#ff0000';
      stringa = stringa + " - Password di conferma errata"
   }
   //  Nome
   if ((document.frmregistra.nome.value==spazi) || (document.frmregistra.nome.value=='Nome')) {
      document.frmregistra.nome.focus();
      document.getElementById("txtnome").style.color='#ff0000';
      stringa = stringa + " - Nome "
   } else {
      document.getElementById("txtnome").style.color='#000000';
   }
   //  Cognome
   if ((document.frmregistra.cognome.value==spazi) || (document.frmregistra.cognome.value=='Cognome')) {
      document.frmregistra.cognome.focus();
      document.getElementById("txtcognome").style.color='#ff0000';
      stringa = stringa + " - Cognome "
   } else {
      document.getElementById("txtcognome").style.color='#000000';
   }
   //  DATANASCITA
   if ((document.frmregistra.datanascita.value==spazi) || (document.frmregistra.datanascita.value=='Dt Nascita')) {
      document.frmregistra.datanascita.focus();
      document.getElementById("txtdatanascita").style.color='#ff0000';
      stringa = stringa + " - Data di Nascita "
   } else {
      document.getElementById("txtdatanascita").style.color='#000000';
   }
   if (document.frmregistra.datanascita.value.substring(2,3) != "/" ||
	   document.frmregistra.datanascita.value.substring(5,6) != "/" ||
	   isNaN(document.frmregistra.datanascita.value.substring(0,2)) ||
	   isNaN(document.frmregistra.datanascita.value.substring(3,5)) ||
	   isNaN(document.frmregistra.datanascita.value.substring(6,10))) {
	  document.frmregistra.datanascita.focus();
      document.getElementById("txtdatanascita").style.color='#ff0000';
      stringa = stringa + " - Inserire data nascita in formato gg/mm/aaaa "
	} else if (document.frmregistra.datanascita.value.substring(0,2) > 31) {
	  document.frmregistra.datanascita.focus();
      document.getElementById("txtdatanascita").style.color='#ff0000';
      stringa = stringa + " - Impossibile utilizzare un valore superiore a 31 per i giorni "
	} else if (document.frmregistra.datanascita.value.substring(3,5) > 12) {
	  document.frmregistra.datanascita.focus();
      document.getElementById("txtdatanascita").style.color='#ff0000';
      stringa = stringa + " - Impossibile utilizzare un valore superiore a 12 per i mesi "
	} else if (document.frmregistra.datanascita.value.substring(6,10) < 1900) {
	  document.frmregistra.datanascita.focus();
      document.getElementById("txtdatanascita").style.color='#ff0000';
      stringa = stringa + " - Impossibile utilizzare un valore inferiore a 1900 per l'anno "
	} 

   //  EMAIL
   if ((document.frmregistra.email.value==spazi) || (document.frmregistra.email.value=='Email')) {
      document.frmregistra.email.focus();
      document.getElementById("txtemail").style.color='#ff0000';
      stringa = stringa + " - E-Mail "
   } else {
      if (checkemail(document.frmregistra.email.value)>0 ) {
		document.getElementById("txtemail").focus();
		document.getElementById("txtemail").style.color='#ff0000';
		stringa = stringa + " - Inserire correttamente l'indirizo Email "
      } else {
		document.getElementById("txtemail").style.color='#000000';
	  }
	}        
	 //  Regione                           
	 if (document.frmregistra.regioni.selectedIndex==0) {
		document.getElementById("regioni").focus();
		document.getElementById("txtregione").style.color='#ff0000';
		stringa = stringa + " - Selezionare la Regione "
	 } else {
		document.getElementById("txtregione").style.color='#000000';
	 }
	 //  Provincia
	 if (document.frmregistra.provincie.selectedIndex==0) {
		document.getElementById("provincie").focus();
		document.getElementById("txtprovincia").style.color='#ff0000';
		stringa = stringa + " - Selezionare la Provincia "
	 } else {
		document.getElementById("txtprovincia").style.color='#000000';
	 }
	 //  Comune
	 if (document.frmregistra.comuni.selectedIndex==0) {
		document.getElementById("comuni").focus();
		document.getElementById("txtcomuni").style.color='#ff0000';
		stringa = stringa + " - Selezionare il Comune "
	 } else {
		document.getElementById("txtcomuni").style.color='#000000';
	 }

	if (stringa=="") { 
   	return true;
   } else {
   	stringa="Valorizzare i seguenti campi: " + stringa   
   	document.getElementById("strerrore").innerHTML = 
   	   "<font size=2 face=verdana color=#ff0000><b>" + 
   	   stringa + "</b>"
      document.getElementById("tderrore").style.display='inline';        
   	return false;
   }
}

function checkemail(email) {
var ind;
var appoe;
var check1=0;
var check2=0;
var errata=0;
var appoe=email;

if (appoe.substring(0,1)=="@") {
    errata=1;
}
if (appoe.substring(0,1)==".") {
    errata=2;
}

if (errata==0) {
   for (ind=0; ind<appoe.length; ind++) {
	  if (appoe.substring(ind,ind+1)==" ") {
          errata=3;
      }
      if (appoe.substring(ind,ind+1)=="@" && check1>0) {
          errata=4;
      }
      if (appoe.substring(ind,ind+1)=="." && check2>0 && check2-ind==-1) {
          errata=5;
      }
     
      if (errata==0) {
         if (check1==0 && appoe.substring(ind,ind+1)=="@") {
            check1=ind;            
         }
         if (check1>0 && check2==0 && appoe.substring(ind,ind+1)==".") {
            check2=ind;
         }
      }    
   }
   if (errata==0 && (check1==0 || check2==0)) { 
      errata=6;
   }
   if (errata==0 && (check2-check1==1)) { 
      errata=7;
   }
   if (errata==0 && check2==appoe.length) { 
      errata=8;
   }
}
if (InStr(email,";")>0 || InStr(email,",")>0) {
    errata = 9;
}
return errata;
}

function InStr(String1, String2)
{
   var a = 0;
   
   if (String1 == null || String2 == null)
   return (false);
   
   String1 = String1.toLowerCase();
   String2 = String2.toLowerCase();
   
   a = String1.indexOf(String2);
   if (a == -1)
   return 0;
   else
   return a + 1;
}

function soloNumeriLettere(stringa) {
var errore;
   for (N=0;N<stringa.length;N++) {      
      if ( (stringa.substring(N,N+1)>="0" && stringa.substring(N,N+1)<="9") ||
           (stringa.substring(N,N+1)>="A" && stringa.substring(N,N+1)<="Z") ||
           (stringa.substring(N,N+1)>="a" && stringa.substring(N,N+1)<="z") ) {      
        errore=0;
      } else {
        return false;        
      }
   }
}   
-->
