//
// Make some part of the page (generally a header) togglable, so that
// clicking on it hides toggles the following element. The argument
// "header" is a jQuery object.
//
// José Alfredo Cañizo, 2009.
// 

function MakeTogglable(header) {
    // Clicking toggles the next element.

    header.click(function(event){
            $(event.currentTarget).next().slideToggle("slow");
        });

    // Add class names to each header, and initially hide them.

    header.addClass("toggle");
    header.next().hide();

    // Toggle the class name of headers when clicking.
    
    header.toggle(function(event){
            $(event.currentTarget).addClass("on");
        }, function(event){
            $(event.currentTarget).removeClass("on");
        });
    
}


//
// Execute when page has loaded.
//

// window.onload = function () {
//     PrepareToggleHeaders(3);
// }


