$(document).ready(function() {
	initCorps();
	initBanniereEtMenu();
    });

function initBanniereEtMenu() {
    /*
     * Ici on peut mettre tout ce qui est dans la bannière ou le menu
     */
    
};


function initCorps() {
    /*
     * Ici on met tout ce qui est dans le corps du fichier, i.e. ce qui doit être rechargé
     */
    

    // Affichage des BibTeX

    $(".divBib").hide();
    $(".toggleBib").html(' [BIBTEX]');
    $(".toggleBib").attr('style',"text-decoration : none");
    $(".toggleBib").each(function(i) {
	    $(this).nextAll("div.divBib").load("affBib.php?bib="+$(this).attr("href"));
	    
	});
    
    $(".toggleBib").click( function(e) {
	    e.preventDefault();
	    var divsBib = $("div.divBib");
	    var leDiv = $(this).nextAll("div.divBib");
	   //  $(divsBib).each(function(i) {
// 		    $(this).addClass("divBibAnim");
// 		});
	    $(leDiv).removeClass("divBib");
	    $("div.divBib").slideUp();
	    $(leDiv).slideToggle(function() {
		    // $(divsBib).each(function(i) {
// 			    $(this).removeClass("divBibAnim");
// 			});
		    $(leDiv).addClass("divBib");
		});
	});

    // Affichage des dépliables
    $(".depliable").hide();
    
    
    $(".toggle").append(' <a class="onhover" href="">en savoir plus...</a>');
    $(".toggle .onhover").hide();
    
    $(".toggle").hover(function(t) {
	    $(this).children().filter(".onhover").show();
	   
	    
	}, function(t) {
	    $(this).children().filter(".onhover").hide();
	});

    $(".toggle .onhover").click( function(e) {
	    e.preventDefault();
	    var leDiv = $(this).parent().next(".depliable");
	    $(leDiv).slideToggle(function () {
		    if ($(this).css("display") == "none") {
			$(this).prev(".toggle").children(".onhover").html("en savoir plus...");
		    } else {
			$(this).prev(".toggle").children(".onhover").html("réduire...");
		    }
		    
		});
	});

}


