function isEmailAddr(txtEmail)
{
  var result = false
  var theStr = new String(txtEmail)
  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 ContactFormValidator(theForm)
{

  if (theForm.txtName.value == "")
  {
    alert("Please enter your name.");
    theForm.txtName.focus();
    return (false);
  }

  if (theForm.txtEmail.value == "")
  {
    alert("Please enter your email address in the form: yourname@yourdomain.com");
    theForm.txtEmail.focus();
    return (false);
  }

  if (!isEmailAddr(theForm.txtEmail.value))
  {
    alert("Please enter your email address in the form: yourname@yourdomain.com");
    theForm.txtEmail.focus();
    return (false);
  }

  if (theForm.txtEmail.value.length < 3)
  {
    alert("Please enter your email address in the form: yourname@yourdomain.com");
    theForm.txtEmail.focus();
    return (false);
  }
  
  
  if (theForm.txtComments.value == "")
  {
    alert("Please enter a message.");
    theForm.txtComments.focus();
    return (false);
  }
  
  return (true);
}

function MlistFormValidator(theForm)
{

  if (theForm.txtName.value == "")
  {
    alert("Please enter your name.");
    theForm.txtName.focus();
    return (false);
  }
  
  if (theForm.txtEmail.value == "")
  {
    alert("Please enter your email address in the form: yourname@yourdomain.com");
    theForm.txtEmail.focus();
    return (false);
  }

  if (!isEmailAddr(theForm.txtEmail.value))
  {
    alert("Please enter your email address in the form: yourname@yourdomain.com");
    theForm.txtEmail.focus();
    return (false);
  }

  if (theForm.txtEmail.value.length < 3)
  {
    alert("Please enter your email address in the form: yourname@yourdomain.com");
    theForm.txtEmail.focus();
    return (false);
  }
  
  return (true);
}

