Event.observe(window, "load", function (event) {
	if($('frmCreateAdherent')){
		$('frmCreateAdherent').select("input[type=password]").each(function (password) {
	      var input = document.createElement("input");
	      input.setAttribute("type", "button");
	      input.setAttribute("class", "password");
	      input.setAttribute("value", "Générer");
	      password.parentNode.appendChild(input);
	
	      Event.observe(input, "click", function (event) {
	          var alpha = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	          var notAlpha = "_-()[]{}=+;:,%$#"
	          var min = 8;
	          var max = 8;
	          var alphaStart = 0;
	          var alphaOnly = "true";
				
	          if (password.getAttribute("alpha")) alpha = password.getAttribute("alpha");
	          if (password.getAttribute("notApha")) alpha = password.getAttribute("notApha");
	          if (password.getAttribute("min")) alpha = password.getAttribute("min");
	          if (password.getAttribute("max")) alpha = password.getAttribute("max");
	          if (password.getAttribute("alphaStart")) alpha = password.getAttribute("start");
	          if (password.getAttribute("alphaOnly")) alpha = password.getAttribute("alphaOnly");
	
	          var length = (Math.round(Math.random() * (max - min)) + min) - alphaStart;
	          
	          var buffer = "";
	          for (index=0; index<alphaStart; index++) {
	            buffer += notAlpha.charAt(Math.round(Math.random() * notAlpha.length));
	          }
	          if (alphaOnly != "true") {
	            alpha += notAlpha;
	          }
	          for (index=0; index<length; index++) {
	            buffer += alpha.charAt(Math.round(Math.random() * alpha.length));
	          }
	          password.value = buffer;
	          password.setAttribute("type", "text");
	         
	      });
	   });
	 }
});