
//------------------------------------------------------------------------------------------------
//-------------------    Fais clignoter 2 fois l'element d'id "id_elmt"    -----------------------
//------------------------------------------------------------------------------------------------
function clignote(id_elmt, nom_class, contenu) {
  $("#"+id_elmt).show();
  $("#"+id_elmt).addClass(nom_class).html(contenu).fadeTo("fast", 1, function() {
    $(this).fadeTo("fast", 0.1,function() {
      $(this).fadeTo("fast", 1, function() {
        $(this).fadeTo("fast", 0.1,function() {
          $(this).fadeTo("fast", 1, function() {
            return true;
          });
        });
      });
    });
  });
}

//------------------------------------------------------------------------------------------------
//--------------------        Fonction qui valide une adresse email    ---------------------------
//------------------------------------------------------------------------------------------------
function verif_email(email) {
  var proto  = "(mailto:)?";
  var usr    = "([a-zA-Z0-9][a-zA-Z0-9_.-]*|\"([^\\\\\x80-\xff\015\012\"]|\\\\[^\x80-\xff])+\")";
  var domain = "([a-zA-Z0-9][a-zA-Z0-9._-]*\\.)*[a-zA-Z0-9][a-zA-Z0-9._-]*\\.[a-zA-Z]{2,5}";
  var regex  = "^" + proto + "?" + usr + "\@" + domain + "$";

  var rgx    = new RegExp(regex);
  return rgx.exec(email) ? true : false;
}

//------------------------------------------------------------------------------------------------
//------    HighLight des input, select et textarea et leur p précédent dans un formulaire  ------
//------------------------------------------------------------------------------------------------
function init_highlight_form()  {
  //-- Highlight des champ input
  $("input[@type=text],input[@type=password],select, textarea").focus(function(){
    $(this).addClass("focus");
    $(this).prev().addClass("coul_important");
    
    if($(this).hasClass("bordure_erreur")) {
      $(this).removeClass("bordure_erreur").prev().removeClass("msg_erreur");
    }
  });
  $("input[@type=text],input[@type=password],select, textarea").blur(function() {
    $(this).removeClass("focus");
    $(this).prev().removeClass("coul_important");
  }); 
}

