
function emailCheck(field)
 {
   val = false;

   // Check for No Entry
   if (field.value == "")
    {
      alert("Please enter an email address before clicking the Submit button.");
      field.focus();
    }
   else
    {
      if (field.value.indexOf("@") != -1)
       {
         var array = field.value.split("@");


         if ((array[0].length < 1) ||  // no userid
             (array[1].length < 1) ||  // no domain
             (array.length > 2))       // more than one @ sign
          {
            alert("Your email address does not appear to be correct.  The correct "+
                  "format is xxxxx@yyyyy.zzz.");
            field.focus();
          }
         else
          {
            var domarray = array[1].split(".");

            if (domarray.length < 2)
             {
               alert("The domain name of your email address does not appear to be correct.  The correct "+
                     "format is xxxxx@yyyyy.zzz.");
               field.focus();
             }
            else
             {
               val = true;

               for (var loop = 0; loop < domarray.length; loop++)
                {
                  if (domarray[loop].length < 1)
                   {
                     val = false;
                   }
                }

               if (val == false)
                {
                  alert("The domain name of your email address does not appear to be correct.  The correct "+
                        "format is xxxxx@yyyyy.zzz.");
                  field.focus();
                }
             }
          }
       }
      else
       {
         alert("Your email address does not appear to be correct.  The correct " +
               "format is xxxxx@yyyyy.zzz.");
         field.focus();
       }
    }

  return val;
}
