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;
  }


//+------------------------------------------+
//|    Auth 2                                |
//+------------------------------------------+

  function auth2()
  {
  c1  = document.form.auteur.value;
  c2  = document.form.password.value;

  verif = true;

    if(verif)
    {
      if(!c1 || c1=="")
      {
      alert ('Veuillez indiquer un AUTEUR (Pseudo) !');
      document.form.auteur.focus ();
      document.form.auteur.select ();
      verif = false;
      }
    }


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

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

    if(verif)
    {
      if(c2.indexOf('\\') != -1 ||
         c2.indexOf('\"') != -1 ||
         c2.indexOf('\'') != -1 ||
         c2.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;
  }

//+------------------------------------------+
//|    Cacher le block d'upload d'image      |
//+------------------------------------------+

  function cacher()
  {

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

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

  document.form.suppr_photo.value = "1";
  }

//+------------------------------------------+
//|    Enregistrer                           |
//+------------------------------------------+

  function enregistrer()
  {
  c1  = document.form.npassword.value;
  c2  = document.form.npassword2.value;

  verif = true;


    if(verif)
    {
      if((c1 || c2) && (c1 != c2))
      {
      alert ('Nouveaux PASSWORD différents !');
      document.form.npassword.focus ();
      document.form.npassword.select ();
      verif = false;
      }
    }

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

    if(verif)
    {
      if(window.confirm('Vous êtes sur le point de mettre à jour les données de votre profil.\nVeuillez confirmer ou annuler.'))
      verif = true;
      else
      verif = false;
    }

    if(verif)
    envoyer++;

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

  return verif;
  }

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


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

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

  document.apercu.submit();
  }

