// JavaScript Document

function sendform(){

var name=document.modulo.nome.value;
var mail=document.modulo.email.value;
var msg=document.modulo.messaggio.value;

errori="";

var expNome = new RegExp("^([a-zA-Z]|(){3,20})$");
var expMsg = new RegExp("^([a-zA-Z0-9]|( )|(')|(à)|(è)|(é)|(ì)|(ò)|(ù)){5,200}$");
var expEmal= new RegExp("^([a-zA-Z0-9_\.\-]+\@+[a-zA-Z0-9\-]+\.+[a-zA-Z0-9]{2,})$");


if((name=="") || (name=="undefined") || (!expNome.test(name))){
errori= errori + "compilare correttamente il campo nome" + "\r" + "\n";
}


if((mail=="") || (mail=="undefined") || (!expEmail.test(mail))){
errori= errori + "compilare correttamente il campo email" + "\r" + "\n";
}


if((msg=="") || (msg=="undefined") || (!expMsg.test(msg))){
errori= errori + "compilare correttamente il campo messaggio" + "\r" + "\n";
}



if (errori != ""){
errori= "i seguenti campi sono vuoti : "+  "\r" + "\n" + errori;
alert(errori);
return false;
}


else {
	 document.modulo.action = "send.php";
     document.modulo.submit();
	 return true;
	 }}
