function validate()
{
  var s;
  if ((document.reqform.txtName.value == "") || (document.reqform.txtCompany.value == "") || (document.reqform.txtEmail.value == "") || (document.reqform.txtPhone.value == "") || (document.reqform.txtDescription.value == "") || (document.reqform.txtMakeModel.value == ""))
  {
     alert("You must complete all required fields.");
     return false;
  }
  if  (document.reqform.txtEmail.value != "")
{
s = (chktxtEmail(document.reqform.txtEmail.value));
    if (s == false)

    {
	return false;
	}
}

function chktxtEmail(s) {
    txt=s;
    len=txt.length;
    /* assigns length of string to check to "len" */
    atindex=txt.indexOf("@");
    /* finds the 0-based index of the @ sign */
    if (atindex<1) {
    alert("I'm sorry, this email address seems wrong. Please"
    +" check the prefix and '@' sign.");
    return false; }
        
     /* that if-block checks to see if the at sign exists (-1) or is too near the beginning of the string */
    
     txtafterat=txt.slice(atindex+1);
    /* that kills everthing before and including the @-sign. */
    
    if ((txtafterat.length - txtafterat.lastIndexOf("."))<3) {
      alert("I'm sorry, this email address seems wrong.  Please"
            +" check the domain name and suffix for accuracy.  The suffix seems to be too short.");
     return false;
    }
    /* that checks to see if the final "." is at least 2 from the end (allows .ca, and .com, not .x). */
   
      
     if (txtafterat.indexOf(".")<2){
	alert("I'm sorry, this email address seems wrong.  Please"
            +" check the domain name and suffix for accuracy.  The domain name seems to be too short.");
     return false; }
     /* that checks to see if the space between the "@" and the next "." is at least 2.  It
     dis-allows dude@r.com but allows dude@rr.com */
     return true;
    }
}