function checkEmailAddress(field) 
{
	  var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.coop)|(\..{2,2}))$)\b/gi);
	  if (goodEmail)
	  {
		good = true
	  } 
	  else 
	  {
		alert("Indirizzo Email non corretto");
		field.focus()
		field.select()
		good = false
	  }
}

function controlla()
{	
	if (document.form.frm_nome.value.length == 0) 
	{
		alert("Nome obbligatorio");
		document.form.frm_nome.select();
		document.form.frm_nome.focus();	
		return false;
	} 
	if (document.form.frm_cognome.value.length == 0) 
	{
		alert("Cognome obbligatorio");
		document.form.frm_cognome.select();
		document.form.frm_cognome.focus();	
		return false;
	}

	if (document.form.frm_email.value.length == 0) 
	{
		alert("Email obbligatoria");
		document.form.frm_email.select();
		document.form.frm_email.focus();	
		return false;
	}
	else
	{
		checkEmailAddress(document.getElementById('frm_email'))			
		if (good==false)
		{
			document.form.frm_email.select();
			document.form.frm_email.focus();	
			return false;
		}   
	}
	if (document.form.frm_richiesta.value.length == 0) 
	{
		alert("Inserite la vostra richiesta");
		document.form.frm_richiesta.select();
		document.form.frm_richiesta.focus();	
		return false;
	}
	if (document.form.frm_privacy.checked == false) 
	{
		alert("Per procedere alla registrazione devi acconsentire al trattamento dati");
		document.form.frm_privacy.select();
		document.form.frm_privacy.focus();	
		return false;
	}
}	
