$(document).ready(function() {
    /*$(".accordeon:not('.open_loading')").hide();*/ // on cache tous les textes (blocs ayant la classe accordeon)

    // if specifique pour ouvrir le portlet "retrait au magasin" sur la homepage seulement
    if (document.location.pathname.toLowerCase().substring(0, 17) != "/pages/index.aspx"
        && document.location.pathname.toLowerCase().substring(0, 31) != "/pages/commercepanierfinal.aspx") {
        $(".portlet-livraison").hide().prev().children("a").removeClass("open");
    }
    
    $("#portlets h2 a").click(function() {
        // Si le sous-menu est affiché, on le cache :							
        if ($(this).parent().next("div:visible").length != 0) {
            $(this).parent().next("div").slideUp("fast", function() { $(this).prev().children("a").removeClass("open") });
        }
        // Si le sous-menu est cache, on l'affiche :
        else {
            $(this).parent().next("div").slideDown("fast", function() { $(this).prev().children("a").addClass("open") });
        }
        // On empêche le navigateur de suivre le lien :
        return false;
    });
});
