function isEmailAddr(username)
{
  var result = false
  var theStr = new String(username)
  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("Veuillez entrer un Email.");
    theForm.email.focus();
    return (false);
  }

  if (!isEmailAddr(theForm.email.value))
  {
    alert("Veuillez entrer une adresse Email complète du type: nom@domain.com");
    theForm.email.focus();
    return (false);
  }
   
  if (theForm.email.value.length < 6)
  {
    alert("Veuillez entrer au moins 6 caractères pour votre Email.");
    theForm.email.focus();
    return (false);
  }
 
  if (theForm.subject.value == "")
  {
    alert("Veuillez saisir un sujet.");
    theForm.nom.focus();
    return (false);
  }

   if (theForm.message.value == "")
  {
    alert("Veuillez saisir un message.");
    theForm.prenom.focus();
    return (false);
  }
 
  return (true);
}
