<!--
function Form1_Validator(theForm)
{
//* Function to Validate entries on Email form, checks for valid address. *//

  if (theForm.EMail.value == "")
  {
    alert("Please enter an EMail address in the \"From EMail\" field.");
    theForm.EMail.focus();
    return (false);
  }

  if (theForm.EMail.value.length < 7)
  {
    alert("Please enter a valid EMail address in the \"From EMail\" field.");
    theForm.EMail.focus();
    return (false);
  }

  if (theForm.EMail.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"From Email\" field.");
    theForm.EMail.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-@_.";
  var checkStr = theForm.EMail.value;
  var allValid = true;
  var atfound = false;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        {      
        if (ch == "@" && i < checkStr.length - 5)
           {
            atfound=true
            break;
           }  
            else { 
                  break;
                 }
        } 
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter, digit and \"-@_.\" characters in the \"From Email\" field.");
    theForm.EMail.focus();
    return (false);
  }

  if (!atfound)
  {
    alert("Please enter a valid EMail address in the \"From EMail\" field.");
    theForm.EMail.focus();
    return (false);
  }

  if (theForm.Subject.value == "")
  {
    alert("Please enter a value for the \"Subject\" field.");
    theForm.Subject.focus();
    return (false);
  }

  if (theForm.body.value == "")
  {
    alert("Please enter a value for the \"Message\" field.");
    theForm.body.focus();
    return (false);
  }
  return (true);
}
//-->