$(function(){
	$("div#header div.menu ul li").hover(function(){
		$(this).children("ul").show();
	}, function(){
		$(this).children("ul").hide();
	});
	
	$("a.click_false").click(function(){
		return false;
	});
	
	validate = function(form) {
		var nobug = true;
		var msg = "";
		var tableau = new Array( true,"","" );	
		var errors = "";

		$(form).find("input[required=true]").each(function(e){
			var format = $(this).attr("format");
			var input_id = $(this).attr("id");
			var message = $(this).attr("message");

			switch(format) {
				case "string":
					est_la(input_id, tableau, message+" /", input_id+" /");
					break;

				case "email":
					var message2 = $(this).attr("message2");

					est_la(input_id, tableau, message+" /", input_id+" /");
					est_courriel_valide(input_id, tableau, message2+" /", input_id+" /");
					break;
			}
		});

		if(tableau[0]==false) {
			var aMSG = tableau[1].split(" /");
			var aFIELD = tableau[2].split(" /");

			for( var i = 0; i < aMSG.length; i++ ) {
				if(aMSG[i]!="") {
					errors += "<li>"+aMSG[i]+"</li>";
				}
			}
			
			$(form).find("ul.errors").each(function(e){
				$(this)
					.html(errors)
					.slideDown(500);
			});
			
			return false;
		} else {
			$(form).find("ul.errors").each(function(e){
				$(this)
					.html("")
					.slideUp(500);
			});

			return true;
		}
	};
});
