window.onload = function() {
    
    // {{{ catalog collapse / expand 
    var catItems = document.getElementById("catalog-tree");
    for (var index = 0, nodesCount = catItems.childNodes.length; index < nodesCount; index++)
    {
        var item = catItems.childNodes[index];
        if (!item.tagName || item.tagName.toLowerCase() != "li")
        {
            continue;
        }
        var link = item.getElementsByTagName("A")[0];
        link.onclick = function() {
            if ("opened" == this.parentNode.className)
            {
                this.parentNode.className = "";
            }
            else
            {
                this.parentNode.className = "opened";
            }
            return false;
        }
    }
    // }}}
}