function isEmailAddr(address)

{

  var result = false

  var theStr = new String(address)

  var index = theStr.indexOf("@");

  if (index > 0)

  {

    var pindex = theStr.indexOf(".",index);

    if ((pindex > index+1) && (theStr.length > pindex+1))

	result = true;

  }

  return result;

}



function FormValidator(theForm)

{



  if (theForm.address.value == "")

  {

    alert("Please enter a value for the \"address\" field.");

    theForm.address.focus();

    return (false);

  }



  if (!isEmailAddr(theForm.address.value))

  {

    alert("Please enter a complete email address in the form: yourname@yourdomain.com");

    theForm.address.focus();

    return (false);

  }

   

  if (theForm.address.value.length < 3)

  {

    alert("Please enter at least 3 characters in the \"address\" field.");

    theForm.address.focus();

    return (false);

  }

  return (true);

}
