/*******************************************************************************
 * samePasswordChecker
 *
 * @author Facyla 2010
 ******************************************************************************/
function samePasswordChecker(samePassword, errorPassword) {
  //remove all the class add the messagebox classes and start fading
  $('input[name=password2]').before('<span id="msgboxpass2" style="display:none"></span>');
  $("#msgboxpass2").removeClass().addClass('messagebox').text('Vérification...').fadeIn("slow");
  var pass = $('input[name=password]').val();
  var pass2 = $('input[name=password2]').val();
  if(pass != '') {
    if(pass2 != '') {
      if(pass != pass2) {
        //start fading the messagebox
        $("#msgboxpass2").fadeTo(200,0.1,function() {
          //add message and change the class of the box and start fading
          $(this).html(errorPassword).addClass('messageboxerror').fadeTo(900,1);
        });
      } else {
        //start fading the messagebox
        $("#msgboxpass2").fadeTo(200,0.1,function() {
          //add message and change the class of the box and start fading
          $(this).html(samePassword).addClass('messageboxok').fadeTo(900,1);
        });
      }
    }
  }
}

