function isEmpty(strcontact, strcompany, strphone1) {


//change "contact, company and phone1" to your field names
strcontact = document.forms[0].contact.value 
strcompany = document.forms[0].company.value
strphone1 = document.forms[0].phone1.value

  //name field
    if (strcontact == "" || strcontact == null || !isNaN(strcontact) || strcontact.charAt(0) == ' ')
    {
    alert("\"Field 1\" is a mandatory field.\nPlease amend and retry.")
    return false;
    }

  //url field 
    if (strcompany == "" || strcompany == null || strcompany.charAt(0) == ' ')
    {
    alert("\"Field 2\" is a mandatory field.\nPlease amend and retry.")
    return false;
    }

  //title field 
    if (strphone1 == "" || strphone1 == null || strphone1.charAt(0) == ' ')
    {
    alert("\"Field 3\" is a mandatory field.\nPlease amend and retry.")
    return false;
    }
    return true;
}


//function to check valid email address
function isValidEmail(strEmail){
  validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
  strEmail = document.forms[0].email.value;

   // search email text for regular exp matches
    if (strEmail.search(validRegExp) == -1) 
   {
      alert('A valid e-mail address is required.\nPlease amend and retry');
      return false;
    } 
    return true; 
}


//function that performs all functions, defined in the onsubmit event handler

function check(form))
{
if (isEmpty(form.contact)){
  if (isEmpty(form.company)){
    if (isEmpty(form.phone1)){
		if (isValidEmail(form.email)){
		  return true;
		}
	  }
  }
}
return false;
}
