$(document).ready(function() {
    $("a.showOrHideLink").attr("href","#");
    $("a.showOrHideLink").click( function() {
        var finder = $(this);
        var block = finder.next(".hideable");
        while (!block.length && finder.length) {
            finder = finder.parent();
            block = finder.next(".hideable");
        }
        if (block.length) {
            //initialize
            var showHide='hide';
            var effect=null;
            var duration=200;
            if (block.css('display')=='none') {
                showHide='show';
            }
            //switch class of block heading (if exists)
            var blockID=block.get(0).id;
            var heading=$("#"+blockID+"_h");
            //for any found heading (one or none) change class:
            heading.toggleClass("showing", showHide!='hide');
            heading.toggleClass("hidden", showHide=='hide'); 
            //animate block itself           
            block.animate({
                height: showHide,
                opacity: showHide
                }, duration, effect);
        };
        return false;
        //according to http://blog.reindel.com/2006/08/11/a-hrefjavascriptvoid0-avoid-the-void/
        //this should prevent the browser from evaluating the href and jumping to the top.
    });

    
    $.localScroll();
});

