$(document).ready(function() {

// recupere le nom des classes des liens mois


//var chercheClasse = $("body.agenda ul#navdate li ul li a").attr("class");
 
/*page agenda*/
$('dd').hide();
$('dd.on').slideToggle(800);

$('dt').css("cursor","pointer").bind("click", function(){ $(this).next('dd').slideToggle(400); $(this).next('dd').next('dd').slideToggle(400); $("body.agenda dd").removeClass("on");
 });
//ICI CE QUI A ETE COUPE

// VOYAGE - LA CHARTE

$('div#actions p.spip').hide();

$('div#actions h3').click(function() {

$(this).next("p.spip").slideToggle(300).siblings("p.spip").slideUp("slow");

});


$('a.spip_out').attr('target','blank');

$('div.hideShow').hide();


$('a.hideShow').click(function() {
$(this).text($(this).text() == 'Plus' ? 'Moins' : 'Plus');
$(this).toggleClass("moins");
$(this).next("div.hideShow").slideToggle(300).siblings("div.hideShow").slideUp("slow");
$(this).prev("div.masque").slideUp(300).siblings("div.masque").slideDown("slow");
	
	
	if($('this').is(':shown')){
		$(this).prev("div.masque").hide();
		}
	else{
		$(this).prev("div.masque").show();

	}
	

return false;

});

/*################################PAGE VOYAGE################################*/
$('ul#mouse11 li').css("cursor","pointer");


$("ul#mouse11 li.num img").hover(
function() {
$(this).stop().animate({"opacity": "0"}, "fast");
},
function() {
$(this).stop().animate({"opacity": "1"}, "fast");
});


/*################################PAGE MISSION VOYAGE################################*/
$("body.mission div.num").hide();
$("body.mission div.num.ouvert").show();

$("body.mission ul#navpersonne li a").click(function () {
/*On clique sur un element de la nav, on cherche sa class pour afficher l'élément central(droite) correspondant*/
var chercheClasseNomzone = $(this).attr("class");
$("body.mission div.num").hide();
$('div.'+chercheClasseNomzone).toggle("fast");	
});   



/*
 * jQuery Mega Drop Down Menu script by Soh Tanaka
 * http://www.sohtanaka.com/web-design/mega-drop-downs-w-css-jquery/
 * 
 */
$(document).ready(function(){
		
	function megaHoverOver(){
		$(this).find(".sub").stop().fadeTo('fast', 1).show();
			
		//Calculate width of all ul's
		(function($) {
			jQuery.fn.calcSubWidth = function() {
				rowWidth = 0;
				//Calculate row
				$(this).find("ul").each(function() {					
					rowWidth += $(this).width(); 
				});	
			};
		})(jQuery); 
		
		if ( $(this).find(".row").length > 0 ) { //If row exists...
			var biggestRow = 0;	
			//Calculate each row
			$(this).find(".row").each(function() {							   
				$(this).calcSubWidth();
				//Find biggest row
				if(rowWidth > biggestRow) {
					biggestRow = rowWidth;
				}
			});
			//Set width
			$(this).find(".sub").css({'width' :biggestRow});
			$(this).find(".row:last").css({'margin':'0'});
			
		} else { //If row does not exist...
			
			$(this).calcSubWidth();
			//Set Width
			$(this).find(".sub").css({'width' : rowWidth});
			
		}
	}
	
	function megaHoverOut(){
	 $(this).find(".sub").stop().fadeTo('fast', 0, function() {
		  $(this).hide();
	  });
	}


	var config = {
		 sensitivity: 2,		// number = sensitivity threshold (must be 1 or higher)    
		 interval: 0, 			// number = milliseconds for onMouseOver polling interval    
		 over: megaHoverOver,   // function = onMouseOver callback (REQUIRED)    
		 timeout: 0, 			// number = milliseconds delay before onMouseOut    
		 out: megaHoverOut 		// function = onMouseOut callback (REQUIRED)    
	};

	$("ul#topnav li .sub").css({'opacity':'0'});
	$("ul#topnav li").hoverIntent(config);
	
	// Add class to the current element
	$("ul#topnav li").click(function(){
		$("ul#topnav").find("li.current").removeClass().removeAttr("class");
		$(this).addClass("current");
	});
	
	// Change arrow on hover
	$("li.liSub").hover(function(){
		$(this).find("span img").attr("src", "././prod/js/navigation/img/arrow_hover.png");
	},function(){
		$(this).find("span img").attr("src", "././prod/js/navigation/img/arrow.png");
	});
	
	// Delete the border for the last li of the submenu
	$("ul#topnav .sub ul li:last-child a").css("border", "none");

});

});






