function controllaModulo()
   {
   
   
	var nome = document.modulocontatti.nome.value;
	var cognome = document.modulocontatti.cognome.value;
	var recapito = document.modulocontatti.recapito.value;
	var mail = document.modulocontatti.mail.value;
  	var messaggio = document.modulocontatti.messaggio.value;
    var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
 	var autorizzato = document.modulocontatti.autorizzo[0].checked;

 if ((nome == "") || (nome == "undefined")) {
   alert("Il campo Nome è obbligatorio.");
   document.modulocontatti.nome.focus();
   return false;
}


if ((cognome == "") || (cognome == "undefined")) {
   alert("Il campo Cognome è obbligatorio.");
   document.modulocontatti.cognome.focus();
   return false;
}
 
 
 
if (mail!=""){

	if (!email_reg_exp.test(mail) || (mail == "") || (mail == "undefined")) {
	alert("INSERISCI UN INDIRIZZO EMAIL VALIDO DEL TIPO: TUONOME@TUODOMINIO.IT");
	document.modulocontatti.mail.select();  // NEL MIO CASO email
	document.modulocontatti.mail.value="";
	document.modulocontatti.mail.focus();
	return false;
	
	}

}

if ((messaggio == "") || (messaggio == "undefined")) {
   alert("Il campo Messaggio è obbligatorio.");
   document.modulocontatti.messaggio.focus();
   return false;
}

if (autorizzato === false) {
   alert("Per inviare il modulo devi autorizzare il trattamento dei dati personali");
   return false;
}
 
 }
 
 
 
function isnum(obj) {
if (isNaN(obj.value) || parseInt(obj.value)<0 || parseInt(obj.value) > 9999999999999999)
{
alert('Nel campo è possibile immettere solo numeri!');
obj.value="";
obj.focus();
}
}