function isEmailAddr(email)
{
  var result = false
  var theStr = new String(email)
  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.email.value == "")
  {
    alert("Please enter your email address.");
    theForm.email.focus();
    return (false);
  }

  if (!isEmailAddr(theForm.email.value))
  {
    alert("Please enter a valid email address.");
    theForm.email.focus();
    return (false);
  }

  return (true);

}

function valNamePhoneEmail(theForm)
{

	if (theForm.name.value == "" )
  {
    alert("Please enter your name.");
    theForm.name.focus();
    return (false);
  }

  if (theForm.email.value == "" || !isEmailAddr(theForm.email.value))
  {
    alert("Please enter your email address.");
    theForm.email.focus();
    return (false);
  }

  if (theForm.phone.value == "" || theForm.phone.value.length < 12 )
  {
	alert("Please enter a phone number in the format ###-###-####.");
    theForm.phone.focus();
    return (false);
  }

 return (true);

}
