var obj = null;

function checkHover() {
	if (obj) {
		obj.find('dl').fadeOut('fast');	
	} //if
} //checkHover

$(document).ready(function() {
	$('#Nav > li').find('dl').hide();
	$('#Nav > li').hover(function() {
		if (obj) {
			obj.find('dl').slideUp('fast');
			obj = null;
		} //if
		
		$(this).find('dl').slideDown('fast');
	}, function() {
		obj = $(this);
		setTimeout("checkHover()", 0); // si vous souhaitez retarder la disparition, c'est ici
	});
    
    afficheAncre();
    // Remplacement de la fonction affCache
    $("[id^=pr]").hide();
    $("[class^=titre]").click(function() {
	$("[id^=pr]").hide();
	$("#"+$(this).attr("name")).show();
	goToByScroll("#"+$(this).attr("name"));
    });
    
    // Haut de page
    $(".top").click(function() {
	goToByScroll("#texte_middle");
    });
});

function goToByScroll(id){
    $('html,body').animate({scrollTop: $(id).offset().top},'slow');
}
/*
$(document).ready(function () {
	$("ul.menu_body li:even").addClass("alt");
	$("ul.menu_body_2 li:even").addClass("alt");

	$('#menu_deroulant').mouseover(function () {
		$('ul.menu_body').slideDown('200');
	    });

	$('#menu_deroulant').mouseout(function () {
		$('ul.menu_body').slideUp('200');
	    });

	$('#menu_deroulant_2').mouseover(function () {
		$('ul.menu_body_2').slideDown('200');
	    });

	$('#menu_deroulant_2').mouseout(function () {
		$('ul.menu_body_2').slideUp('200');
	    });

	afficheAncre();
    });
*/
function afficheAncre()
{
    //alert(document.URL);
    var pos = document.URL.indexOf('#');
    if (pos > 0)
	{
	    var ancre = document.URL.substr((pos + 1), 3);
	    affCache(ancre);
	}
}

function affCache(idpr)
{
    /* Fonction remplacee par du jquery
    var i = 1;
    while (document.getElementById("pr" + i))
	{
	    var pr = document.getElementById("pr" + i);
	    pr.style.display = "none";
	    i++;
	}
    var pr = document.getElementById(idpr);
    pr.style.display = "";
    */
    return true;
}

