function isEmpty(strfield1, strfield2) {
strfield1 = document.forms[0].form_azi.value
strfield2 = document.forms[0].form_name.value

    if (strfield1 == "" || strfield1 == null || !isNaN(strfield1) || strfield1.charAt(0) == ' ')
    {
    alert("Il campo \"AZIENDA\" e' un campo obbligatorio.")
    return false;
    }

    if (strfield2 == "" || strfield2 == null || !isNaN(strfield2) || strfield2.charAt(0) == ' ')
    {
    alert("Il campo \"NOME E COGNOME\" e' 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 that performs all functions, defined in the onsubmit event handler
function check(form){
if (isEmpty(form.field1)){
	if (isEmpty(form.field2)){
						if (isValidEmail(form.email)){	
							return true;
						}
					}
}
return false;
}
