  

function Valid_email(emailin)
  {
    
    var inemail=emailin;

    // y a t il un @ dans la chaine ?
    if (inemail.indexOf("@")!=-1){
      var semail = inemail.split("@");
      // y a t il un "." dans la partie droite de la chaine ?
      if (semail[1].indexOf(".")!=-1) {    
        return true;
        }
      else {
        return false;
        }
    }
    else {
      return false;
    }
  }

  function CompacteChaine(valeur)
  {

  if (valeur.length > 0)
    {
    while (valeur.length > 0 && valeur.charAt(0) == ' ')
      {
      valeur = valeur.substring(1);
      }
    while (valeur.length > 0 && valeur.charAt(valeur.length-1) == ' ')
      {
      valeur = valeur.substring(0,valeur.length-1);
      }
    return valeur;
    }
  else
    {
    return '';
    }
  }





  function VerifSaisie()
  {
    for ( i=0; i < 4; i++) {
       document.commentform.elements[i].style.backgroundColor = '#FFFFFF';
    }                                                
     
    if (document.commentform.author.value == "")
    {
    alert ('Tu dois saisir ton nom/pseudo pour laisser un commentaire. Merci.');
    document.commentform.author.focus();
    document.commentform.author.style.backgroundColor = '#FF0000';
    return false;
    }

  if (document.commentform.email.value != "" && Valid_email(document.commentform.email.value) == false)
    {
    alert ('Si tu donne ton email ... donne en un valide et pas un fake. Merci.');
    document.commentform.email.focus();
    document.commentform.email.style.backgroundColor = '#FF0000';
    return false;
    }

  /*
  if (document.commentform.comment.value.length<3)
    {
    alert ('Tu dois saisir un message assez long pour poster un commentaire (+ de 2 lettres).');
    document.commentform.comment.focus();
    document.commentform.comment.style.backgroundColor = '#FF0000';
    return false;
    }
   */
  }