$(document).ready(function(){

	$("body.HideNav #navFormation ul").hide();
	$("body:not(#accueil) #navFormation h2 a").click(function(){
		$("#navFormation ul").slideToggle("fast");
	});
	$("body:not(#accueil) #navFormation").hover(function() {
		// Stuff to do when the mouse enters the element;
	}, function() {
		$("body:not(#accueil) #navFormation ul").slideUp("fast");
	});
	
	//Parcours de compétences,modules,  outils de formation et processus  pages Industrie et Service
	if (window.location.href.match("ancre_parcours")) {
		var tab = window.location.href.split("#");
		$( "#ancre0").parent().next().show();
		$( "#" + tab[1] ).parent().next().show();
	}
	if (window.location.href.match("ancre_processus")) {
		var tab = window.location.href.split("#");
		$( "#ancre1111").parent().next().show();
		$( "#" + tab[1] ).parent().parent().parent().parent().next().show();
	}
	if (window.location.href.match("ancre")) {
		var tab = window.location.href.split("#");
		$( "#" + tab[1] ).parent().next().show();
	}
	$(".lienParcours").click(function(){
		if (($(this).parent().next().css("display") == "none")) {
			$(".Tabformation2").css("display","none");
		}
		$.id = $(this).attr("id");
		$(this).parent().next().slideToggle("slow",function(){
			var link = window.location.href.split("#");
			if ($(this).is(':hidden')) {
				window.location.href= link[0] +"#ancre0";
			}
			//window.location.href= link[0] + "#" + $.id;
		});
		//return false;
	});
	$(".lienProcessus").click(function(){
		if (($(this).parent().parent().parent().parent().next().css("display") == "none")) {
			$(".Tabformation2").css("display","none");
		}
		$.id = $(this).attr("id");
		$(this).parent().parent().parent().parent().next().slideToggle("slow",function(){
			var link = window.location.href.split("#");
			if ($(this).is(':hidden')) {
				window.location.href= link[0] +"#ancre1111";
			}
			//window.location.href= link[0] + "#" + $.id;
		});
		//return false;
	});
	$(".lienRubrique").click(function(){
		if (($(this).parent().next().css("display") == "none")) {
			$(".TabRubrique").css("display","none");
			$(".Tabformation2").css("display","none");
		}
		$(this).parent().next().slideToggle("slow",function(){
			
			var link = window.location.href.split("#");
			if (($(this).is(':hidden'))) {
				window.location.href= link[0] + "#";
			} else {
				//window.location.href= link[0] + "#" + id;
			}
			//window.location.href= "#" + $(this).attr('id');
		});
		//return false;
	});	




});
