var envoyer;
envoyer = 0;

//+------------------------------------------+
//|    Formulaire d'authentification         |
//+------------------------------------------+


  function auth()
  {
  c1 = document.form.pp_test.value;

  verif = true;

    if(verif)
    {
      if(!c1 || c1=="")
      {
      alert ('Veuillez indiquer votre PASSWORD !');
      document.form.pp_test.focus ();
      document.form.pp_test.select ();
      verif = false;
      }
    }

    if(verif)
    envoyer++;

    if(verif && envoyer==1)
    document.form.submit();

  return verif;
  }


//+------------------------------------------+
//|    Formulaire d'ID invalide              |
//+------------------------------------------+

  function valid()
  {
  c1 = document.form.num.value;

  verif = true;

    if(verif)
    {
      if(!c1 || c1=="")
      {
      alert ('Veuillez indiquer votre ID !');
      document.form.num.focus ();
      document.form.num.select ();
      verif = false;
      }
    }

    if(verif)
    envoyer++;

    if(verif && envoyer==1)
    document.form.submit();

  return verif;
  }

//+------------------------------------------+
//|    Affichage du Formulaire de réponse    |
//+------------------------------------------+

  function repondre ()
  {

  var VarTableau;
  VarTableau = document.getElementById('RepBlock');

    if (VarTableau.style.visibility == "hidden")
    {
    VarTableau.style.visibility  = "visible";
    VarTableau.style.display     = "block";
    }
  }

//+------------------------------------------+
//|    Poster en tant que membre             |
//+------------------------------------------+

  function membre()
  {
  c1 = document.form.titre.value;
  c2 = document.form.msg.value;
  c3 = document.form.auteur.value;
  c4 = document.form.password.value;

  verif = true;

    if(verif)
    {
      if(!c1 || c1=="")
      {
      alert ('Veuillez indiquer un titre à votre message !');
      document.form.titre.focus ();
      document.form.titre.select ();
      verif = false;
      }
    }


    if(verif)
    {
      if(!c2 || c2=="")
      {
      alert ('Veuillez indiquer message !');
      document.form.msg.focus ();
      document.form.msg.select ();
      verif = false;
      }
    }

    if(verif)
    {
      if(!c3 || c3=="")
      {
      alert ('Veuillez indiquer votre IDENTIFIANT de membre !');
      document.form.auteur.focus ();
      document.form.auteur.select ();
      verif = false;
      }
    }

    if(verif)
    {
      if(c3.indexOf('\\') != -1 ||
         c3.indexOf('\"') != -1 ||
         c3.indexOf('\'') != -1 ||
         c3.indexOf('\`') != -1 )
      {
      alert ('Votre IDENTIFIANT ne peut pas contenir les caractères suivants : \\\"\'\`');
      document.form.auteur.focus ();
      document.form.auteur.select ();
      verif = false;
      }
    }

    if(verif)
    {
      if(!c4 || c4=="")
      {
      alert ('Veuillez indiquer votre PASSWORD de membre !');
      document.form.password.focus ();
      document.form.password.select ();
      verif = false;
      }
    }

    if(verif)
    {
      if(c4.indexOf('\\') != -1 ||
         c4.indexOf('\"') != -1 ||
         c4.indexOf('\'') != -1 ||
         c4.indexOf('\`') != -1 )
      {
      alert ('Votre PASSWORD ne peut pas contenir les caractères suivants : \\\"\'\`');
      document.form.password.focus ();
      document.form.password.select ();
      verif = false;
      }
    }

    if(verif)
    envoyer++;

    if(verif && envoyer==1)
    document.form.submit();

  return verif;
  }

//+------------------------------------------+
//|    Poster en tant qu'anonyme             |
//+------------------------------------------+

  function anonyme()
  {
  c1 = document.form.titre.value;
  c2 = document.form.msg.value;

  verif = true;

    if(verif)
    {
      if(!c1 || c1=="")
      {
      alert ('Veuillez indiquer un titre à votre message !');
      document.form.titre.focus ();
      document.form.titre.select ();
      verif = false;
      }
    }


    if(verif)
    {
      if(!c2 || c2=="")
      {
      alert ('Veuillez indiquer message !');
      document.form.msg.focus ();
      document.form.msg.select ();
      verif = false;
      }
    }

    if(verif)
    {
    document.form.auteur.value    = "anonyme"
    document.form.password.value  = "anonyme"
    envoyer++;
    }

    if(verif && envoyer==1)
    document.form.submit();

  return verif;
  }

//+------------------------------------------+
//|       Apercu..                           |
//+------------------------------------------+


  function previsu()
  {
  document.apercu.msg.value     = document.form.msg.value;

  format = document.form.format.checked;
    if(format)
    document.apercu.format.value  = "1";
    else
    document.apercu.format.value  = "2";

  document.apercu.submit();
  }



//+------------------------------------------+
//|    Suppression de messages               |
//+------------------------------------------+


  function SupprMsgConfirm(Type, Key)
  {

    if(window.confirm('Vous êtes sur le point de supprimer un message.\nVeuillez confirmer ou annuler.'))
    {
    document.SupprMsgForm.Type.value   =   Type;
    document.SupprMsgForm.Key.value    =   Key;

    document.SupprMsgForm.submit();
    }

  }




//+------------------------------------------+
//|    Afficher				     |
//+------------------------------------------+

  function visibleById(id)
  {

  var VarTableau;
  VarTableau = document.getElementById(id);

    if (VarTableau.style.visibility == "hidden")
    {
    VarTableau.style.visibility  = "visible";
    VarTableau.style.display     = "block";
    }
  }



//+------------------------------------------+
//|    Cacher				     |
//+------------------------------------------+

  function  hiddenById(id)
  {

  var VarTableau;
  VarTableau = document.getElementById(id);


    VarTableau.style.visibility  = "hidden";
    VarTableau.style.display     = "none";

  }
