// verifico quello che viene inserito nei compi numerici
function checkCurrency1(e) { 
  var ev=e?e:event; // Gecko riceve l'evento come parametro in e 
                // IE valorizza l'obj event 
  var key=ev.charCode?ev.charCode:ev.keyCode; // IE non ha charCode 
  if ( ((key > 47)&&(key < 58))||(key == 8)||(key == 9)){ 
        // ok sono numeri (>='0' e <='9'), backspace o tab 
  } else { 
        // eviti che l'evento venga "gestito" 
        if(ev.preventDefault){ 
                e.preventDefault(); // Gecko usa preventDefault 
        } else if('returnValue' in ev ) { 
                ev.returnValue=false; // IE usa returnValue 
        }}} 
// fine
// verifico quello che viene inserito nei compi telefonici
function checkCurrency2(e) { 
  var ev=e?e:event; // Gecko riceve l'evento come parametro in e 
                // IE valorizza l'obj event 
  var key=ev.charCode?ev.charCode:ev.keyCode; // IE non ha charCode 
  if ( ((key > 47)&&(key < 58))||(key == 8)||(key == 9)||(key == 32)){ 
        // ok sono numeri (>='0' e <='9'), backspace o tab 
  } else { 
        // eviti che l'evento venga "gestito" 
        if(ev.preventDefault){ 
                e.preventDefault(); // Gecko usa preventDefault 
        } else if('returnValue' in ev ) { 
                ev.returnValue=false; // IE usa returnValue 
        }}} 
// fine
// verifico quello che viene inserito nei compi email
function checkCurrency3(e) { 
  var ev=e?e:event; // Gecko riceve l'evento come parametro in e 
                // IE valorizza l'obj event 
  var key=ev.charCode?ev.charCode:ev.keyCode; // IE non ha charCode 
  if ( ((key > 63)&&(key < 91))||((key > 96)&&(key < 123))||((key > 47)&&(key < 58))||(key == 8)||(key == 9)||(key == 46)||(key == 95)||(key == 45)){ 
        // ok sono numeri (>='0' e <='9'), backspace o tab 
  } else { 
        // eviti che l'evento venga "gestito" 
        if(ev.preventDefault){ 
                e.preventDefault(); // Gecko usa preventDefault 
        } else if('returnValue' in ev ) { 
                ev.returnValue=false; // IE usa returnValue 
        }}} 
// fine
// verifico quello che viene inserito nel campo username
function checkCurrency18(e) { 
  var ev=e?e:event; // Gecko riceve l'evento come parametro in e 
                // IE valorizza l'obj event 
  var key=ev.charCode?ev.charCode:ev.keyCode; // IE non ha charCode 
  if ( ((key > 64)&&(key < 91))||((key > 96)&&(key < 123))||((key > 47)&&(key < 58))||(key == 8)||(key == 9)||(key == 47)||(key == 45)||(key == 95)||(key == 35)||(key == 43)||(key == 46)){ 
        // ok sono numeri (>='0' e <='9'), backspace o tab 
  } else { 
        // eviti che l'evento venga "gestito" 
        if(ev.preventDefault){ 
                e.preventDefault(); // Gecko usa preventDefault 
        } else if('returnValue' in ev ) { 
                ev.returnValue=false; // IE usa returnValue 
        }}} 
// fine
// verifico quello che viene inserito nel campo password
function checkCurrency8(e) { 
  var ev=e?e:event; // Gecko riceve l'evento come parametro in e 
                // IE valorizza l'obj event 
  var key=ev.charCode?ev.charCode:ev.keyCode; // IE non ha charCode 
  if ( ((key > 64)&&(key < 91))||((key > 96)&&(key < 123))||((key > 47)&&(key < 58))||(key == 8)||(key == 9)||(key == 46)){ 
        // ok sono numeri (>='0' e <='9'), backspace o tab 
  } else { 
        // eviti che l'evento venga "gestito" 
        if(ev.preventDefault){ 
                e.preventDefault(); // Gecko usa preventDefault 
        } else if('returnValue' in ev ) { 
                ev.returnValue=false; // IE usa returnValue 
        }}} 
// fine
// verifico quello che viene inserito nel campo codice fiscale
function checkCurrency4(e) { 
  var ev=e?e:event; // Gecko riceve l'evento come parametro in e 
                // IE valorizza l'obj event 
  var key=ev.charCode?ev.charCode:ev.keyCode; // IE non ha charCode 
  if ( ((key > 64)&&(key < 91))||((key > 96)&&(key < 123))||((key > 47)&&(key < 58))||(key == 8)||(key == 9)){ 
        // ok sono numeri (>='0' e <='9'), backspace o tab 
  } else { 
        // eviti che l'evento venga "gestito" 
        if(ev.preventDefault){ 
                e.preventDefault(); // Gecko usa preventDefault 
        } else if('returnValue' in ev ) { 
                ev.returnValue=false; // IE usa returnValue 
        }}} 
// fine
function Form1_Validator(theForm){     
 if (theForm.nome.value.length < 3){
    alert("Attenzione !!!\nIl Nome deve essere lungo almeno 3 caratteri.");
    theForm.nome.focus();
    return (false);}
 if (theForm.cognome.value.length < 3){
    alert("Attenzione !!!\nIl Cognome deve essere lungo almeno 3 caratteri.");
    theForm.cognome.focus();
    return (false);}
 if (theForm.indirizzo.value.length < 5){
    alert("Attenzione !!!\nL'indirizzo deve essere lungo almeno di 5 caratteri.");
    theForm.indirizzo.focus();
    return (false);}
 if (theForm.citta.value.length < 3){
    alert("Attenzione !!!\nLa città deve essere lunga almeno 3 caratteri.");
    theForm.citta.focus();
    return (false);} 
 if (theForm.cap.value.length < 5){
    alert("Attenzione !!!\nIl CAP deve essere lungo 5 caratteri.");
    theForm.cap.focus();
    return (false);}
 if (theForm.Provincia.value.length = 0) {
    alert("Attenzione !!!\nInserire la provincia di residenza.");
    theForm.Provincia.focus(); return (false);}
 if (theForm.stato.value.length < 3){
    alert("Attenzione !!!\nInserire lo Stato di residenza.");
    theForm.stato.focus();
    return (false);} 
 if (theForm.tel1.value.length < 7) {
    alert("Attenzione !!!\nInserire un numero di Telefono valido.");
    theForm.tel1.focus(); 
    return (false);}
 if (theForm.tel2.value.length < 9) {
    alert("Attenzione !!!\nInserire un numero di Cellulare valido.");
    theForm.tel2.focus(); 
    return (false);}  
 if ((theForm.email1.value.length < 9)|(theForm.email1.value.indexOf(".") == -1)|(theForm.email1.value.indexOf("@") == -1)) {
    alert("Attenzione !!!\nInserire una Email Valida.");
    theForm.email1.focus(); 
    return (false);}
 if ((theForm.email2.value.length < 9)|(theForm.email2.value.indexOf(".") == -1)|(theForm.email2.value.indexOf("@") == -1)) {
    alert("Attenzione !!!\nInserire una Email Valida.");
    theForm.email2.focus(); 
    return (false);}
 if (theForm.email1.value == theForm.email2.value) {}
    else{
    alert("Attenzione !!!\nDevi ripetere la stessa Email.");
    theForm.email2.focus(); 
    return (false);}
 if (theForm.g_n.selectedIndex < 1) {
    alert("Attenzione !!!\nSelezionare il Giorno di nascita.");
    theForm.g_n.focus(); return (false);}
 if (theForm.m_n.selectedIndex < 1) {
    alert("Attenzione !!!\nSelezionare il Mese di nascita.");
    theForm.m_n.focus(); return (false);}
 if (theForm.a_n.selectedIndex < 1) {
    alert("Attenzione !!!\nSelezionare l'Anno di nascita.");
    theForm.a_n.focus(); return (false);}
 if (theForm.sesso.selectedIndex < 1) {
    alert("Attenzione !!!\nSelezionare il Sesso.");
    theForm.sesso.focus(); return (false);}
 var stringa_stato=theForm.stato.value.toUpperCase()
 var stringa_stato=stringa_stato.toUpperCase()
 //var stringa_stato=stringa_stato.trim()
 if (stringa_stato == "ITALIA"){
 if (theForm.CODFISC.value.length < 1){
    alert("Attenzione !!!\nInserire il Codice Fiscale.");
    theForm.CODFISC.focus();
    return (false);}
  if (theForm.CODFISC.value.length < 16){
    alert("Attenzione !!!\nIl codice fiscale è errato, verificare la lunghezza.");
    theForm.CODFISC.focus();
    return (false);}
 var codfisc_giorno = theForm.g_n.value
 if (theForm.sesso.value == "2"){
  codfisc_giorno=parseInt(theForm.g_n.value)+40;
  codfisc_giorno= eval(codfisc_giorno);}
//verifico il codice fiscale 
 if ((theForm.CODFISC.value.substr(9,2) != codfisc_giorno)||(theForm.CODFISC.value.substr(8,1).toUpperCase() != theForm.m_n.value)||(theForm.CODFISC.value.substr(6,2) != theForm.a_n.value.substr(2,2))){
    alert("Attenzione !!!\nIl codice fiscale è errato, verificare la data di nascita e il sesso.");
    theForm.CODFISC.focus();
    return (false);}
 }
 if (theForm.com_nasc.value.length < 3 ){
    alert("Attenzione !!!\nIl Comune di Nascita deve contenere almeno 3 caratteri.");
    theForm.com_nasc.focus();
    return (false);}
 if (theForm.pro_nasc.value.length < 3 ){
    alert("Attenzione !!!\nLa Provincia di Nascita deve contenere almeno 3 caratteri.");
    theForm.pro_nasc.focus();
    return (false);}
 if (theForm.sta_nasc.value.length < 3 ){
    alert("Attenzione !!!\nLo Stato di Nascita deve contenere almeno 3 caratteri.");
    theForm.sta_nasc.focus();
    return (false);}         
 if (theForm.username.value.length < 6 ){
    alert("Attenzione !!!\nL' Username deve contenere almeno 6 caratteri.");
    theForm.username.focus();
    return (false);}
 if (theForm.pass1.value.length < 6 ){
    alert("Attenzione !!!\nLa password deve essere lunga almeno 6 caratteri.");
    theForm.pass1.value="";
    theForm.pass1.focus();
    return (false);}
 if (theForm.pass2.value.length < 6 ){
    alert("Attenzione !!!\nLa password deve essere lunga almeno 6 caratteri.");
    theForm.pass2.value="";
    theForm.pass2.focus();
    return (false);}
 if (theForm.pass1.value == theForm.pass2.value) {}
    else{
    alert("Attenzione !!!\nLe password non risultano uguali. Devi ripetere la stessa password.");
    theForm.pass1.value="";
    theForm.pass2.value="";
    theForm.pass1.focus(); 
    return (false);}
 if (theForm.username.value == theForm.pass1.value){
    alert("Attenzione !!! Per motivi di sicurezza\nUsername e password non possono essere uguali.");
    theForm.pass1.value = "";
    theForm.pass2.value = "";
    theForm.username.focus();
    return (false);}
 if (theForm.C1.checked==false){
    alert("Attenzione !!!\nnon si può continuare se non ha preso visione delle Regole tra Utenti.");
    return (false);}
 if (theForm.C2.checked==false){
    alert("Attenzione !!!\nnon si può continuare se non si acconsente al trattamento dei dati personali.");
    theForm.C2.focus();
    return (false);}
return (true);}