function afficher_menu()
{
	var idListeEspaceDrapeaux = "liste-espaces-drapeaux";
	if(document.getElementById(idListeEspaceDrapeaux).style.display == "none")
	{
		document.getElementById(idListeEspaceDrapeaux).style.display = "block";
	}
	else
	{
		document.getElementById(idListeEspaceDrapeaux).style.display = "none";
	}
}

function printConseiller() {
	printObj('infoConseiller');
}

function printFilm() {
	printObj('fichefilm');
}

function printObj(className){
	
	//var prtContent = '<html><head><link type="text/css" href="/portail/themes/html/PGSI-05-SFA/style/mri-nosconseiller.css" rel="stylesheet"></head><body><div class="infoConseiller">';
	var prtContent = '<html><head><link type="text/css" href="/portail/themes/html/PGSI-05-SFA/style/mri.css" rel="stylesheet"><style type="text/css">body {background: none;}</style></head><body><div class="' + className + '">';
	
	//var prtContent = '<DIV style="Z-INDEX: 0">';
	//prtContent = prtContent + document.all[whatToPrint].innerHTML;
	//prtContent = prtContent + $("#infoConseiller").html();
	 //$(".infoConseiller").each(function (i) {
	 var l_className = "." + className;
	// alert('ma classe: ' + l_className);
	 $(l_className).each(function (i) {
	 //	alert($(this).parents("#TB_ajaxContent").html());
        if ($(this).parents("#TB_ajaxContent").is(":visible")) {
        	prtContent = prtContent + $(this).html();
          //alert($(this).children(".moreInfoTitle").children(".moreInfoNom").html() + "je le vois");
		}
		
      });
	
	
	
	//prtContent = prtContent + '</DIV>';
	prtContent = prtContent + '</div></body></html>';
	
	var WinPrint = window.open('Impression', null, "height=330,width=550,toolbar=no,scrollbars=yes,status=no");
	
	WinPrint.document.write(prtContent);
	WinPrint.document.close();
	WinPrint.focus();
	WinPrint.print();
	WinPrint.close();
}

$(document).ready(function() {
	/** Code pour menu qui se retracte **/
	
	function menuAnimationClick() {
        $("ul.open").slideUp("normal");
		$("ul.open").removeClass();
		/*$(this).parent("li").children("ul:first").slideDown("normal");*/
		$(this).parent("li").children("ul:first").slideDown( "normal", function() 
		{
			$(this).css( { background:"transparent url(../images/bullet.gif) no-repeat scroll 0 5px;" } );
		} );

		
		
		$(this).parent("li").children("ul:first").addClass("open");

		//Ici je m'assure de tout rebinder
		$(".menubody ul li").children("h4").unbind("click");
		$(".menubody ul li").children("h4").click(menuAnimationClick);
		
		//Ici je valide si il est deja ouvert je fais rien.
		$(this).unbind("click");
	}
	
	//Ici je met la class ouverte si il y a deja une catégorie ouverte
	$(".menubody ul li.select-has-child").children("ul:first").addClass("open");
	
	// Je bind mes onClick
	$(".menubody ul li").children("h4").unbind("click");
	$(".menubody ul li").children("h4").click(menuAnimationClick);
	$(".menubody ul li.select-has-child h4").unbind("click");
	/** Code pour le bandeau promo rotatif **/
	
	$('.promo-rotatif').innerfade(
		{ 
			speed: 'slow', 
			timeout: 5000
		}
	); 
	
	/*** menu accordeon special ***/
 	jQuery("#ui-accordion").accordion({ 
	    	autoHeight: false,
	    	header: 'div.clickable-header'
    	});
    
	$('div.clickable-header h2').each(function(){
		var ah = $(this).innerHeight();
		var ph = $(this).parent().height();
		var mh = (ph - ah) / 2;
		$(this).css('padding-top', mh);
	});
	
	function menuMouseOver(e) {
		p = $(this).parent();
		
		p.find(".clickable-header").addClass("clickable-header-over");
		p.find(".menu-bottom").addClass("menu-bottom-over");
	}
	
	function menuMouseOut(e) {
		p = $(this).parent();
		
		p.find(".clickable-header").removeClass("clickable-header-over");
		p.find(".menu-bottom").removeClass("menu-bottom-over");
	}
	
	$('div.clickable-header').mouseover(menuMouseOver);
	$('div.clickable-header').mouseout(menuMouseOut);
	$('div.menu-bottom').mouseover(menuMouseOver);
	$('div.menu-bottom').mouseout(menuMouseOut);
	/*******************************/
});


