function verEmail(stringa) {
   if (stringa.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
   return true;
   else return false;
}

function controllo(f) {
var msgErrore = '';
var nome=f.nome;
var cognome=f.cognome;
var azienda=f.azienda;
var citta=f.citta;
var email=f.email;
var motivo = f.motivo;
var testo=f.testo;

if (nome.value == "")
	{ msgErrore+="- Nome è obbligatorio.\r"; }
else
	{
	if ((nome.value.replace(/\s*/gi,'') == '') || (nome.value.replace(/\x13\x10*/gi,'') == ''))
	{ msgErrore+="- Nome è obbligatorio e non può essere vuoto.\r"; }
	}

if (cognome.value == "")
	{ msgErrore+="- Cognome è obbligatorio.\r"; }
else
	{
	if ((cognome.value.replace(/\s*/gi,'') == '') || (cognome.value.replace(/\x13\x10*/gi,'') == ''))
	{ msgErrore+="- Cognome è obbligatorio e non può essere vuoto.\r"; }
	}

if ( (azienda.value!="") && ( (azienda.value.replace(/\s*/gi,'') == '') || (azienda.value.replace(/\x13\x10*/gi,'') == '') ) )
	{ msgErrore+="- Azienda non può essere vuoto.\r"; }

if ( (citta.value!="") && ( (citta.value.replace(/\s*/gi,'') == '') || (citta.value.replace(/\x13\x10*/gi,'') == '') ) )
	{ msgErrore+="- Città non può essere vuoto.\r"; }

if (email.value == "")
	{ msgErrore+="- E-mail è obbligatorio.\r"; }
else
	{
	if (!verEmail(email.value))
	{ msgErrore+="- Inserire un indirizzo e-mail corretto.\r"; }
	}

if (motivo.value == "")
	{ msgErrore+="- Motivo è obbligatorio.\r"; }
else
	{
	if ((motivo.value.replace(/\s*/gi,'') == '') || (motivo.value.replace(/\x13\x10*/gi,'') == ''))
	{ msgErrore+="- Motivo è obbligatorio e non può essere vuoto.\r"; }
	}

if (testo.value == "")
	{ msgErrore+="- Testo del messaggio è obbligatorio.\r"; }
else
	{
	if ((testo.value.replace(/\s*/gi,'') == '') || (testo.value.replace(/\x13\x10*/gi,'') == ''))
	{ msgErrore+="- Testo del messaggio è obbligatorio e non può essere vuoto.\r"; }
	}

if (msgErrore != '')
	{
	msgErrore = "Si sono verificati i seguenti errori:\r\r" + msgErrore;
	alert(msgErrore);
	return false;
	}
return true;
}