function form_val()
  {
   var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;
   var phoneRE = /^\d\d\d\-\d\d\d-\d\d\d\d$/;
   var status = true;
   var errmsg="";
   if(document.contact_form.firstname.value == '' || document.contact_form.lastname.value == '' ||  
document.contact_form.email.value == '' || document.contact_form.phonenumber.value == '')
    {
     errmsg=errmsg+('Please fill out all necessary fields.\n');
     status = false;
    }
   if (!document.contact_form.email.value == '')
    {
     var returnval=emailfilter.test(document.contact_form.email.value);
     if (returnval==false)
   {
    errmsg=errmsg+("Please enter a valid email address.\n");
    status=false;
   }
    }
     if(errmsg.length!="")
    {
     alert(errmsg);
    }
   return status;
  }
