$(document).ready(function(){
						   
	// fadeIn/fadeOut du footer
	
	$("#footer")
	.css("opacity","0.25")
	.bind("mouseover", function(){
		$(this).stop();
		$(this).fadeTo("normal", 1);
	})
	.bind("mouseout", function(){
		$(this).stop();
		$(this).fadeTo("normal", 0.25);
	});
	
	// ---------
	
	
	// gestion automatique des roll over sur toutes les images de type _n./_o. + pré-loading
	/*
	$("img[src*='_n.']")
	.one("load",function(){
		var img_off = $(this).attr("src");
		var img_on = img_off.replace("_n.","_o.");
		$(this).data("img_off", img_off);
		$(this).data("img_on", img_on);
		
		var img = new Image();
		img.src=img_on;
	})
	.mouseover(function(){
		$(this).attr("src",$(this).data("img_on"));
	})
	.mouseout(function(){
		$(this).attr("src",$(this).data("img_off"));
	});
	*/
	$("img[src*='_n.']")
	.mouseover(function(){
		var img_off = $(this).attr("src");
		var img_on = img_off.replace("_n.","_o.");
		$(this).attr("src", img_on);
	})
	.mouseout(function(){
		var img_on = $(this).attr("src");
		var img_off = img_on.replace("_o.","_n.");
		$(this).attr("src", img_off);
	});


	
	// ---------
	
	$('#chapeau a')
	.bind("click", function(){
		var cible = "#textes";
		if($(cible).data("etat") == "close" || !$(cible).data("etat")){
			$(cible).slideDown("normal");
			$(cible).data("etat","open");
		}else{
			$(cible).slideUp("normal");
			$(cible).data("etat","close");
		}
	});
	$('#manifesto_lien a, #manifesto_textes a.close')
	.bind("click", function(){
		var cible = "#manifesto_textes";
		var cible_close = "#choose_textes";
		if($(cible).data("etat") == "close" || !$(cible).data("etat")){
			$(cible_close).slideUp("normal");
			$(cible_close).data("etat","close");
			$(cible).slideDown("normal");
			$(cible).data("etat","open");
		}else{
			$(cible).slideUp("normal");
			$(cible).data("etat","close");
		}
	});
	
	$('#choose_lien a, #choose_textes a.close')
	.bind("click", function(){
		var cible = "#choose_textes";
		var cible_close = "#manifesto_textes";
		if($(cible).data("etat") == "close" || !$(cible).data("etat")){
			$(cible_close).slideUp("normal");
			$(cible_close).data("etat","close");
			$(cible).slideDown("normal");
			$(cible).data("etat","open");
		}else{
			$(cible).slideUp("normal");
			$(cible).data("etat","close");
		}
	});


	//FORMULAIRE
	$(".submit").click(function() {
		
		var mail = $("input[name='mail']").val();
		var message = $("textarea[name='message']").val();
		$("#loading").show();
		$(".submit").hide();
		
		$.ajax({
			type: "POST",
			async: false,
			url: "action_contact.php",
			data: "mail="+mail+"&message="+message,
			success: function(msg){
				$("#loading").hide();
					if(msg == 'Mail sent !'){
						$("input[name='mail']").val('');
						$("textarea[name='message']").val('');
						$("#confirm").html('<div>'+ msg +'</div>');
						$("#erreur").html('');
					}
					else {
						$("#confirm").html('');
						$("#erreur").html(msg);
					}
				$(".submit").show();
			}
		});
		return false;
	});


});


DD_belatedPNG.fix('.meet_agency img');
