﻿function getNextSibling(startBrother) {
    endBrother = startBrother.nextSibling;
    while (endBrother != null && endBrother.nodeType != 1) {
        endBrother = endBrother.nextSibling;
    }
    return endBrother;
}

function getFirstChild(elm) {
    if (!elm.childNodes.length) {
        return null;
    }
    var children = elm.childNodes.length;
    for (var i = 0; i <= children; ++i) {
        if (elm.childNodes[i].nodeType == 1) {
            return elm.childNodes[i];
        }
    }
    return null;
}
var LeftMenuCollapseUrl = "/Images/menuicons/Collapse.gif";
var LeftMenuExpandUrl = "/Images/menuicons/Expand.gif";

function lmX(clickedNode) {
    var p = clickedNode.parentNode;
    var lmchild = getNextSibling(p);
    var disp = lmchild.style.display;
    var a = getFirstChild(p);
    var img = getFirstChild(a);
    if (disp == '' || disp == 'none') {
        lmchild.style.display = 'block';
        img.src = LeftMenuCollapseUrl;
    } else {
        lmchild.style.display = 'none';
        img.src = LeftMenuExpandUrl;
    }
    return false;
}

