// Javascript validation functions
// http://www.designplace.org/


//function to check empty fields

function isEmpty(strfield2) {
strfield2 = document.forms[1].message.value

    if (strfield2 == "" || strfield2 == null || strfield2.charAt(0) == ' ')
    {
    alert("\"Message\" is a required field.\nPlease refill it and retry.")
    return false;
    }

    return true;
}


//function to check valid email address
function isValidEmail(strEmail){
  validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
  strEmail = document.forms[1].from.value;

   // search email text for regular exp matches
    if (strEmail.search(validRegExp) == -1) 
   {
      alert('A valid e-mail address is required.\nPlease fix it and retry');
      return false;
    } 
    return true; 
}


function check(form){
  if (isEmpty(form.message)){
		if (isValidEmail(form.from)){
		  return true;
		}
  }

return false;
}


