{emailerror1="Please input your email address";
 emailerror2="Bad Syntax of Email address";};
function newalert(errorstring) {
   alert(errorstring);
};
function Validator(theForm)
{ if (theForm.email.value =="")
  { theForm.email.focus();
    newalert(emailerror1);
    return (false); }
  var checkOK = "@";
  var checkStr = theForm.email.value;
  var allValid = false;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
      {
 allValid = true;
 break;
      }
  }
 if (!allValid)
  {
    theForm.email.focus();
    newalert(emailerror2);
    return (false);
  }
  var checkOK = ".";
  var checkStr = theForm.email.value;
  var allValid = false;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
      {
 allValid = true;
 break;
      }
  }
 if (!allValid)
  {
    theForm.email.focus();
    newalert(emailerror2);
    return (false);
  }
  var checkOK = "@???????????????????????º???0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_.";
  var checkStr = theForm.email.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
 break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    theForm.email.focus();
    newalert(emailerror2);
    return (false);
  }
  return (true);
}