new Event.observe(window, 'load', init);

function init() {
  replaceInput();
}

function loadFlash(so, element) {
  if (version['major'] < 8) {
    $(element).update('<center>Votre navigateur ne possède pas le lecteur Flash ou sa dernière version, pour l\'installer, rendez-vous à la page de téléchargement en cliquant <a href=\"http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash&Lang=French\" title=\"Télécharger Flash\">ici</a></center>');
  } else {
    so.write(element);
  } 
}

function replaceInputs() {
  $$('input[type*="text"]', 'input[type*="password"]').each(function(input){
    input.addClassName('input');
  });
}

function replaceInput() {
  $$('input[type*="text"]', 'textarea').each(function(input){
    if (input.getStyle('backgroundColor') == "rgb(250, 231, 217)") {
      new Event.observe(input, 'mouseover', function(event) {
        input.setStyle({backgroundColor: "rgb(255, 218, 191)"}); inputOver = true;
      });
      new Event.observe(input, 'mouseout', function(event) {
        input.setStyle({backgroundColor: "rgb(250, 231, 217)"}); inputOver = false;
      });
      new Event.observe(input, 'focus', function(event) {
        input.setStyle({backgroundColor: "rgb(255, 218, 191)"}); inputOver = true;
      });
      new Event.observe(input, 'blur', function(event) {
        input.setStyle({backgroundColor: "rgb(250, 231, 217)"}); inputOver = false;
      });
    }
  });
}

function checkEmail(email) { // vérif validité email par REGEXP
   var reg = /^[a-z0-9._-]+@[a-z0-9.-]{2,}[.][a-z]{2,3}$/
   return (reg.exec(email) != null)
}
