function AddUserFormCheck(){
	var outvalue = true;
	var errormsg = "I seguenti campi vanno compilati correttamente:\n";
	Form = document.getElementById("i_adduser");
	
	Nome = document.getElementById("i_nome");
	Cognome = document.getElementById("i_cognome");
	Sesso = document.getElementById("i_sesso");
	Giorno = document.getElementById("i_giorno");
	Mese = document.getElementById("i_mese");
	MeseReale = document.getElementById("i_mesereale");
	Anno = document.getElementById("i_anno");
	Nazione = document.getElementById("nazionenascita");
	Provincia = document.getElementById("provincianascita");
	Cellulare = document.getElementById("i_cellulare");
	if (Nazione.value == 226){
		if (Provincia.selectedIndex != 0) {
			Luogo = document.getElementById("cittanascita1")[document.getElementById("cittanascita1").selectedIndex].text;
		} else {
			Luogo = '';
		}
	} else {
		Luogo = document.getElementById("cittanascita2").value;
	}
	CodiceFiscale = document.getElementById("i_cf");
	Email = document.getElementById("i_email");
	Username = document.getElementById("i_username");
	Password = document.getElementById("i_password");
	CPassword = document.getElementById("i_cpassword");
	Privacy = document.getElementById("i_privacy");
	
	MeseReale.value = Mese.selectedIndex;
	
	if ((Nome.value.length > 30) || (Nome.value.length == 0)){
		errormsg+="- Il campo nome e` obbligatorio e non puo` superare 30 caratteri\n";
		outvalue=false;
	}
	
	if ((Cognome.value.length > 30) || (Cognome.value.length == 0)){
		errormsg+="- Il campo cognome e` obbligatorio e non puo` superare 30 caratteri\n";
		outvalue=false;
	}
	
	if ((Cellulare.value.length  == 0)){
		errormsg+="- Il campo cellulare e` obbligatorio\n";
		outvalue=false;
	}
	
	if (Nazione.value == 226){
		if (Provincia.value.length == 0){
			errormsg+="- Il campo provincia di nascita e` obbligatorio\n";
			outvalue=false;
		}
	}
	
	if (Luogo.length == 0){
		errormsg+="- Il campo luogo di nascita e` obbligatorio\n";
		outvalue=false;
	}
	
	if ((CodiceFiscale.value.length > 20) || (CodiceFiscale.value.length == 0)){
		errormsg+="- Il codice fiscale e` obbligatorio\n";
		outvalue=false;
	}
	
	if ((Giorno.selectedIndex == 0)||(Mese.selectedIndex == 0)||(Anno.selectedIndex == 0)){
		errormsg+="- Compilare la data di nascita\n";
		outvalue=false;
	}
	
	if ((Email.value.indexOf("@")==-1)||(Email.value.indexOf(".")==-1)){
		errormsg+="- Inserire un indirizzo email valido\n";		
		outvalue=false;
	}
	
	var reg = /^[a-zA-Z0-9\_]{6,15}$/;
	
	if (!reg.test(Username.value)){
		errormsg+="- Il campo username deve contenere tra 6 e 15 caratteri,\n  a scelta tra lettere, numeri o underscore\n";
		outvalue=false;
	}
	
	if ((Password.value.length > 15) || (Password.value.length < 6)){
		errormsg+="- Il campo password deve contenere tra 6 e 15 caratteri\n";
		outvalue=false;
	} else {
		if (Password.value != CPassword.value){
			errormsg+="- Controllare il campo password\n";
			outvalue=false;
		}
	}
	
	if (!Privacy.checked){
		errormsg+="- Bisogna accettare i termini di privacy\n";
		outvalue=false;
	}
	
	if (!outvalue){
		alert(errormsg);
	}
	
	return outvalue;
}
