function controlla_iscrizione()
{


var nome = document.modulo.nome.value;
var cognome = document.modulo.cognome.value;
var indirizzo = document.modulo.indirizzo.value;
var cap = document.modulo.cap.value;
var comune = document.modulo.comune.value;
var provincia = document.modulo.provincia.value;
var cellulare = document.modulo.cellulare.value;
var sesso = document.modulo.sesso.value;
var email = document.modulo.email.value;
var giorno = document.modulo.giorno.value;
var mese = document.modulo.mese.value;
var anno = document.modulo.anno.value;
var titolo_di_studio = document.modulo.titolo_di_studio.value;
var professione = document.modulo.professione.value;
var settore = document.modulo.settore.value;
var cf = document.modulo.cf.value;
var preferenza = document.modulo.preferenza.value;
var accetto = document.modulo.accetto.checked;
var password = document.modulo.password.value;
var password_2 = document.modulo.password_2.value;

var strChars = /[\|\\\!\"\/\(\)\ç\°\§\<\>]/;
var strLettere = /[a-zA-Z]|[']/;
var strEmail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})$/;

if ((nome == "") || (nome == "undefined")) {alert("Il campo nome e' obbligatorio.");document.modulo.nome.focus();return false;}
if (nome.match(strChars) != null) {alert("Caratteri non ammessi / | \ ! \" / ( ) ç ° § < > "); document.modulo.nome.focus(); return false; }

if ((cognome == "") || (cognome == "undefined")) {alert("Il campo cognome e' obbligatorio.");document.modulo.cognome.focus();return false;}
if (cognome.match(strChars) != null) {alert("Caratteri non ammessi / | \ ! \" / ( ) ç ° § < > "); document.modulo.cognome.focus(); return false; }

if ((indirizzo == "") || (indirizzo == "undefined")) {alert("Il campo indirizzo e' obbligatorio.");document.modulo.indirizzo.focus();return false;}
if (indirizzo.match(strChars) != null) {alert("Caratteri non ammessi / | \ ! \" / ( ) ç ° § < > "); document.modulo.indirizzo.focus(); return false; }

if ((cap == "") || (cap == "undefined")) {alert("Il campo cap e' obbligatorio.");document.modulo.cap.focus();return false;}
if (cap.match(strChars) != null) {alert("Devi inserire solo numeri"); document.modulo.cap.focus(); return false; }
if (cap.match(strLettere) != null) {alert("Devi inserire solo numeri"); document.modulo.cap.focus(); return false; }

if ((comune == "") || (comune == "undefined")) {alert("Il campo comune e' obbligatorio.");document.modulo.comune.focus();return false;}

if ((cf == "") || (cf == "undefined")) {alert("Il codice fiscale e' obbligatorio.");document.modulo.comune.focus();return false;}

if ((provincia == "") || (provincia == "undefined")) {alert("Il campo provincia e' obbligatorio.");document.modulo.provincia.focus();return false;}

if(cellulare!=""){
if (cellulare.match(strChars) != null) {alert("Devi inserire solo numeri"); document.modulo.cellulare.focus(); return false; }
if (cellulare.match(strLettere) != null) {alert("Devi inserire solo numeri"); document.modulo.cellulare.focus(); return false; }
}

if ((sesso == "") || (sesso == "undefined")) {alert("Il campo sesso e' obbligatorio.");document.modulo.sesso.focus();return false;}

var espressione = /^[_a-z0-9+-]+(\.[_a-z0-9+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/;
if (!espressione.test(email)){alert("La mail inserita non e' valida!");document.modulo.email.focus();return false;}

if((giorno=="")||(mese=="")||(anno=="")){
alert("La data di nascita e' obbligatoria.");document.modulo.giorno.focus();return false;
}

if ((password == "") || (password == "undefined")) {alert("Il campo password e' obbligatorio.");document.modulo.password.focus();return false;}

if ((password_2 == "") || (password_2 == "undefined")) {alert("Ripetere la password.");document.modulo.password_2.focus();return false;}

if (password != password_2) {alert("La password va inserita correttamente");document.modulo.password.focus();return false;}

if (password.match(strChars) != null) {alert("Caratteri non ammessi / | \ ! \" / ( ) ç ° § < > "); document.modulo.password.focus(); return false; }
if (password_2.match(strChars) != null) {alert("Caratteri non ammessi / | \ ! \" / ( ) ç ° § < > "); document.modulo.password_2.focus(); return false; }


if ((accetto == "") || (accetto == "undefined")) {alert("Devi acconsentire al trattamento dei dati personali.");document.modulo.accetto.focus();return false;}

else {document.modulo.action="index.php?sez=reg";}
} 


function controlla_iscrizione_2()
{


var nome = document.modulo.nome.value;
var cognome = document.modulo.cognome.value;
var indirizzo = document.modulo.indirizzo.value;
var cap = document.modulo.cap.value;
var comune = document.modulo.comune.value;
var provincia = document.modulo.provincia.value;
var cellulare = document.modulo.cellulare.value;
var sesso = document.modulo.sesso.value;
var email = document.modulo.email.value;
var giorno = document.modulo.giorno.value;
var mese = document.modulo.mese.value;
var anno = document.modulo.anno.value;
var titolo_di_studio = document.modulo.titolo_di_studio.value;
var professione = document.modulo.professione.value;
var settore = document.modulo.settore.value;
var cf = document.modulo.cf.value;
var preferenza = document.modulo.preferenza.value;

var password = document.modulo.password.value;


var strChars = /[\|\\\!\"\/\(\)\ç\°\§\<\>]/;
var strLettere = /[a-zA-Z]|[']/;
var strEmail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})$/;

if ((nome == "") || (nome == "undefined")) {alert("Il campo nome e' obbligatorio.");document.modulo.nome.focus();return false;}
if (nome.match(strChars) != null) {alert("Caratteri non ammessi / | \ ! \" / ( ) ç ° § < > "); document.modulo.nome.focus(); return false; }

if ((cognome == "") || (cognome == "undefined")) {alert("Il campo cognome e' obbligatorio.");document.modulo.cognome.focus();return false;}
if (cognome.match(strChars) != null) {alert("Caratteri non ammessi / | \ ! \" / ( ) ç ° § < > "); document.modulo.cognome.focus(); return false; }

if ((indirizzo == "") || (indirizzo == "undefined")) {alert("Il campo indirizzo e' obbligatorio.");document.modulo.indirizzo.focus();return false;}
if (indirizzo.match(strChars) != null) {alert("Caratteri non ammessi / | \ ! \" / ( ) ç ° § < > "); document.modulo.indirizzo.focus(); return false; }

if ((cap == "") || (cap == "undefined")) {alert("Il campo cap e' obbligatorio.");document.modulo.cap.focus();return false;}
if (cap.match(strChars) != null) {alert("Devi inserire solo numeri"); document.modulo.cap.focus(); return false; }
if (cap.match(strLettere) != null) {alert("Devi inserire solo numeri"); document.modulo.cap.focus(); return false; }

if ((comune == "") || (comune == "undefined")) {alert("Il campo comune e' obbligatorio.");document.modulo.comune.focus();return false;}

if((giorno=="")||(mese=="")||(anno=="")){
alert("La data di nascita e' obbligatoria.");document.modulo.giorno.focus();return false;
}

if ((provincia == "") || (provincia == "undefined")) {alert("Il campo provincia e' obbligatorio.");document.modulo.provincia.focus();return false;}

if(cellulare!=""){
if (cellulare.match(strChars) != null) {alert("Devi inserire solo numeri"); document.modulo.cellulare.focus(); return false; }
if (cellulare.match(strLettere) != null) {alert("Devi inserire solo numeri"); document.modulo.cellulare.focus(); return false; }
}

if ((cf == "") || (cf == "undefined")) {alert("Il codice fiscale e' obbligatorio.");document.modulo.comune.focus();return false;}

if ((sesso == "") || (sesso == "undefined")) {alert("Il campo sesso e' obbligatorio.");document.modulo.sesso.focus();return false;}

var espressione = /^[_a-z0-9+-]+(\.[_a-z0-9+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/;
if (!espressione.test(email)){alert("La mail inserita non e' valida!");document.modulo.email.focus();return false;}

if(password!=""){
if (password.match(strChars) != null) {alert("Sono presenti caratteri non ammessi"); document.modulo.password.focus(); return false; }
}


else {document.modulo.action="index.php?sez=mod_dati";}
} 
