
function form_controlla(theForm)
{

if (theForm.nome.value == "")
  {
    alert("Please enter a value for the \"Name\" field.");
    theForm.nome.focus();
    return (false);
  }
  
if (theForm.azienda.value == "")
  {
    alert("Please enter a value for the \"Company\" field.");
    theForm.azienda.focus();
    return (false);
  }

if (theForm.nazione[theForm.nazione.selectedIndex].text == '')
  {
    alert("Please enter a value for the \"Country\" field.");
    theForm.nazione.focus();
    return (false);
  }

if (theForm.telefono.value == "")
  {
    alert("Please enter a value for the \"Phone N.\" field.");
    theForm.telefono.focus();
    return (false);
  }

if (theForm.email.value == "")
  {
    alert("Please enter a value for the \"Business E-mail address\" field.");
    theForm.email.focus();
    return (false);
  }
  
  if (ver_email(theForm.email.value) == false)
  {
    alert("E-mail address is not valid.");
    theForm.email.focus();
    return (false);
  }
  
  if(!(theForm.accetto.checked))
{
	alert("Please check the checkbox in this form to agree to the above mentioned declaration.");
	theForm.accetto.focus();
	return (false);
	
}

return (true);
}

// Funzione per la verifica dell'email. Nell'ordine verifica la presenza del
// carattere "@", del carattere "." e la lunghezza dell'indirizzo.
function ver_email(dati) {
	if ((dati.indexOf("@") == -1) |
		(dati.indexOf(".") == -1) |
		(dati.length < 7)) {
			return false;
		}
	else {
			return true;
	}
return true;
}

