function isEmpty(strfield1, strfield2, strfield3) {


//change "field1, field2 and field3" to your field names
strfield1 = document.forms[0].fname.value 
strfield2 = document.forms[0].lname.value

  //name field
    if (strfield1 == "" || strfield1 == null || !isNaN(strfield1) || strfield1.charAt(0) == ' ')
    {
    alert("Please provide your first name.")
	document.forms.plantrip.fname.focus();
    return false;
    }

  //url field 
    if (strfield2 == "" || strfield2 == null || strfield2.charAt(0) == ' ')
    {
    alert("Please provide your last name.")
	document.forms.plantrip.lname.focus();
    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("Please provide a valid email address.");
	  document.forms.plantrip.email.focus();
      return false;
    } 
    return true; 
}


//function that performs all functions, defined in the onsubmit event handler

function check(form){
if (isEmpty(form.fname)){
  if (isEmpty(form.lname)){
    if (isEmpty(form.subject)){
		if (isValidEmail(form.email)){
		  return true;
		}
	  }
  }
}
return false;
}
