<!--<script type="text/javascript">-->

/* ###### Cette fonction est lancée à la fin du chargement de la page * $(function() { ##### */
$(document).ready(function() {

	var slide = false;
	var height = $('#prefooter_content').height();
	$('#prefooter_button').click(function () {
		var docHeight = $(document).height();
		var windowHeight = $(window).height();
		var scrollPos = docHeight - windowHeight + height;
		$('#prefooter_content').animate({ height: "toggle"}, 1000);
		if(slide == false) {
			if($.browser.opera) { //Fix opera double scroll bug by targeting only HTML.
				$('html').animate({scrollTop: scrollPos+'px'}, 1000);
			} else {
				$('html, body').animate({scrollTop: scrollPos+'px'}, 1000);
			}
                               slide = true;
                               $('#prefooter_button').text("Cacher le pied de page");
		} else {
                               slide = false;
                               $('#prefooter_button').text("Afficher le pied de page");
                       }
	});

	/* Déclaration des variables de toutes les variables */
	var txtSize = 11;
	var increase = 0;
	
	/* Agrandir la police */
	$(".augmenter_taille_police a").click(function () {
		if (increase < 3) {
			txtSize = txtSize+2;
			$("body").css("fontSize", txtSize+"px");
			$("iframe").each(function() {
				$(this).contents().find("body").css("fontSize", txtSize+"px");
			});
			increase++;
		}
		return false;
	});
	$(".diminuer_taille_police a").click(function () {
		if (increase > 0) {
			txtSize = txtSize-2;
			$("body").css("fontSize", txtSize+"px");
			$("iframe").each(function() {
				$(this).contents().find("body").css("fontSize", txtSize+"px");
			});
			increase--;
		}
		return false;
	});
	$(".impression_page a").click(function () {
		window.print();
		return false;
	});
	
	/* On remplace la classe "efface" par un display:none pour gérer correctement le fadeIn/fadeOut */
	$(".nav_deroulante_contenu").css("display", "none");
	$(".nav_deroulante").removeClass("efface");
	
/* ######################################################################################## */
/* ################################# GESTION DU MEGA DROPDOWN ############################# */
/* ######################################################################################## */

/* Définition de la fonction leave */
		function sortir() {
			$("#navigation_contenu").mouseleave(function() {
				$("#navigation_contenu .nav_deroulante").each(function() {
					$(this).children(".nav_deroulante_contenu").fadeOut(500);
					$('div.ombrage').css('display', "none");
				});
				$("#navigation_contenu .item_hover").each(function() {
					if (!$(this).hasClass("item_actif")) {
						$(this).removeClass("item_hover");
					}
				});
				$("#navigation_contenu .item_actif").each(function() {
					if (!$(this).hasClass("item_hover")) {
						$(this).addClass("item_hover");
					}
				});
			});
		};
		
/* Définition de la fonction hover */
		function dessus() {
			/**
			 * Au survol d'un item de la navigation :
			 *  - on ajoute une classe sur le parent
			 *  - on ajoute une classe sur le menu dropDown à afficher
			 *  - on positionne le menu dropDown à afficher par rapport au bas de la navigation
			 *  - on affiche le menu dropDown avec un effet de fondu
			 */
			var dropDown = $(this).siblings(".nav_deroulante");
			$("#navigation_contenu .nom_rubrique").removeClass("item_hover");
			dropDown.parent(".nom_rubrique").addClass("item_hover");
			dropDown.addClass("current_item");
			dropDown.css("top", $("#navigation_contenu").css("height"));
			dropDown.children(".nav_deroulante_contenu").fadeIn(500);
			dropDown.children(".nav_deroulante_contenu").css("display", "");

			
			if (!$('#navigation div.ombrage').length) {
				$('#navigation_contenu').after('<div class="ombrage"></div>');
			} else {
				$('div.ombrage').css('display', "");
			}
			/**
			 * On masque les autres menus qui ont pu être affiché avant
			 */
			$("#navigation_contenu .nav_deroulante").each(function() {
				if (!$(this).hasClass("current_item")) {
				$(this).children(".nav_deroulante_contenu").css("display", "none");
				}
			});
			/**
			 * A la fin du survol d'un item de la navigation :
			 *  - on supprime la classe current_item sur le menu dropDown à effacer
			 */
			var dropDown = $(this).siblings(".nav_deroulante");
			
			dropDown.removeClass("current_item");
		};
		
/*Variables de la fonction hoverIntent*/	
	var config = {
		over: dessus,
		timeout: 500,
		out: sortir
	};
	
	$(".item_nav_contenu").hoverIntent(config);	
	
});
	
/* ################################################################################# */
/* ################################# FIN MEGA DROPDOWN ############################# */
/* ################################################################################# */

