
<!--
function check(){
// impostazioni variabili per il controllo
var checkOK = "0123456789-/";
var checkOKfax = "0123456789-/";
var checkStr = document.forms[0].telefono.value;
var checkFax= document.forms[0].fax.value;
var allValid = true;



// controllo cognome
if(document.forms[0].cognome.value=="")
{
alert("Insert the first name!")
document.forms[0].cognome.focus();
return false}


//controllo nome
if(document.forms[0].nome.value=="")
{
alert("Insert the Last name!")
document.forms[0].nome.focus();
return false}



//controllo citta
if(document.forms[0].localita.value=="")
{
alert("Insert the city!")
document.forms[0].localita.focus();
return false}



// controllo numerico telefono
for (i = 0;  i < checkStr.length;  i++)
	 {
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
			 break;
			 	if (j == checkOK.length)
				  {
				    allValid = false;
				    break;
				   }
				  
				}
				if (!allValid)
				{
				  alert ("Necessary to only insert numerical values in field Telephone!");
				  document.forms[0].telefono.value = "";
				  document.forms[0].telefono.focus();
				  return (false);
				}	

//controllo telefono
if(document.forms[0].telefono.value=="")
{
alert("Insert telephon number !")
document.forms[0].telefono.focus();
return false}

//controllo email
if(document.forms[0].email.value=="")
{
alert("Insert the e-mail!")
document.forms[0].email.focus();
return false}

//controllo @ email
if(document.forms[0].email.value !=""){
        
		var string = document.forms[0].email.value;
             if(string.indexOf('@')==-1)
                {
                     alert("Insert a Valid address email!")
                      document.forms[0].email.select();
					  return false
        		}
				if(string.indexOf('.')==-1)
                {
                     alert("Insert a Valid address email!")
                      document.forms[0].email.select();
					  return false
        		}
									}



//controllo messaggio
if(document.forms[0].messaggio.value=="")
{
alert("Insert the message")
document.forms[0].messaggio.focus();
return false}
return true

}
//-->


