// Menu accordeon
$(document).ready( function (){
	// On cache les sous-menus sauf celui qui porte la classe "open_at_load" :
	$("div.detail:not('.open_at_load')").hide();
	$("div.news span").each( function () {
		var TexteSpan = $(this).text();
		$(this).replaceWith('<a href="" title="Afficher le sous-menu">' + TexteSpan + '</a>') ;
	}) ;

	$("div.news > a").click( function () {
		// Si le sous-menu etait deja ouvert, on le referme :
		if ($(this).next("div.detail:visible").length != 0) {
			$(this).next("div.detail").slideUp("normal", function () { $(this).parent().removeClass("open") } );
		}
		// Si le sous-menu est cache, on ferme les autres et on l'affiche :
		else {
			$("div.detail").slideUp("normal", function () { $(this).parent().removeClass("open") } );
			$(this).next("div.detail").slideDown("normal", function () { $(this).parent().addClass("open") } );
		}
		return false;
	});
}) ;

