// lorsque le document est charge totalement
$(document).ready(function() {
		
/* =============== menu =============== */
	$(".menu a").hover(
		function() {
			var img_act = $(this).children("img").attr("src");
  		var img_hov = img_act.replace("_of","_on");
  		$(this).children("img").attr("src",img_hov);
		},
		function() {
			var img_act = $(this).children("img").attr("src");
  		var img_hov = img_act.replace("_on","_of");
  		$(this).children("img").attr("src",img_hov);
		}
	);

/* =============== validation form =============== */
	$("#commentForm").validate({
		rules: {
			name: "required",
			email: {
				required: true,
				email: true
			},
			comment: {
				required: true,
				minlength: 10
			},
			agree: "required"
		},
		messages: {
			name: "Nom manquant",
			email: "Adresse email invalide",
			comment: "10 caractères minimum"
		},
		highlight: function(element, error) {
     $(element).addClass(error);
  	},
  	unhighlight: function(element, error) {
    	$(element).removeClass(error);
  	},
		submitHandler: function(form) {
  		jQuery(form).ajaxSubmit({
  			target: "#result",
  			clearForm: true
  		});
  	}
  });
	
});
