function menu_click(item) {
    var first = true;
    var node;

    for (var i=0; i<item.parentNode.childNodes.length; ++i) {
        node = item.parentNode.childNodes[i]
        if (node.className == "left_menu_item_sm") {
            if (node.style.display == "block") {
                node.style.display = "none";
            } else {
                node.style.display = "block";
            }
            if (first) {
                node.style.marginTop = "8px";
                node.style.borderTop = "1px solid black";
                node.style.paddingTop = "5px";
                first = false;
            }
        }
    }
    
    return false;
}

var currentPage = window.location.pathname.substring(window.location.pathname.lastIndexOf('/') + 1);

// -- Get a list of the pages in the menu
var menu = document.getElementById("left_menu_container");

if (menu != null) {
    var node = menu.firstChild;
    var subMenuNode = null;
    do {

        if (node.className == "left_menu_item_st") {
            subMenuNode = node;

            node = node.firstChild;

            do {
                if (node.className == "left_menu_item_sm") {
                    var content = node.firstChild;
                    while (content != null) {
                        var href = content.href;
                        if (href != null) {
                            if (currentPage == href.substring(href.lastIndexOf('/') + 1)) {
                                menu_click(node)
                            }
                        }
                        content = content.nextSibling
                    }
                }

                node = node.nextSibling;
            } while (node != null);

            node = subMenuNode;
        }


        node = node.nextSibling;
    } while (node != null);
}

function m_nav(p_location){
    location.href = (p_location);
}
