function isEmpty(strfield1, strfield2, strfield3) {
strfield1 = document.forms[0].form_name.value
strfield2 = document.forms[0].form_town.value
strfield3 = document.forms[0].form_message.value

    if (strfield1 == "" || strfield1 == null || !isNaN(strfield1) || strfield1.charAt(0) == ' ')
    {
    alert("Il campo \"NOME E COGNOME\" è un campo obbligatorio.")
    return false;
    }

    if (strfield2 == "" || strfield2 == null || !isNaN(strfield2) || strfield2.charAt(0) == ' ')
    {
    alert("Il campo \"CITTA'\" è un campo obbligatorio.")
    return false;
    }
	
	if (strfield3 == "" || strfield3 == null || !isNaN(strfield3) || strfield3.charAt(0) == ' ')
    {
    alert("Il campo \"SONO INTERESSATO A\" è un campo obbligatorio.")
    return false;
    }
	
    return true;
}

//function to check valid email address
function isValidEmail(strEmail){
  validRegExp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  strEmail = document.forms[0].form_email.value;
   // search email text for regular exp matches
    if (strEmail.search(validRegExp) == -1) 
   {
      alert('Inserisci un indirizzo e-mail valido per il campo \"E-MAIL\"');
      return false;
    } 
    return true; 
}

function provincia(citta){
	citta = document.forms[0].interessi.selectedIndex
	if (citta<1){
	alert('Il campo \"AREA DI INTERESSE\" è un campo obbligatorio');
	return false;
	}
return true;	
}

//function that performs all functions, defined in the onsubmit event handler
function check(form){
if (isEmpty(form.field1)){
	if (isEmpty(form.field2)){
		if (isEmpty(form.field3)){
				if (provincia(form.interessi)){
						if (isValidEmail(form.email)){	
			  			return true;
						}
					}
		} 
	}
}
return false;
}
