call the function loadTree(treeviewId) when body is loaded

<body onload="loadTree('tvSelect')">
function loadTree(id) {
    if (navigator.appName != "Netscape")
        return;

    var treeClientId = id;
    var tree = document.getElementById(id);
    document.write("<script language=\"javascript\" src=\"TreeView.htc.js\"></script>");

    /*------------------------------------ proterty define ----------------------------------------------*/
    /*<public:property name="clickedNodeIndex" GET="getClickedNodeIndex" />
    <public:property name="defaultStyle" id="_tvpropDefaultStyle" GET="getDefaultStyle" PUT="setDefaultStyle" />
    <public:property name="hoverStyle" id="_tvpropHoverStyle" GET="getHoverStyle" PUT="setHoverStyle" />
    <public:property name="selectedStyle" id="_tvpropSelectedStyle" GET="getSelectedStyle" PUT="setSelectedStyle" />
    <public:property name="childType" id="_tvpropChildType" GET="getChildType" PUT="setChildType" />
    <public:property name="imageUrl" id="_tvpropImageUrl" GET="getImageUrl" PUT="setImageUrl" />
    <public:property name="expandedImageUrl" id="_tvpropExpandedImageUrl" GET="getExpandedImageUrl" PUT="setExpandedImageUrl" />
    <public:property name="selectedImageUrl" id="_tvpropSelectedImageUrl" GET="getSelectedImageUrl" PUT="setSelectedImageUrl" />
    <public:property name="target" id="_tvpropTarget" GET="getTarget" PUT="setTarget" />
    <public:property name="treeNodeSrc" id="_tvpropTreeNodeSrc" GET="getTreeNodeSrc" PUT="setTreeNodeSrc" />
    <public:property name="treeNodeXsltSrc" id="_tvpropTreeNodeXsltSrc" GET="getTreeNodeXsltSrc" PUT="setTreeNodeXsltSrc" />
    <public:property name="selectExpands" id="_tvpropSelectExpands" GET="getSelectExpands" PUT="setSelectExpands" />
    <public:property name="expandLevel" id="_tvpropExpandLevel" GET="getExpandLevel" PUT="setExpandLevel" />
    <public:property name="autoSelect" id="_tvpropAutoSelect" GET="getAutoSelect" PUT="setAutoSelect" />
    <public:property name="treeNodeTypeSrc" id="_tvpropTreeNodeTypeSrc" GET="getTreeNodeTypeSrc" PUT="setTreeNodeTypeSrc" />
    <public:property name="showLines" id="_tvpropShowLines" GET="getShowLines" PUT="setShowLines" />
    <public:property name="showPlus" id="_tvpropShowPlus" GET="getShowPlus" PUT="setShowPlus" />
    <public:property name="showToolTip" id="_tvpropShowToolTip" GET="getShowToolTip" PUT="setShowToolTip" />
    <public:property name="indent" id="_tvpropIndent" GET="getIndent" PUT="setIndent" />
    <public:property name="selectedNodeIndex" id="_tvpropSelectedNodeIndex" GET="getSelectedNodeIndex" PUT="setSelectedNodeIndex" />
    <public:property name="systemImagesPath" id="_tvpropSystemImagesPath" GET="getSystemImagesPath" PUT="setSystemImagesPath" />*/

    var Method_clickedNodeIndex = {
        get: function () {
            return getClickedNodeIndex();
        }
    }

    var Method_defaultStyle = {
        get: function () {
            return getDefaultStyle();
        },
        set: function (val) {
            setDefaultStyle(val);
        }
    }

    var Method_hoverStyle = {
        get: function () {
            return getHoverStyle();
        },
        set: function (val) {
            setHoverStyle(val);
        }
    }

    var Method_selectedStyle = {
        get: function () {
            return getSelectedStyle();
        },
        set: function (val) {
            setSelectedStyle(val);
        }
    }

    var Method_childType = {
        get: function () {
            return getChildType();
        },
        set: function (val) {
            setChildType(val);
        }
    }

    var Method_imageUrl = {
        get: function () {
            return getImageUrl();
        },
        set: function (val) {
            setImageUrl(val);
        }
    }

    var Method_expandedImageUrl = {
        get: function () {
            return getExpandedImageUrl();
        },
        set: function (val) {
            setExpandedImageUrl(val);
        }
    }

    var Method_selectedImageUrl = {
        get: function () {
            return getSelectedImageUrl();
        },
        set: function (val) {
            setSelectedImageUrl(val);
        }
    }

    var Method_expandedImageUrl = {
        get: function () {
            return getExpandedImageUrl();
        },
        set: function (val) {
            setExpandedImageUrl(val);
        }
    }

    var Method_target = {
        get: function () {
            return getTarget();
        },
        set: function (val) {
            setTarget(val);
        }
    }

    var Method_treeNodeSrc = {
        get: function () {
            return getTreeNodeSrc();
        },
        set: function (val) {
            setTreeNodeSrc(val);
        }
    }

    var Method_treeNodeXsltSrc = {
        get: function () {
            return getTreeNodeXsltSrc();
        },
        set: function (val) {
            setTreeNodeXsltSrc(val);
        }
    }

    var Method_selectExpands = {
        get: function () {
            return getSelectExpands();
        },
        set: function (val) {
            setSelectExpands(val);
        }
    }

    var Method_expandLevel = {
        get: function () {
            return getExpandLevel();
        },
        set: function (val) {
            setExpandLevel(val);
        }
    }

    var Method_autoSelect = {
        get: function () {
            return getAutoSelect();
        },
        set: function (val) {
            setAutoSelect(val);
        }
    }

    var Method_treeNodeTypeSrc = {
        get: function () {
            return getTreeNodeTypeSrc();
        },
        set: function (val) {
            setTreeNodeTypeSrc(val);
        }
    }
    var Method_showLines = {
        get: function () {
            return getShowLines();
        },
        set: function (val) {
            setShowLines(val);
        }
    }

    var Method_showPlus = {
        get: function () {
            return getShowPlus();
        },
        set: function (val) {
            setShowPlus(val);
        }
    }

    var Method_showToolTip = {
        get: function () {
            return getShowToolTip();
        },
        set: function (val) {
            setShowToolTip(val);
        }
    }

    var Method_selectedNodeIndex = {
        get: function () {
            return getSelectedNodeIndex();
        },
        set: function (val) {
            setSelectedNodeIndex(val);
        }
    }

    var Method_indent = {
        get: function () {
            return getIndent();
        },
        set: function (val) {
            setIndent(val);
        }
    }

    var Method_systemImagesPath = {
        get: function () {
            return getSystemImagesPath();
        },
        set: function (val) {
            setSystemImagesPath(val);
        }
    }

    if (!HTMLDivElement.prototype.hasOwnProperty("clickedNodeIndex")) {
        Object.defineProperty(HTMLDivElement.prototype, "clickedNodeIndex", Method_clickedNodeIndex);
    }

    if (!HTMLDivElement.prototype.hasOwnProperty("defaultStyle")) {
        Object.defineProperty(HTMLDivElement.prototype, "defaultStyle", Method_defaultStyle);
    }

    if (!HTMLDivElement.prototype.hasOwnProperty("hoverStyle")) {
        Object.defineProperty(HTMLDivElement.prototype, "hoverStyle", Method_hoverStyle);
    }

    if (!HTMLDivElement.prototype.hasOwnProperty("selectedStyle")) {
        Object.defineProperty(HTMLDivElement.prototype, "selectedStyle", Method_selectedStyle);
    }

    if (!HTMLDivElement.prototype.hasOwnProperty("childType")) {
        Object.defineProperty(HTMLDivElement.prototype, "childType", Method_childType);
    }

    if (!HTMLDivElement.prototype.hasOwnProperty("imageUrl")) {
        Object.defineProperty(HTMLDivElement.prototype, "imageUrl", Method_imageUrl);
    }

    if (!HTMLDivElement.prototype.hasOwnProperty("expandedImageUrl")) {
        Object.defineProperty(HTMLDivElement.prototype, "expandedImageUrl", Method_expandedImageUrl);
    }

    if (!HTMLDivElement.prototype.hasOwnProperty("selectedImageUrl")) {
        Object.defineProperty(HTMLDivElement.prototype, "selectedImageUrl", Method_selectedImageUrl);
    }

    if (!HTMLDivElement.prototype.hasOwnProperty("target")) {
        Object.defineProperty(HTMLDivElement.prototype, "target", Method_target);
    }

    if (!HTMLDivElement.prototype.hasOwnProperty("treeNodeSrc")) {
        Object.defineProperty(HTMLDivElement.prototype, "treeNodeSrc", Method_treeNodeSrc);
    }

    if (!HTMLDivElement.prototype.hasOwnProperty("treeNodeXsltSrc")) {
        Object.defineProperty(HTMLDivElement.prototype, "treeNodeXsltSrc", Method_treeNodeXsltSrc);
    }

    if (!HTMLDivElement.prototype.hasOwnProperty("showLines")) {
        Object.defineProperty(HTMLDivElement.prototype, "showLines", Method_showLines);
    }

    if (!HTMLDivElement.prototype.hasOwnProperty("showPlus")) {
        Object.defineProperty(HTMLDivElement.prototype, "showPlus", Method_showPlus);
    }

    if (!HTMLDivElement.prototype.hasOwnProperty("showLines")) {
        Object.defineProperty(HTMLDivElement.prototype, "showLines", Method_showLines);
    }

    if (!HTMLDivElement.prototype.hasOwnProperty("showToolTip")) {
        Object.defineProperty(HTMLDivElement.prototype, "showToolTip", Method_showToolTip);
    }

    if (!HTMLDivElement.prototype.hasOwnProperty("indent")) {
        Object.defineProperty(HTMLDivElement.prototype, "indent", Method_indent);
    }

    if (!HTMLDivElement.prototype.hasOwnProperty("selectedNodeIndex")) {
        Object.defineProperty(HTMLDivElement.prototype, "selectedNodeIndex", Method_selectedNodeIndex);
    }

    if (!HTMLDivElement.prototype.hasOwnProperty("systemImagesPath")) {
        Object.defineProperty(HTMLDivElement.prototype, "systemImagesPath", Method_systemImagesPath);
    }

    /* -------------------------------------------  event ----------------------------------------- */
    /* <public:component tagname=treeview literalcontent=true>
    <public:attach event=oncontentready onevent="oncontentready()" />
    <public:attach event=ondocumentready onevent="ondocumentready()" />
    <public:attach event="onscroll" onevent="onScroll()" />
    <public:event name="onexpand" id="_tvevtExpand" />
    <public:event name="oncollapse" id="_tvevtCollapse" />
    <public:event name="onselectedindexchange" id="_tvevtSelect" />
    <public:event name="oncheck" id="_tvevtCheck" />
    <public:event name="onfirequeuedevents" id="_tvevtFireQueuedEvents" />
    <public:event name="onnodebound" id="_tvevtNodeBound" />
    <public:event name="onnodetypesbound" id="_tvevtNodeTypesBound" />
    <public:event name="onhover" id="_tvevtHover" />
    <public:event name="onunhover" id="_tvevtUnhover" />*/
    tree.addEventListener("oncontentready", oncontentready);
    tree.addEventListener("ondocumentready", ondocumentready);
    tree.addEventListener("onscroll", onscroll);

    /* -------------------------------------------  method ----------------------------------------- */
    /*
    <public:method name="queueEvent" />
    <public:method name="getTreeNode" />
    <public:method name="addAt" />
    <public:method name="createTreeNode" />
    <public:method name="getTreeNodeType" />
    <public:method name="createTreeNodeType" />
    <public:method name="addTreeNodeType" />
    <public:method name="add" />
    <public:method name="databind" />
    <public:method name="databindTypes" />
    <public:method name="getChildren" />*/

}

TreeView.Chrome.js

var contentNode;
var treeviewNode;
var g_typesNode;
var g_styles;
var g_event;
;
var g_nodeClicked = null;
var g_strQueuedEvents = "";
var g_bInteractive = false;
;
var g_selectedNodeBeforeDelay = "";
var g_bFocus = false;
var g_bCreated = false;
var g_typeIsland = null;
var g_bNodesReady = false;
var g_bTypesReady = false;
var g_bMouseDown = false;
);
);
;
var g_bLock = false;
var g_bInTypesBoundEvent = false;
var L_strMSXMLError_Text = "创建 MSXML 对象发生错误。请确认您的计算机上已安装 MSXML 库。";
var L_strRetrievingNodes_Text = "检索节点...";
var L_strXMLError_Text = "加载 XML 文件 %s 发生错误";
var L_strInvalidXML_Text = "%s 中的 XML 无效";
var L_strXSLTError_Text = "或 %s 中的 XML 不受支持";
var L_fontSize_Text = "9pt";
var L_fontName_Text = "宋体";
var L_strToolTip_Text = "用 +/- 来扩展/折叠";
var prop_defaultStyle = null;
var prop_hoverStyle = null;
var prop_selectedStyle = null;
var prop_childType = null;
var prop_imageUrl = null;
var prop_expandedImageUrl = null;
var prop_selectedImageUrl = null;
var prop_target = null;
var prop_treeNodeSrc = null;
var prop_treeNodeXsltSrc = null;
var prop_selectExpands = null;
;
var prop_autoSelect = false;
var prop_treeNodeTypeSrc = null;
var prop_showLines = true;
var prop_showPlus = true;
var prop_showToolTip = true;
;
var prop_selectedNodeIndex = null;
var prop_systemImagesPath = null;
function queueEvent(strEvent, strParams) {
    )
        g_strQueuedEvents += ";";
    g_strQueuedEvents += (strEvent + "," + strParams);
    setHiddenHelperValue();
}
function getQueuedEvents() {
    return g_strQueuedEvents;
}
function fireQueuedEvents() {
    if (g_strQueuedEvents != "") {
        if (getAttribute("onfirequeuedevents") != null) {
            ) {
                window.clearTimeout(g_timer);
                autoSelect();
            }
            else {
                g_bInteractive = false;
                g_numStop = ;
                _tvevtFireQueuedEvents.fire();
            }
        }
    }
}
function SetAnchorClass(node, name) {
    var strStyle = "";
    var lname = name.toLowerCase();
    strStyle += cascadeStyle(getParentTreeNode(node), "defaultstyle");
    if (lname != "defaultstyle") {
        var str = cascadeStyle(getParentTreeNode(node), lname);
        if (str != null) {
            strStyle += ";" + str;
        }
    }
    node.style.cssText = strStyle;
    if (lname == "hoverstyle" && g_bFocus == false)
        blurFilter(node);
    node.className = lname;
}
function getParentTreeNode(node) {
    var el = node;
    while (el != null && el.getAttribute("treenode") == null)
        el = el.parentElement;
    return el.getAttribute("treenode");
}
function HoverNode(textnode) {
    var node;
    if (textnode.tagName.toLowerCase() == "treenode")
        node = textnode.subtree.all.item();
    else
        node = textnode;
    var nodeIndex = getNodeIndex(getParentTreeNode(node));
    if (node.className == "defaultstyle") {
        SetAnchorClass(node, "hoverstyle");
        HoverNodeIndex = nodeIndex;
    }
    else if (node.className != "hoverstyle")
        HoverNodeIndex = "";
    e = element.document.createEventObject();
    e.treeNodeIndex = nodeIndex;
    _tvevtHover.fire(e);
    setHiddenHelperValue();
}
function UnhoverNode(textnode) {
    if (textnode != null) {
        var node;
        if (textnode.tagName.toLowerCase() == "treenode")
            node = textnode.subtree.all.item();
        else
            node = textnode;
        if (node.className == "hoverstyle") {
            SetAnchorClass(node, "defaultstyle");
        }
        e = element.document.createEventObject(event);
        if (HoverNodeIndex == "")
            e.treeNodeIndex = getNodeIndex(getParentTreeNode(node))
        else
            e.treeNodeIndex = HoverNodeIndex;
        _tvevtUnhover.fire(e);
        HoverNodeIndex = "";
        setHiddenHelperValue();
    }
}
function mOver() {
    if (g_bInteractive == true) {
        );
        )
            UnhoverNode(getNodeFromIndex(HoverNodeIndex));
        HoverNode(oItem);
    }
}
function mOut() {
    if (g_bInteractive == true) {
        var node = this.parentElement.treenode;
        var nodeIndex = getNodeIndex(node)
        if (nodeIndex == HoverNodeIndex) {
            UnhoverNode(node);
            window.status = window.defaultStatus;
        }
        else if (nodeIndex == selectedNodeIndex) {
            e = element.document.createEventObject(event);
            e.treeNodeIndex = nodeIndex;
            _tvevtUnhover.fire(e);
        }
    }
}
function onkeydown() {
    if (!g_bInteractive)
        return;
    if (event.altKey == true)
        return;
    var oldNode;
    var hoverNode = null;
    ) {
        oldNode = getNodeFromIndex(HoverNodeIndex);
        hoverNode = oldNode;
    }
    else
        oldNode = getNodeFromIndex(selectedNodeIndex);
    switch (event.keyCode) {
        :
            if (event.shiftKey != true)
                break;
        :
            if (oldNode.getAttribute("expanded") != true) {
                doNodePlusMinusClick(oldNode);
                fireQueuedEvents();
            }
            event.returnValue = false;
            break;
        :
            if (event.shiftKey == true)
                break;
        :
            if (oldNode.getAttribute("expanded") == true) {
                doNodePlusMinusClick(oldNode);
                fireQueuedEvents();
            }
            event.returnValue = false;
            break;
        :
            event.returnValue = false;
            ) {
                var exp = getNodeAttribute(oldNode, "expandable");
                if (exp == null && oldNode.getAttribute("TreeNodeSrc") != null)
                    exp = "checkOnce";
                if (oldNode.getAttribute("expanded") == true || !(exp == "always" || (exp == "checkOnce" && oldNode.getAttribute("checkedExpandable") != true)))
                    break;
            }
            if (oldNode.getAttribute("expanded") != true) {
                doNodePlusMinusClick(oldNode);
                updateStatus(oldNode);
                fireQueuedEvents();
                break;
            }
        :
            var node = getNextVisibleNode(oldNode);
            if (node != null) {
                if (element.getAttribute("autoselect") == true) {
                    selectNode(node, true);
                    updateStatus(node);
                    UnhoverNode(hoverNode);
                }
                else {
                    UnhoverNode(oldNode);
                    HoverNode(node);
                    changeFocus(node, oldNode);
                    updateStatus(node);
                }
                scrollTree(node);
            }
            event.returnValue = false;
            break;
        :
            if (oldNode.getAttribute("expanded") == true) {
                doNodePlusMinusClick(oldNode);
                fireQueuedEvents();
            }
            else {
                var node = oldNode.parentElement;
                , ).toLowerCase() != "tree")
                    node = node.parentElement;
                if (node.tagName.toLowerCase() == "treenode") {
                    if (element.getAttribute("autoselect") == true) {
                        selectNode(node, true);
                        updateStatus(node);
                        UnhoverNode(hoverNode);
                    }
                    else {
                        UnhoverNode(oldNode);
                        HoverNode(node);
                        changeFocus(node, oldNode);
                        updateStatus(node);
                    }
                    scrollTree(node);
                }
            }
            event.returnValue = false;
            break;
        :
            var node = getPreviousVisibleNode(oldNode);
            if (node != null) {
                if (element.getAttribute("autoselect") == true) {
                    selectNode(node, true);
                    updateStatus(node);
                    UnhoverNode(hoverNode);
                }
                else {
                    UnhoverNode(oldNode);
                    HoverNode(node);
                    changeFocus(node, oldNode);
                    updateStatus(node);
                }
                scrollTree(node);
            }
            event.returnValue = false;
            break;
        :
            );
            if (cb != null) {
                cb.setAttribute();
                doCheckboxClick(oldNode);
                fireQueuedEvents();
            }
            event.returnValue = false;
            break;
        :
            doNodeClick(oldNode)
            if (!navigateNode(oldNode)) {
                if (element.getAttribute("selectExpands") == true)
                    doNodePlusMinusClick(oldNode);
                fireQueuedEvents();
            }
            event.returnValue = false;
            break;
    }
}
function changeFocus(node, oldNode) {
    );
    accessnode.tabindex = ;
    accessnode.focus();
    accessnode = oldNode.subtree.all.item();
    accessnode.tabindex = -;
}
function updateStatus(node) {
    var href = node.getAttribute("navigateurl");
    if (href != null)
        window.status = href;
    else
        window.status = window.defaultStatus;
}
function onstop() {
    g_numStop++;
    ) {
        g_bInteractive = true;
    }
    ; i < g_pendingBinds.length; i++) {
        if (g_pendingBinds[i] != null && g_pendingBinds[i].el != null)
            g_pendingBinds[i].el._bound = null;
    }
}
function onfocus() {
    if (!g_bFocus) {
        dofocus();
    }
}
function dofocus() {
    var node = null;
    g_bFocus = true;
    try {
        node = getNodeFromIndex(selectedNodeIndex);
    }
    catch (e) {
    }
    if (node != null) {
        );
        if (oItem != null) {
            if (g_bInteractive) {
                focusFilter(oItem);
                oItem.tabIndex = ;
                if (!g_bMouseDown) {
                    try {
                        var prevScrollTop = element.scrollTop;
                        var prevScrollLeft = element.scrollLeft;
                        oItem.focus();
                        element.scrollTop = prevScrollTop;
                        element.scrollLeft = prevScrollLeft;
                    }
                    catch (e) {
                    }
                }
            }
        }
    }
    node = null;
    try {
        node = getNodeFromIndex(HoverNodeIndex);
    }
    catch (e) {
    }
    if (node != null && g_bInteractive) {
        );
        if (oItem != null)
            focusFilter(oItem);
    }
}
function focusFilter(oItem) {
    if (oItem.id == "_tnaccess")
        oItem = oItem.all.item();
    ) {
        var oFilter = oItem.filters.item("DXImageTransform.Microsoft.Alpha");
        if (oFilter) {
            oFilter.opacity *= ;
        }
    }
}
function onblur() {
    var node = null;
    g_bFocus = false;
    try {
        node = getNodeFromIndex(selectedNodeIndex);
    }
    catch (e) {
    }
    if (node != null) {
        );
        if (oItem != null) {
            blurFilter(oItem);
            oItem.tabIndex = -;
        }
    }
    node = null;
    try {
        node = getNodeFromIndex(HoverNodeIndex);
    }
    catch (e) {
    }
    if (node != null) {
        );
        if (oItem != null) {
            blurFilter(oItem);
            oItem.tabIndex = -;
        }
    }
    setHiddenHelperValue();
}
function blurFilter(oItem) {
    if (oItem.id == "_tnaccess")
        oItem = oItem.all.item();
    ) {
        var oFilter = oItem.filters.item("DXImageTransform.Microsoft.Alpha");
        if (oFilter) {
            oFilter.opacity /= ;
            return;
        }
    }
    oItem.style.filter += "progid:DXImageTransform.Microsoft.Alpha(opacity=50,style=0)";
}
function oncontentready() {
    )
        return;
    g_styles = new Object();
    var strFont = "font: " + L_fontSize_Text + " " + L_fontName_Text + "; ";
    g_styles["parent"] = strFont + "text-decoration: none; color: black; overflow:hidden;";
    g_styles["child"] = strFont + "overflow:hidden;";
    g_styles["defaultstyle"] = strFont + "display:inline-block; color: black; text-decoration:none; cursor: hand; overflow:hidden;";
    g_styles["hoverstyle"] = "color: highlighttext; background-color:highlight; filter:progid:DXImageTransform.Microsoft.Alpha(opacity=50,style=0);";
    g_styles["selectedstyle"] = "color: highlighttext; background-color:highlight;";
    g_styles["icon"] = "cursor:hand;";
    if (element.style.overflowX == "");
    element.style.overflowX = "auto";
    verifyBooleanAttribute(element, "showPlus");
    if (element.getAttribute("showPlus") == false && element.getAttribute("selectExpands") == null)
        element.setAttribute();
    verifyBooleanAttribute(element, "selectExpands");
    verifyBooleanAttribute(element, "autoSelect");
    verifyBooleanAttribute(element, "showLines");
    verifyBooleanAttribute(element, "showToolTip");
    var systemImagesPath = element.getAttribute("SystemImagesPath");
    if (systemImagesPath == null)
        element.setAttribute();
    ) != '/')
        element.setAttribute();
    if (isRtl()) {
        element.setAttribute();
    }
    contentNode = element.document.createElement("treeview");
    contentNode.innerHTML = element.innerHTML;
    element.tabIndex = ;
    element.attachEvent("onkeydown", onkeydown);
    element.attachEvent("onfocus", onfocus);
    element.attachEvent("onblur", onblur);
    f_AddStopEvent();
    element.hideFocus = true;
    if (element.getAttribute("selectedNodeIndex") == null)
        prop_selectedNodeIndex = "";
    if (element.getAttribute("HoverNodeIndex") == null)
        element.setAttribute();
    if (element.getAttribute("TreeNodeTypeSrc") == null) {
        element.nodeTypes = contentNode.children.tags("TREENODETYPE");
        verifyTypeValues();
        g_bTypesReady = true;
    }
    else
        databindTypes();
    if (treeNodeSrc != null) {
        if (element.nodeTypes != null) {
            contentNode.innerHTML = getNodeTypeHtml();
            element.nodeTypes = contentNode.children.tags("TREENODETYPE");
        }
        else
            contentNode.innerHTML = "";
        databindNode(element);
    }
    else {
        g_bNodesReady = true;
        tryToBuildTreeFromRoot();
    }
}
function ondocumentready() {
    )
        return;
    f_CleanupEvents();
    g_strQueuedEvents = "";
    )
        HoverNode(getNodeFromIndex(HoverNodeIndex));
    g_bInteractive = true;
    if (element.getAttribute("Focused") != null)
        dofocus();
    else
        onblur();
    var newScrollTop = element.getAttribute("__scrollTop");
    var newScrollLeft = element.getAttribute("__scrollLeft");
    if (newScrollTop != null)
        element.scrollTop = newScrollTop;
    if (newScrollLeft != null)
        element.scrollLeft = newScrollLeft;
    var parent = element.offsetParent;
    if (parent != null) {
        var newParentTop = element.getAttribute("__parentTop");
        var newParentLeft = element.getAttribute("__parentLeft");
        if (newParentTop != null)
            parent.scrollTop = newParentTop;
        if (newParentLeft != null)
            parent.scrollLeft = newParentLeft;
    }
    if (getNodeFromIndex(selectedNodeIndex) == null) {
        ") != null)
            selectedNodeIndex = ";
        else
            selectedNodeIndex = "";
    }
}
function changeIcon(node, imageUrl) {
    var icon1;
    var imageUrlLC = imageUrl.toLowerCase();
    );
    );
    var spacer = accessnode.previousSibling;
    if (spacer != null) {
        icon1 = spacer.previousSibling;
        if (icon1 != null && icon1.id != "_nodeicon")
            icon1 = null;
    }
    else
        icon1 = null;
    var newSrc = getNodeAttribute(node, imageUrlLC);
    if (newSrc != null && icon1 == null) {
        icon1 = node.document.createElement("<IMG align='absmiddle' border='0' class='icon' id='_nodeicon' >");
        icon1.src = newSrc;
        accessnode.parentElement.insertBefore(icon1, accessnode);
        spacer = node.document.createElement("<SPAN>");
        spacer.style.width = ;
        accessnode.parentElement.insertBefore(spacer, accessnode);
    }
    else if (newSrc != null) {
        icon1.src = newSrc;
        icon1.style.display = "inline";
    }
    else if (imageUrlLC == "imageurl") {
        if (icon1 != null) {
            icon1.style.display = "none";
        }
    }
    else if (imageUrlLC == "selectedimageurl" && node.getAttribute("expanded") == true)
        changeIcon(node, "expandedimageurl");
    else
        changeIcon(node, "imageurl");
    if (icon1 != null) {
        icon1.style.cursor = textnode.style.cursor;
        spacer.style.cursor = textnode.style.cursor;
    }
}
function selectNode(node, delay) {
    var nodeIndex;
    var selectedNode = null;
    var strImage;
    var oItem;
    var oOldItem = null;
    if (node && node.subtree == null)
        node = getNodeFromIndex(");
    nodeIndex = getNodeIndex(node);
    if (selectedNodeIndex != nodeIndex) {
        if (selectedNodeIndex != "" && selectedNodeIndex != null) {
            selectedNode = getNodeFromIndex(selectedNodeIndex);
            if (selectedNode != null && selectedNode.subtree != null) {
                oOldItem = selectedNode.subtree.all.item();
                SetAnchorClass(oOldItem, "defaultstyle");
                oOldItem.parentElement.tabIndex = -;
                if (selectedNode.getAttribute("expanded") == true)
                    strImage = "ExpandedImageUrl";
                else
                    strImage = "ImageUrl";
                changeIcon(selectedNode, strImage);
            }
        }
        if (node) {
            oItem = node.subtree.all.item();
            applySelection(node, oItem);
        }
        ) {
            g_event = createEventObject();
            g_event.newTreeNodeIndex = nodeIndex;
            g_event.oldTreeNodeIndex = selectedNodeIndex;
            prop_selectedNodeIndex = nodeIndex;
            if (delay != true)
                _tvevtSelect.fire(g_event);
            else {
                )
                    window.clearTimeout(g_timer);
                g_timer = window.setTimeout(autoSelect, , "JScript");
                if (g_selectedNodeBeforeDelay == "")
                    g_selectedNodeBeforeDelay = g_event.oldTreeNodeIndex;
            }
        }
        else
            prop_selectedNodeIndex = nodeIndex;
        if (!g_bFocus && g_bInteractive) {
            if (oOldItem != null)
                focusFilter(oOldItem);
        }
    }
    setHiddenHelperValue();
}
function autoSelect() {
    g_timer = -;
    if (selectedNodeIndex != g_selectedNodeBeforeDelay) {
        navigateNode(getNodeFromIndex(g_event.newTreeNodeIndex));
        _tvevtSelect.fire(g_event);
        fireQueuedEvents();
    }
    g_selectedNodeBeforeDelay = "";
}
function applySelection(node, oItem) {
    SetAnchorClass(oItem, "SelectedStyle");
    changeIcon(node, "SelectedImageUrl");
    scrollTree(node);
    ) {
        if (g_bFocus)
            changeFocus(node, getNodeFromIndex(selectedNodeIndex));
    }
    if (!g_bFocus && g_bInteractive) {
        blurFilter(oItem);
    }
}
function reselectNode(el) {
    if (selectedNodeIndex == getNodeIndex(el))
        applySelection(el, el.subtree.all.item());
}
function tryToBuildTreeFromRoot() {
    if (g_bNodesReady == true && g_bTypesReady == true) {
        var bRebuilding = g_bCreated;
        buildTreeFromRoot();
        ) {
            prop_selectedNodeIndex = ";
        }
        var node = getNodeFromIndex(selectedNodeIndex);
        prop_selectedNodeIndex = "";
        selectNode(node);
    }
}
function buildTreeFromRoot() {
    treeviewNode = element.document.createElement("HTML");
    var bodyNode = element.document.createElement("BODY");
    bodyNode.dir = element.getAttribute("dir");
    bodyNode.style.direction = element.currentStyle.direction;
    var head = element.document.createElement("HEAD");
    var base = element.document.createElement("BASE");
    var path = null;
    if (window.location.pathname != null) {
        var lastslash = window.location.pathname.lastIndexOf("/");
        )
            path = window.location.pathname.substr(, lastslash + );
        else
            path = window.location.pathname;
    }
    var protocol = window.location.protocol.toLowerCase();
    base.href = window.location.protocol + (protocol != "mailto:" && protocol != "news:" ? "//" : "") + window.location.host + path;
    head.appendChild(base);
    treeviewNode.appendChild(head);
    var kids = contentNode.children.tags("treenode");
    ] != undefined) {
        ; i < kids.length; i++) {
            kids[i].sibIndex = i;
            );
            bodyNode.appendChild(subtree);
        }
    }
    treeviewNode.appendChild(bodyNode);
    treeviewNode.style.display = "block";
    treeviewNode.subtree = bodyNode;
    defaults.viewLink = treeviewNode.document;
    setHiddenHelperValue();
    g_bCreated = true;
}
function buildTree(root, level) {
    var display = true;
    if (root.subtree != null && root.subtree.style.display == "none")
        display = false;
    root.detachEvent("onclick", DefaultNodeOnClick);
    root.attachEvent("onclick", DefaultNodeOnClick);
    root.inheritedType = undefined;
    root.nodetypeIndex = undefined;
    var exp = makeBoolean(root.getAttribute("expanded"));
    if (exp == null) {
        if (level < element.getAttribute("ExpandLevel")) {
            root.setAttribute();
            exp = true;
        }
        else
            exp = false;
    }
    if (!verifyBooleanAttribute(root, "expanded"))
        root.setAttribute();
    if (!verifyBooleanAttribute(root, "checked"))
        root.setAttribute("checked", false);
    verifyBooleanAttribute(root, "checkBox");
    verifyBooleanAttribute(root, "checkedExpandable");
    if (root.getAttribute("type") != null)
        root.setAttribute();
    if (root.getAttribute("childType") != null)
        root.setAttribute();
    var collChildren = root.children.tags("treenode");
    var iChildren = collChildren.length;
    var expandable = getNodeAttribute(root, "expandable");
    if (expandable == null && root.getAttribute("TreeNodeSrc") != null)
        expandable = "checkOnce";
    if (root.getAttribute("_bound") != "binding") {
         || (expandable == "always" || (expandable == "checkOnce" && root.getAttribute("checkedExpandable") != true)) ? "parent" : "child");
        if (display == false)
            subtree.style.display = "none";
        if (exp == true && root.getAttribute("TreeNodeSrc") != null && root.getAttribute("_bound") != "complete") {
            root.setAttribute();
            saveSubtree(root, subtree);
            databindNode(root);
        }
        else {
            if (root.getAttribute("expanded") == true) {
                ; i < iChildren; i++) {
                    collChildren[i].sibIndex = i;
                    );
                    if (sub2 != undefined)
                        subtree.appendChild(sub2);
                }
            }
            else {
                ; i < iChildren; i++) {
                    if (collChildren[i].getAttribute("subtree") != null)
                        collChildren[i].subtree = null;
                }
            }
            saveSubtree(root, subtree);
        }
    }
    return root.subtree;
}
function saveSubtree(el, subtree) {
    if (el.getAttribute("subtree") == null)
        el.subtree = subtree;
    else {
        el.subtree.replaceNode(subtree);
        el.subtree = subtree;
    }
}
function calcJunction(el) {
    var elParent = el.parentElement;
    var collChildren = elParent.children.tags("treenode");
    ] == el) {
        )
            return ('F');
        else
            return ('R');
    }
    else {
        ] == el) {
            return ('L');
        }
        else {
            return ('T');
        }
    }
}
function generateItem(el, nodeClass) {
    var image;
    var plusminusNode;
    var elAnchor;
    var expImgUrl = getNodeAttribute(el, "ExpandedImageUrl");
    var imgUrl = getNodeAttribute(el, "ImageUrl");
    var node = el.document.createElement("DIV");
    var cJunction;
    var junctionNode;
    var str;
    node.className = nodeClass;
    node.treenode = el;
    node.noWrap = true;
    node.style.display = "block";
    if (nodeClass == "child" && el.getAttribute("expanded") == true)
        el.setAttribute();
    cJunction = calcJunction(el);
    junctionNode = generateJunctionNode(el, cJunction, nodeClass);
    node.appendChild(junctionNode);
    addLinesAndWhitespace(node, el, junctionNode);
    if (getNodeAttribute(el, "checkBox") == true) {
        var cb = createCheckBox(el);
        node.appendChild(cb);
    }
    elAnchor = el.document.createElement("<A>");
    elAnchor.onclick = nodePlusMinusClick;
    junctionNode.applyElement(elAnchor, "outside");
    elAnchor = el.document.createElement("<A tabindex=-1>");
    str = getNodeAttribute(el, "NavigateUrl");
    if (str != null && str != "") {
        elAnchor.href = str;
    }
    str = getNodeAttribute(el, "Target");
    if (str != null)
        elAnchor.target = str;
    var accessAnchor = elAnchor.cloneNode();
    accessAnchor.id = "_tnaccess";
    elAnchor.onclick = nodeClick;
    elAnchor.oncontextmenu = contextmenu;
    elAnchor.onmousedown = mousedown;
    elAnchor.onmouseup = mouseup;
    node.insertBefore(elAnchor);
    imageSrc = (nodeClass == "parent" && el.getAttribute("expanded") == true && expImgUrl != null ? expImgUrl : imgUrl);
    var spacer = null;
    if (imageSrc != null && imageSrc != undefined) {
        image = el.document.createElement("<IMG align='absmiddle' border='0' class='icon' id='_nodeicon'>");
        image.src = imageSrc;
        image.style.cssText = g_styles["icon"];
        elAnchor.appendChild(image);
        spacer = el.document.createElement("<SPAN>");
        spacer.style.width = ;
        elAnchor.appendChild(spacer);
    }
    var textNode = generateTextNode(el);
    if (spacer != null) {
        spacer.style.cursor = textNode.style.cursor;
        image.style.cursor = textNode.style.cursor;
    }
    if (nodeClass == "parent" && element.getAttribute("showToolTip") != false)
        accessAnchor.title = textNode.innerText + " : " + L_strToolTip_Text;
    accessAnchor.appendChild(textNode);
    elAnchor.appendChild(accessAnchor);
    elAnchor.onmouseenter = mOver;
    elAnchor.onmouseleave = mOut;
    return node;
}
function createCheckBox(el) {
    var form = el.document.createElement("<FORM style='display:inline' name='_fcb'>");
    var bChecked = el.getAttribute("checked");
    var cb = el.document.createElement("<INPUT style='display:inline' tabindex=-1 type=checkbox name='_cb'" + (bChecked ? " checked " : " ") + "/>");
    cb.onclick = checkboxClick;
    form.appendChild(cb);
    return form;
}
function generateJunctionNode(el, cJunction, nodeClass) {
    var imageSrc;
    var junctionNode;
    var systemImagesPath = element.getAttribute("systemImagesPath");
    if (element.getAttribute("showLines") != false) {
        imageSrc = systemImagesPath;
        switch (cJunction) {
            case 'L':
                imageSrc += "L";
                break;
            case 'T':
                imageSrc += "T";
                break;
            case 'R':
                imageSrc += "R";
                break;
            case 'F':
                imageSrc += "F";
                break;
            default:
                return null;
                break;
        }
        if (nodeClass == "parent" && element.getAttribute("showPlus") != false) {
            if (el.getAttribute("expanded") == true)
                imageSrc += "minus.gif";
            else
                imageSrc += "plus.gif";
        }
        else
            imageSrc += ".gif";
    }
    else {
        if (nodeClass == "parent" && element.getAttribute("showPlus") != false) {
            if (el.getAttribute("expanded") == true)
                imageSrc = systemImagesPath + "minus.gif";
            else
                imageSrc = systemImagesPath + "plus.gif";
        }
        else {
            imageSrc = systemImagesPath + "white.gif";
        }
    }
    if (element.getAttribute("showLines") == false && element.getAttribute("showPlus") == false)
        junctionNode = element.document.createElement("<SPAN name='junction'>");
    else {
        junctionNode = element.document.createElement("<IMG align='absmiddle' border='0' class='icon' name='junction'>");
        junctionNode.src = imageSrc;
    }
    return junctionNode;
}
function addLinesAndWhitespace(node, el, junctionNode) {
    var elWalk = el.parentElement;
    var elInsertBefore = junctionNode;
    var systemImagesPath = element.getAttribute("systemImagesPath");
    if (element.getAttribute("showLines") != false) {
        while (elWalk && elWalk.tagName.toLowerCase() == "treenode") {
            var nextSib = elWalk.nextSibling;
            )
                nextSib = nextSib.nextSibling;
            var imageSrc;
            var image;
            if (nextSib != null && nextSib.tagName.toLowerCase() == "treenode")
                imageSrc = systemImagesPath + "I.gif";
            else
                imageSrc = systemImagesPath + "white.gif";
            image = el.document.createElement("<IMG align='absmiddle' border='0'>");
            image.src = imageSrc;
            elInsertBefore = node.insertBefore(image, elInsertBefore);
            elWalk = elWalk.parentElement;
        }
    }
    else {
        var strIndex = getNodeIndex(el);
        ) {
            if (element.getAttribute("Indent") != null) {
                if (isRtl())
                    node.style.marginRight = element.getAttribute("Indent");
                else
                    node.style.marginLeft = element.getAttribute("Indent");
            }
        }
    }
}
function generateTextNode(el) {
    var textNode = el.document.createElement("<SPAN id=_tntext tabIndex=-1 style='display:inline; height=100%'>");
    if (el.getAttribute("Text") != null) {
        textNode.innerHTML = el.getAttribute("Text");
    }
    else {
        ;
        while (iChild < el.childNodes.length) {
             || el.childNodes[iChild].tagName.toLowerCase() != "treenode") {
                var oClone = el.childNodes[iChild].cloneNode(true);
                textNode.appendChild(oClone);
            }
            iChild++;
        }
    }
    textNode.className = "defaultstyle";
    var defStyle = cascadeStyle(el, "defaultstyle");
    textNode.style.cssText = defStyle;
    return textNode;
}
function updateTree(el) {
    if (el.getAttribute("expanded") == true) {
        ;
        var coll = el.children.tags("treenode");
        var bRebuild = true;
         && coll().getAttribute("subtree") != null)) {
            bRebuild = false;
            ; i < coll.length; i++) {
                if (coll(i).subtree == null) {
                    bRebuild = true;
                    break;
                }
                coll(i).subtree.style.display = "block";
            }
        }
        if (bRebuild) {
            el.removeAttribute("_buildChildren");
            buildTree(el, getNodeLevel(el));
            reselectNode(el);
            if (HoverNodeIndex == getNodeIndex(el))
                HoverNode(el);
        }
    }
    else {
        var collChildren = el.children.tags("treenode");
        ; i < collChildren.length; i++) {
            collChildren(i).subtree.style.display = "none";
        }
        var index = getNodeIndex(el);
        , index.length) == index) {
            selectNode(el);
        }
        else if (selectedNodeIndex == index)
            changeIcon(el, "SelectedImageUrl");
        , index.length) == index) {
            if (selectedNodeIndex != index) {
                if (HoverNodeIndex != index) {
                    UnhoverNode(getNodeFromIndex(HoverNodeIndex));
                    HoverNode(el);
                }
            }
            else
                UnhoverNode(getNodeFromIndex(HoverNodeIndex));
        }
    }
    setHiddenHelperValue();
}
function cascadeStyle(el, att) {
    var str = g_styles[att];
    var strStyle = element.getAttribute(att);
    if (strStyle != null)
        str = str + ";" + strStyle;
    strStyle = getNodeTypeAttribute(el, att);
    if (strStyle != null)
        str = str + ";" + strStyle;
    strStyle = el.getAttribute(att);
    if (strStyle != null)
        str = str + ";" + strStyle;
    return str;
}
function getNodeTypeAttribute(el, att) {
    var _nodetype = getNodeTypeObject(el);
    if (_nodetype != null)
        return _nodetype.getAttribute(att);
    return null;
}
function getNodeAttribute(el, att) {
    var strReturn;
    strReturn = el.getAttribute(att);
    if (strReturn != null)
        return strReturn;
    strReturn = getNodeTypeAttribute(el, att);
    if (strReturn != null)
        return strReturn;
    return element.getAttribute(att);
}
function navigateNode(el) {
    var url = getNodeAttribute(el, "NavigateUrl");
    if (url != null && url != "") {
        var target = getNodeAttribute(el, "Target");
        if (target == null || target == "_self") {
            window.open(url, "_self");
            return true;
        }
        else
            window.open(url, target);
    }
    return false;
}
function checkboxClick() {
    if (g_bInteractive == false)
        return;
    var el = this.parentElement.parentElement.treenode;
    event.cancelBubble = true;
    doCheckboxClick(el);
    fireQueuedEvents();
}
function doCheckboxClick(el) {
    el.checked = !el.checked;
    var evt = createEventObject();
    evt.treeNodeIndex = getNodeIndex(el);
    g_nodeClicked = el;
    _tvevtCheck.fire(evt);
}
function nodeClick() {
    if (g_bInteractive == false)
        return;
    var el = this.parentElement.treenode;
    if (doNodeClick(el) == true) {
        if (element.getAttribute("selectExpands") == true)
            doNodePlusMinusClick(el);
        fireQueuedEvents();
    }
}
function contextmenu() {
    event.cancelBubble = true;
    e = element.document.createEventObject(event);
    e.treeNodeIndex = getNodeIndex(this.parentElement.treenode);
    event.returnValue = element.fireEvent("oncontextmenu", e);
}
function mousedown() {
    ) {
        g_bMouseDown = true;
    }
}
function mouseup() {
    g_bMouseDown = false;
}
function nodePlusMinusClick() {
    if (g_bInteractive == false)
        return;
    var el = this.parentElement.treenode;
    if (doNodePlusMinusClick(el) == true)
        fireQueuedEvents();
}
function doNodeClick(el) {
    if (g_bInteractive == false)
        return;
    g_nodeClicked = el;
    event.cancelBubble = true;
    el.fireEvent("onclick");
    element.fireEvent("onclick", event);
    if (getNodeAttribute(el, "NavigateUrl") != null) {
        var target = getNodeAttribute(el, "Target");
        if (target == null || target.toLowerCase() == "_self")
            return false;
    }
    selectNode(el);
    return true;
}
function doNodePlusMinusClick(el) {
    if (g_bInteractive == false)
        return false;
    event.cancelBubble = true;
    g_nodeClicked = el;
    if (el.getAttribute("expanded") == false && el.getAttribute("_bound") == null && el.getAttribute("TreeNodeSrc") != null) {
        el._isExpanding = true;
        private_databind(el);
        return true;
    }
    else
        return finishNodePlusMinusClick(el);
}
function finishNodePlusMinusClick(el) {
    var exp = getNodeAttribute(el, "expandable");
    if (exp == null && el.getAttribute("TreeNodeSrc") != null)
        exp = "checkOnce";
     || exp == "always" || (exp == "checkOnce" && el.getAttribute("checkedExpandable") != true)) {
        var expanded = !el.getAttribute("expanded");
        el.setAttribute();
        if (exp == "checkOnce")
            el.checkedExpandable = true;
        var evt = createEventObject();
        evt.treeNodeIndex = getNodeIndex(el);
        var eventToFire = changeJunctionImage(el);
        updateTree(el);
        doVisualRefresh();
         && element.getAttribute("onfirequeuedevents") != null)
            addStatusNode(el, L_strRetrievingNodes_Text);
        eventToFire.fire(evt);
        return true;
    }
    return false;
}
function changeJunctionImage(el) {
    );
    if (el.getAttribute("expanded") == true) {
        if (icon1 != null)
            icon1.src = icon1.src.replace(/plus/, "minus");
        if (selectedNodeIndex != getNodeIndex(el) || getNodeAttribute(el, "selectedimageurl") == null)
            changeIcon(el, "ExpandedImageUrl");
        return _tvevtExpand;
    }
    else {
        if (icon1 != null)
            icon1.src = icon1.src.replace(/minus/, "plus");
        if (selectedNodeIndex != getNodeIndex(el))
            changeIcon(el, "ImageUrl");
        return _tvevtCollapse;
    }
}
function DefaultNodeOnClick() {
    event.cancelBubble = true;
}
function getClickedNodeIndex() {
    if (g_nodeClicked != null)
        return getNodeIndex(g_nodeClicked);
    else
        return null;
}
function getNodeLevel(node) {
    ;
    while (node.parentElement.tagName.toLowerCase() == "treenode") {
        node = node.parentElement;
        level++;
    }
    return level;
}
function getNodeIndex(node) {
    var strIndex = "";
    if (node != null) {
        if (node.getAttribute("sibIndex") == null) {
            if (node.parentElement == null) {
                return null;
            }
            var col = node.parentElement.children.tags("treenode");
            ;
            while (col[i] != node)
                i++;
            node.sibIndex = i;
        }
        strIndex = node.sibIndex.toString();
        while (node.parentElement && node.parentElement.tagName.toLowerCase() == "treenode") {
            node = node.parentElement;
            if (node.getAttribute("sibIndex") == null)
                return null;
            strIndex = node.sibIndex + "." + strIndex;
        }
    }
    return strIndex;
}
function getNodeFromIndex(strIndex) {
    ) {
        var a = strIndex.split(".");
        ;
        var node = contentNode;
        while (i < a.length) {
            var coll = node.children.tags("treenode");
            ) + ) {
                return null;
            }
            node = coll.item(a[i++] - );
        }
        return node;
    }
    else {
        return null;
    }
}
function getNextVisibleNode(node) {
    var next = node;
    if (node.getAttribute("expanded") == true) {
        next = node.children[];
        while (next != null && next != undefined && next.nodeName.toLowerCase() != "treenode")
            next = next.nextSibling;
        if (next)
            return next;
    }
    next = node.nextSibling;
    while (next != null && next != undefined && next.nodeName.toLowerCase() != "treenode")
        next = next.nextSibling;
    if (next != null)
        return next;
    next = node.parentElement;
    while ((next.nextSibling == null || next.nextSibling == undefined) && next.nodeName.toLowerCase() == "treenode") {
        next = next.parentElement;
    }
    if (next.nextSibling != null && next.nextSibling != undefined && next.nextSibling.nodeName.toLowerCase() == "treenode")
        return next.nextSibling;
    else
        return null;
}
function getPreviousVisibleNode(node) {
    var prev = node;
    prev = node.previousSibling;
    while (prev != null && prev != undefined && prev.nodeName.toLowerCase() != "treenode")
        prev = prev.previousSibling;
    if (prev) {
        if (prev.getAttribute("expanded") == true) {
            var lastChild = prev;
            while (lastChild != node && lastChild != null) {
                prev = lastChild;
                lastChild = getNextVisibleNode(prev);
            }
        }
        return prev;
    }
    if (node.parentElement.nodeName.toLowerCase() == "treenode")
        return node.parentElement;
    else
        return null;
}
function setHiddenHelperValue() {
    var id = element.HelperID;
    if (id == null)
        return;
    var helper = window.document.all(id);
    if (helper == null)
        return;
    ;
    ;
    var parent = element.offsetParent;
    if (parent != null) {
        parentTop = parent.scrollTop;
        parentLeft = parent.scrollLeft;
    }
    helper.value = (g_bFocus ? ") + "|" + HoverNodeIndex + "|" + element.scrollTop + "|" + element.scrollLeft + "|" + parentTop + "|" + parentLeft + "|" + g_strQueuedEvents;
}
function scrollTree(tnode) {
    );
    var top = node.offsetTop - element.scrollTop;
    ) {
        element.scrollTop += top;
    }
    else {
        var bottom = top + node.offsetHeight;
        var elemHeight = element.clientHeight;
        if (bottom > elemHeight) {
            element.scrollTop += bottom - elemHeight;
        }
    }
    var rc = node.getBoundingClientRect();
    var elRc = element.getBoundingClientRect();
    if (g_bFocus) {
        if (elRc.top + rc.top < element.document.body.clientTop)
            node.scrollIntoView(true);
        else if (elRc.top + rc.bottom > element.document.body.clientHeight)
            node.scrollIntoView(false);
    }
}
function getInheritedType(el) {
    if (el.inheritedType === undefined || g_bInTypesBoundEvent) {
        var parentNode = el.parentElement;
        el.inheritedType = parentNode.getAttribute("childType");
        var tagname = parentNode.tagName.toLowerCase();
        if (el.inheritedType == null && tagname != "treeview") {
            var _parenttype = getNodeTypeObject(parentNode);
            if (_parenttype != null) {
                el.inheritedType = _parenttype.getAttribute("childType");
            }
            if (el.inheritedType == null && tagname == "treenode") {
                el.inheritedType = getInheritedType(parentNode);
            }
        }
        if (el.inheritedType == null)
            el.inheritedType = element.getAttribute("childType");
    }
    return el.inheritedType;
}
function getNodeTypeObject(el) {
    if (el.nodetypeIndex == undefined || g_bInTypesBoundEvent) {
        var theType = el.getAttribute("type");
        if (theType == null)
            theType = getInheritedType(el);
        if (theType == null)
            return null;
        theType = theType.toLowerCase();
        ;
        var len = element.nodeTypes.length;
        while (i < len) {
            if (element.nodeTypes[i].getAttribute("type") == theType) {
                el.nodetypeIndex = i;
                break;
            }
            i++;
        }
    }
    return element.nodeTypes[el.nodetypeIndex];
}
function replaceJunctionNode(node) {
    if (node.subtree == null)
        return;
    );
    if (oldNode == null)
        return;
    var cJunction = calcJunction(node);
    var exp = node.getAttribute("Expandable");
    if (exp == null && node.getAttribute("TreeNodeSrc") != null)
        exp = "checkOnce";
    ;
    var junctionNode = generateJunctionNode(node, cJunction, bChildNodes || (exp == "always" || (exp == "checkOnce" && node.getAttribute("checkedExpandable") != true)) ? "parent" : "child");
    );
    if (!bChildNodes)
        accessNode.title = "";
    else {
        );
        accessNode.title = textNode.innerText + " : " + L_strToolTip_Text;
    }
    oldNode.replaceNode(junctionNode);
}
function addStatusNode(el, str) {
    ) != null)
        return;
    var fetchNode = el.document.createElement("<DIV id=_fetch>");
    var imageNode = el.document.createElement("<IMG align='absmiddle' border='0'>");
    imageNode.src = element.getAttribute("systemimagespath") + "white.gif";
    fetchNode.appendChild(imageNode);
    var junctionNode = generateJunctionNode(null, 'L', "child");
    fetchNode.appendChild(junctionNode);
    addLinesAndWhitespace(fetchNode, el == element ? contentNode : el, junctionNode);
    var textNode = el.document.createElement("<SPAN id=_tntext tabIndex=-1 style='display:inline; height=100%'>");
    textNode.innerText = str;
    textNode.className = "defaultstyle";
    var defStyle;
    if (el == element)
        defStyle = g_styles["defaultstyle"] + ";" + element.getAttribute("defaultstyle");
    else
        defStyle = cascadeStyle(el, "defaultstyle");
    textNode.style.cssText = defStyle;
    fetchNode.appendChild(textNode);
    if (el == element) {
        if (!g_bCreated) {
            fetchNode.style.display = "block";
            defaults.viewLink = fetchNode.document;
        }
        else {
            treeviewNode.appendChild(fetchNode);
        }
    }
    else {
        if (el.subtree != null)
            el.subtree.appendChild(fetchNode);
    }
    doVisualRefresh();
}
function databindNode(el) {
    var src = el.getAttribute("TreeNodeSrc");
    if (src == null)
        return;
    addStatusNode(el, L_strRetrievingNodes_Text);
    el._bound = "binding";
    var XsltSrc = el.getAttribute("TreeNodeXsltSrc");
    var databindInfo = new Object();
    databindInfo.el = el;
    databindInfo.transform = null;
    databindInfo.island = null;
    databindInfo.src = src;
    if (el == contentNode)
        g_bNodesReady = false;
    if (XsltSrc != null) {
        databindInfo.transform = element.document.all(XsltSrc);
        if (databindInfo.transform == null) {
            try {
                databindInfo.transform = new ActiveXObject("Msxml2.DOMDocument");
            }
            catch (e) {
                databindError(databindInfo, L_strMSXMLError_Text);
                return;
            }
            databindInfo.transform.async = false;
            if (!databindInfo.transform.loadXML(XsltSrc))
                databindInfo.transform.load(XsltSrc);
        }
        else
            databindInfo.transform = databindInfo.transform.XMLDocument;
    }
    databindInfo.island = element.document.all(src);
    if (databindInfo.island == null) {
        try {
            databindInfo.island = new ActiveXObject("Msxml2.DOMDocument");
        }
        catch (e) {
            databindError(databindInfo, L_strMSXMLError_Text);
            return;
        }
        databindInfo.island.async = false;
        g_pendingSyncBinds = g_pendingSyncBinds.concat(databindInfo);
        )
            g_bindTimer = window.setTimeout(syncBind, , "JScript");
    }
    else
        finishDatabindingNode(databindInfo, true);
}
function syncBind() {
    ) {
        ];
        g_pendingSyncBinds.splice(, );
        if (!databindInfo.island.loadXML(databindInfo.src)) {
            databindInfo.island.async = true;
            g_pendingBinds = g_pendingBinds.concat(databindInfo);
            databindInfo.island.onreadystatechange = finishDatabindingNodeHandler;
            databindInfo.island.load(databindInfo.src);
        }
        else
            finishDatabindingNode(databindInfo, true);
    }
    g_bindTimer = -;
}
function finishDatabindingNodeHandler() {
    ; i < g_pendingBinds.length; i++) {
        )
            g_pendingBinds[i].b = true;
         && g_pendingBinds[i].b == true) {
            var bindInfo = g_pendingBinds[i];
            g_pendingBinds.splice(i, );
            finishDatabindingNode(bindInfo, false);
            i--;
        }
    }
}
function finishDatabindingNode(databindInfo, bReady) {
    if (bReady != true && databindInfo.island == null)
        return;
    if (databindInfo.island.xml == "" || (databindInfo.transform != null && databindInfo.transform.xml == "")) {
        var regexp = /%s/;
        var str = "<B>" + L_strXMLError_Text + "</B>";
        str = str.replace(regexp, databindInfo.el.getAttribute('TreeNodeSrc'));
        databindError(databindInfo, str);
        return;
    }
    if (databindInfo.transform != null) {
        var html = databindInfo.island.transformNode(databindInfo.transform);
        try {
            databindInfo.island = new ActiveXObject("Msxml2.DOMDocument");
        }
        catch (e) {
            databindError(databindInfo, L_strMSXMLError_Text);
            return;
        }
        databindInfo.island.loadXML(html);
    }
    var container = databindInfo.island.selectSingleNode("TREENODES");
    if (container == null) {
        var strXslt = databindInfo.el.getAttribute("TreeNodeXsltSrc");
        var strError = "<B>" + L_strInvalidXML_Text;
        var regexp = /%s/;
        strError = strError.replace(regexp, databindInfo.el.getAttribute('TreeNodeSrc'));
        if (strXslt != null) {
            strError += L_strXSLTError_Text + "</B>";
            strError = strError.replace(regexp, databindInfo.el.getAttribute('TreeNodeXsltSrc'));
        }
        else
            strError += "</B>";
        databindError(databindInfo, strError);
        return;
    }
    var child = container.firstChild;
    var html = "";
    while (child != null) {
        if (child.nodeName.toLowerCase() == "treenode")
            html += child.xml;
        child = child.nextSibling;
    }
    databindInfo.el._bound = "complete";
    html = html.replace(/(<\/?)(treenode)/gi, "$1" + element.scopeName + ":$2");
    if (databindInfo.el == element) {
        contentNode.innerHTML = html;
        g_bNodesReady = true;
        tryToBuildTreeFromRoot();
    }
    else {
        databindInfo.el.innerHTML += html;
        if (databindInfo.el.subtree != null) {
            buildTree(databindInfo.el, getNodeLevel(databindInfo.el));
            if (databindInfo.el._isExpanding == true) {
                databindInfo.el.removeAttribute("_isExpanding");
                finishNodePlusMinusClick(databindInfo.el);
            }
            else {
                reselectNode(databindInfo.el);
            }
        }
    }
    doVisualRefresh();
    var evt = element.document.createEventObject();
    if (databindInfo.el == element)
        evt.treeNodeIndex = null;
    else
        evt.treeNodeIndex = getNodeIndex(databindInfo.el);
    evt.reason = ;
    _tvevtNodeBound.fire(evt);
}
function databindError(databindInfo, strError) {
    var fetch;
    var event = createEventObject();
    if (databindInfo.el == element)
        event.treeNodeIndex = null;
    else
        event.treeNodeIndex = getNodeIndex(databindInfo.el);
    ;
    _tvevtNodeBound.fire(event);
    if (databindInfo.el == element)
        fetch = defaults.viewLink.all.item();
    else
        fetch = databindInfo.el.subtree.all.item();
    if (fetch != null) {
        );
        tntext.innerHTML = strError;
    }
}
function databindTypes() {
    var src = element.getAttribute("TreeNodeTypeSrc");
    if (src == null)
        return;
    g_bTypesReady = false;
    g_typeIsland = element.document.all(src);
    if (g_typeIsland == null) {
        try {
            g_typeIsland = new ActiveXObject("Msxml2.DOMDocument");
        }
        catch (e) {
            databindError(databindInfo, L_strMSXMLError_Text);
            return;
        }
        g_typeIsland.async = false;
        if (!g_typeIsland.loadXML(src)) {
            g_typeIsland.async = true;
            g_typeIsland.onreadystatechange = finishDatabindingTypes;
            g_typeIsland.load(src);
        }
        else
            finishDatabindingTypes();
    }
}
function finishDatabindingTypes() {
    )
        return;
    if (g_typeIsland.xml == "") {
        databindTypesError();
        return;
    }
    var container = g_typeIsland.selectSingleNode("TREENODETYPES");
    if (container == null) {
        databindTypesError();
        return;
    }
    var child = container.firstChild;
    var html = "";
    while (child != null) {
        if (child.nodeName.toLowerCase() == "treenodetype")
            html += child.xml;
        child = child.nextSibling;
    }
    html = html.replace(/(<\/?)(treenodetype)/gi, "$1" + element.scopeName + ":$2");
    g_typesNode = element.document.createElement("DIV");
    g_typesNode.innerHTML = html;
    element.nodeTypes = g_typesNode.children.tags("TREENODETYPE");
    verifyTypeValues();
    g_bTypesReady = true;
    var evt = element.document.createEventObject();
    evt.reason = ;
    g_bInTypesBoundEvent = true;
    _tvevtNodeTypesBound.fire(evt);
    g_bInTypesBoundEvent = false;
    tryToBuildTreeFromRoot();
}
function databindTypesError() {
    var event = createEventObject();
    ;
    g_bInTypesBoundEvent = true;
    _tvevtNodeTypesBound.fire(event);
    g_bInTypesBoundEvent = false;
    g_typesNode = element.document.createElement("DIV");
    element.nodeTypes = g_typesNode.children.tags("TREENODETYPE");
    g_bTypesReady = true;
}
function verifyExpandableValue(value) {
    var lval = value.toLowerCase();
    switch (lval) {
        case "auto":
        case "checkonce":
        case "always":
            return true;
        default:
            return false;
            break;
    }
}
function verifyBooleanAttribute(node, att) {
    var value = node.getAttribute(att);
    if (value == null)
        return false;
    var boolval = makeBoolean(value);
    if (value == boolval)
        return true;
    node.setAttribute(att, boolval == );
    return (boolval != null);
}
function makeBoolean(value) {
    if (value == true || value == false)
        return value;
    if (value == null)
        return null;
    var lval = value.toLowerCase();
    switch (lval) {
        case "true":
            return true;
        case "false":
            return false;
        default:
            return null;
    }
}
function verifyTypeValues() {
    var len = element.nodeTypes.length;
    ; i < len; i++) {
        var str = element.nodeTypes[i].getAttribute("type");
        if (str != null)
            element.nodeTypes[i].setAttribute();
        verifyBooleanAttribute(element.nodeTypes[i], "expanded");
        verifyBooleanAttribute(element.nodeTypes[i], "checkBox");
    }
}
function getNodeTypeHtml() {
    var html = "";
    ; i < element.nodeTypes.length; i++) {
        html += element.nodeTypes[i].outerHTML;
    }
    return html;
}
function getDefaultStyle() {
    return prop_defaultStyle;
}
function setDefaultStyle(value) {
    if (prop_defaultStyle == value)
        return;
    if (typeof value == "string") {
        prop_defaultStyle = value;
        if (g_bCreated) {
            modifyNodesByType(contentNode, null, "defaultstyle")
            _tvpropDefaultStyle.fireChange();
        }
    }
}
function getHoverStyle() {
    return prop_hoverStyle;
}
function setHoverStyle(value) {
    if (prop_hoverStyle == value)
        return;
    if (typeof value == "string") {
        prop_hoverStyle = value;
        if (g_bCreated) {
            modifyNodesByType(contentNode, null, "hoverstyle")
            _tvpropHoverStyle.fireChange();
        }
    }
}
function getSelectedStyle() {
    return prop_selectedStyle;
}
function setSelectedStyle(value) {
    if (prop_selectedStyle == value)
        return;
    if (typeof value == "string") {
        prop_selectedStyle = value;
        if (g_bCreated) {
            modifyNodesByType(contentNode, null, "selectedstyle")
            _tvpropSelectedStyle.fireChange();
        }
    }
}
function getChildType() {
    return prop_childType;
}
function setChildType(value) {
    if (prop_childType != value) {
        prop_childType = value;
        if (g_bCreated) {
            var col = contentNode.children.tags("treenode");
            ; i < col.length; i++)
                buildTree(col[i], );
            _tvpropChildType.fireChange();
        }
    }
}
function getImageUrl() {
    return prop_imageUrl;
}
function setImageUrl(value) {
    if (prop_imageUrl != value) {
        prop_imageUrl = value;
        if (g_bCreated) {
            modifyNodesInheritingFromRoot(contentNode, "imageurl", value);
            _tvpropImageUrl.fireChange();
        }
    }
}
function getSelectedImageUrl() {
    return prop_selectedImageUrl;
}
function setSelectedImageUrl(value) {
    if (prop_selectedImageUrl != value) {
        prop_selectedImageUrl = value;
        if (g_bCreated) {
            modifyNodesInheritingFromRoot(contentNode, "selectedimageurl", value);
            _tvpropSelectedImageUrl.fireChange();
        }
    }
}
function getExpandedImageUrl() {
    return prop_expandedImageUrl;
}
function setExpandedImageUrl(value) {
    if (prop_expandedImageUrl != value) {
        prop_expandedImageUrl = value;
        if (g_bCreated) {
            modifyNodesInheritingFromRoot(contentNode, "expandedimageurl", value);
            _tvpropExpandedImageUrl.fireChange();
        }
    }
}
function getTarget() {
    return prop_target;
}
function setTarget(value) {
    if (prop_target != value) {
        prop_target = value;
        if (g_bCreated) {
            modifyNodesInheritingFromRoot(contentNode, "target", value);
            _tvpropTarget.fireChange();
        }
    }
}
function getTreeNodeSrc() {
    return prop_treeNodeSrc;
}
function setTreeNodeSrc(value) {
    if (prop_treeNodeSrc != value) {
        prop_treeNodeSrc = value;
        _tvpropTreeNodeSrc.fireChange();
    }
}
function getTreeNodeXsltSrc() {
    return prop_treeNodeXsltSrc;
}
function setTreeNodeXsltSrc(value) {
    if (prop_treeNodeXsltSrc != value) {
        prop_treeNodeXsltSrc = value;
        _tvpropTreeNodeXsltSrc.fireChange();
    }
}
function getSelectExpands() {
    return prop_selectExpands;
}
function setSelectExpands(value) {
    var boolval = makeBoolean(value)
    if (boolval != null && boolval != prop_selectExpands) {
        prop_selectExpands = value;
        if (g_bCreated)
            _tvpropSelectExpands.fireChange();
    }
}
function getExpandLevel() {
    return prop_expandLevel;
}
function setExpandLevel(value) {
    if (prop_expandLevel != value) {
        prop_expandLevel = value - ;
        if (g_bCreated) {
            expandNodes(contentNode, value);
            _tvpropExpandLevel.fireChange();
        }
    }
}
function getAutoSelect() {
    return prop_autoSelect;
}
function setAutoSelect(value) {
    var boolval = makeBoolean(value)
    if (boolval != null && boolval != prop_autoSelect) {
        prop_autoSelect = value;
        if (g_bCreated)
            _tvpropAutoSelect.fireChange();
    }
}
function getTreeNodeTypeSrc() {
    return prop_treeNodeTypeSrc;
}
function setTreeNodeTypeSrc(value) {
    if (prop_treeNodeTypeSrc != value) {
        prop_treeNodeTypeSrc = value;
        if (g_bCreated) {
            _tvpropTreeNodeTypeSrc.fireChange();
        }
    }
}
function getShowLines() {
    return prop_showLines;
}
function setShowLines(value) {
    var boolval = makeBoolean(value);
    if (prop_showLines != boolval && boolval != null) {
        prop_showLines = boolval;
        if (g_bCreated) {
            buildTreeFromRoot();
            _tvpropShowLines.fireChange();
        }
    }
}
function getShowPlus() {
    return prop_showPlus;
}
function setShowPlus(value) {
    var boolval = makeBoolean(value);
    if (prop_showPlus != boolval && boolval != null) {
        prop_showPlus = boolval;
        if (g_bCreated) {
            modifyNodesByType(contentNode, null, "_showplus");
            _tvpropShowPlus.fireChange();
        }
    }
}
function getShowToolTip() {
    return prop_showToolTip;
}
function setShowToolTip(value) {
    var boolval = makeBoolean(value);
    if (prop_showToolTip != boolval && boolval != null) {
        prop_showToolTip = boolval;
        if (g_bCreated) {
            _tvpropShowToolTip.fireChange();
        }
    }
}
function getIndent() {
    return prop_indent;
}
function setIndent(value) {
    if (prop_indent != value) {
        if (typeof value == "string") {
            var i = parseInt(value);
            if (i == NaN)
                return;
            else
                prop_indent = i;
        }
        else if (typeof value == "number")
            prop_indent = value;
        else
            return;
        if (g_bCreated) {
            if (getShowLines() != true)
                modifyNodesByType(contentNode, null, "_indent");
            _tvpropShowLines.fireChange();
        }
    }
}
function getSelectedNodeIndex() {
    return prop_selectedNodeIndex;
}
function setSelectedNodeIndex(value) {
    if (prop_selectedNodeIndex != value && typeof value == "string") {
        )
            return;
        -.]/) != -)
            return;
        ] == '.')
            return;
        )
            return;
        if (g_bCreated) {
            var node = getNodeFromIndex(value);
            if (node != null && node.subtree != null) {
                selectNode(node);
                _tvpropSelectedNodeIndex.fireChange();
            }
            else {
                ")
                    selectedNodeIndex = ";
                else
                    prop_selectedNodeIndex = "";
            }
        }
        else
            prop_selectedNodeIndex = value;
    }
}
function getSystemImagesPath() {
    return prop_systemImagesPath;
}
function setSystemImagesPath(value) {
    if (prop_systemImagesPath != value && typeof value == "string") {
        prop_systemImagesPath = value;
        if (g_bCreated) {
            buildTreeFromRoot();
            _tvpropSystemImagesPath.fireChange();
        }
    }
}
function expandNodes(root, level) {
    if (root != contentNode) {
        var exp = root.getAttribute("expanded");
        if (exp != true) {
            doNodePlusMinusClick(root);
        }
    }
    ) {
        var col = root.children.tags("treenode");
        ; i < col.length; i++) {
            expandNodes(col[i], level - );
        }
    }
}
function databind() {
    if (g_typesNode == null)
        g_typesNode = element.document.createElement("DIV");
    g_typesNode.innerHTML = getNodeTypeHtml();
    element.nodeTypes = g_typesNode.children.tags("TREENODETYPE");
    treeviewNode.subtree.removeNode(true);
    contentNode.innerText = "";
    databindNode(element);
}
function getTreeNodeType(key) {
    var tnt = null;
    var len = element.nodeTypes.length;
    if (typeof key == "number") {
         && key < len)
            tnt = element.nodeTypes[key];
    }
    else {
        ; i < len; i++) {
            var temp = element.nodeTypes[i];
            if (temp.getAttribute("Type") == key) {
                tnt = temp;
                break;
            }
        }
    }
    if (tnt != null)
        return private_getTreeNodeType(tnt);
    else
        return null;
}
function createTreeNodeType() {
    var realtnt = element.document.createElement("treenodetype");
    return private_getTreeNodeType(realtnt);
}
function private_getTreeNodeType(tnt) {
    var obj = new Object();
    obj.addTo = function (tree) {
        ) {
            g_typesNode = element.document.createElement("DIV");
            g_typesNode.appendChild(tnt);
            tree.nodeTypes = g_typesNode.children.tags("TREENODETYPE");
        }
        else {
            g_typesNode.appendChild(tnt);
            tree.nodeTypes = g_typesNode.children.tags("TREENODETYPE");
        }
        modifyNodesByType(contentNode, tnt.getAttribute("type"), "type");
    }
    obj.remove = function (bRedraw) { private_removeTreeNodeType(tnt, bRedraw); };
    obj.getAttribute = function (name) { return private_getNodeTypeAttribute(tnt, name); };
    obj.setAttribute = function (name, value) { private_setNodeTypeAttribute(tnt, name, value); };
    return obj;
}
function addTreeNodeType(tnt) {
    tnt.addTo(element);
}
function private_removeTreeNodeType(tnt, bRedraw) {
    var name = tnt.getAttribute("Type");
    tnt.removeNode(false);
    if (bRedraw != false) {
        modifyNodesByType(contentNode, null, "type");
    }
    else {
        modifyNodesByType(contentNode, null, "_nodetypeIndex");
    }
}
function modifyNodesByType(node, type, att) {
    if (node != contentNode) {
        if (node.subtree == null)
            return;
        if (type == null || getNodeAttribute(node, "Type") == type) {
            modifyNode(node, att, null, type);
            if (att == "type" || att == "childtype")
                return;
        }
    }
    var col = node.children.tags("treenode");
    ; i < col.length; i++) {
        modifyNodesByType(col[i], type, att);
    }
}
function modifyNodesInheritingFromRoot(root, att, value) {
    if (root != contentNode) {
        if (root.subtree == null)
            return;
        if (inheritsFromRoot(root, att)) {
            modifyNode(root, att, value, null);
            if (att == "type" || att == "childtype")
                return;
        }
    }
    var col = root.children.tags("treenode");
    ; i < col.length; i++) {
        modifyNodesInheritingFromRoot(col[i], att, value);
    }
}
function inheritsFromRoot(node, att) {
    if (node.getAttribute(att) != null)
        return false;
    if (getNodeTypeAttribute(node, att) != null)
        return false;
    return true;
}
function private_getNodeTypeAttribute(tnt, name) {
    return tnt.getAttribute(name.toLowerCase());
}
function private_setNodeTypeAttribute(tnt, name, value) {
    var lname = name.toLowerCase();
    if (lname == "outerhtml")
        return;
    var old = tnt.getAttribute(name, value);
    tnt.setAttribute(name, value, );
    if (tnt.parentElement == null)
        return;
    switch (lname) {
        case "text":
        case "innertext":
            break;
        case "expandable":
            if (verifyExpandableValue(value) == true)
                modifyNodesByType(contentNode, tnt.getAttribute("type"), lname);
            else
                tnt.setAttribute(name, old, );
            break;
        default:
            modifyNodesByType(contentNode, tnt.getAttribute("type"), lname);
            break;
    }
}
function createTreeNode() {
    var realNode = element.document.createElement("treenode");
    return private_getTreeNode(realNode);
}
function getTreeNode(index) {
    var node = getNodeFromIndex(index);
    if (node == null)
        return null;
    return private_getTreeNode(node);
}
function private_getTreeNode(node) {
    var obj = new Object();
    obj.addAt = function (index, newnode) {
        if (newnode._real != null)
            private_addAt(node, index, newnode._real);
        else {
            var temp = private_getTreeNode(node);
            temp._real = node;
            newnode.addTo(index, temp);
        }
    };
    obj.addTo = function (index, parent) {
        if (parent._real != null)
            private_addAt(parent._real, index, node);
        else {
            var temp = private_getTreeNode(node);
            temp._real = node;
            parent.addAt(index, temp);
        }
    };
    obj.add = function (newnode) { obj.addAt(node.children.tags("treenode").length, newnode); };
    obj.remove = function () { private_remove(node); };
    obj.databind = function () { private_databind(node); };
    obj.getAttribute = function (name) { return private_getAttribute(node, name); };
    obj.setAttribute = function (name, value) { private_setAttribute(node, name, value); };
    obj._real = null;
    obj.findAttribute = function (name) { return getNodeAttribute(node, name); };
    obj.getNodeIndex = function () {
        var index = getNodeIndex(node);
        if (index == "")
            return null;
        return index;
    };
    obj.getParent = function () {
        if (node.parentElement == null || node.parentElement.tagName.toLowerCase() != "treenode")
            return null;
        else
            return private_getTreeNode(node.parentElement);
    };
    obj.getChildren = function () { return private_getChildren(node); };
    return obj;
}
function addAt(index, node) {
    node.addTo(index, private_getTreeNode(contentNode));
}
function add(node) {
    node.addTo(contentNode.children.tags("treenode").length, private_getTreeNode(contentNode));
}
function private_addAt(parent, index, child) {
    if (child.parentElement != null)
        return;
    var col = parent.children.tags("treenode");
    var iCount = col.length;
     || index > iCount)
        return;
    var selectedNode = getNodeFromIndex(selectedNodeIndex);
    if (index == iCount)
        parent.appendChild(child);
    else {
        col[index].insertAdjacentElement("beforeBegin", child);
    }
    child.sibIndex = index;
    for (var i = index; i <= iCount; i++)
        col[i].sibIndex = i;
    if (selectedNode != null && index < selectedNode.sibIndex)
        prop_selectedNodeIndex = getNodeIndex(selectedNode);
    var p = parent;
    while (p != null && p.tagName.toLowerCase() == "treenode")
        p = p.parentElement;
    if (p != null && p.tagName.toLowerCase() != "treeview")
        return;
    if (parent.getAttribute("expanded") == true || parent == contentNode) {
        var disptree = buildTree(child, getNodeLevel(child));
        if (index == iCount) {
            if (parent.subtree == null) {
                if (parent == contentNode)
                    tryToBuildTreeFromRoot();
                else
                    parent.subtree = disptree;
            }
            else {
                if (parent == contentNode)
                    treeviewNode.subtree.appendChild(disptree);
                else
                    parent.subtree.appendChild(disptree);
            }
        }
        else
            col[index + ].subtree.insertAdjacentElement("beforeBegin", disptree);
         && col[index - ].getAttribute("expanded") == true) {
            buildTree(col[index - ], getNodeLevel(col[index - ]));
            ])) == )
                reselectNode(getNodeFromIndex(selectedNodeIndex));
        }
    }
    ) {
        if (parent != contentNode)
            replaceJunctionNode(parent);
    }
    else if (index == iCount)
        replaceJunctionNode(col[index - ]);
    )
        replaceJunctionNode(col[]);
    if (selectedNode != null)
        prop_selectedNodeIndex = getNodeIndex(selectedNode);
    else
        selectNode(child);
}
function private_remove(node) {
    if (node.parentElement == null)
        return null;
    var parent = node.parentElement;
    var col = parent.children.tags("treenode");
    var iCount = col.length;
    var sibindex = node.sibIndex;
    var selectedNode = getNodeFromIndex(selectedNodeIndex);
    var nodeIndex = getNodeIndex(node);
    node.subtree.removeNode(true);
    node.subtree = null;
    node.removeNode(true);
    node.removeAttribute("sibIndex");
    if (node.getAttribute("expanded") == false)
        node._buildChildren = true;
    )
        replaceJunctionNode(parent);
     && sibindex == iCount - )
        buildTree(col[sibindex - ], getNodeLevel(col[sibindex - ]));
     && parent.tagName.toLowerCase() != "treenode")
        replaceJunctionNode(col[]);
    for (var i = sibindex; i < col.length; i++)
        col[i].sibIndex = i;
    if (node == selectedNode ||
    (selectedNodeIndex.length > nodeIndex.length && selectedNodeIndex.substr(, nodeIndex.length + ) == nodeIndex + ".")) {
        var temp = prop_selectedNodeIndex;
        prop_selectedNodeIndex = "";
         > sibindex)
            selectNode(col[sibindex]);
         && sibindex > )
            selectNode(col[sibindex - ]);
        ")
            selectNode(parent);
        else {
            prop_selectedNodeIndex = temp;
            selectNode(null);
        }
    }
    else {
        prop_selectedNodeIndex = "";
        selectNode(selectedNode);
    }
    return node;
}
function private_databind(node) {
    var dataNodeIndex = getNodeIndex(node);
    ))
        selectNode(node);
    col = node.children.tags("treenode");
    ; i >= ; i--) {
        if (col[i].subtree != null)
            col[i].subtree.removeNode(true);
        col[i].removeNode(true);
    }
    node._bound = null;
    databindNode(node);
}
function private_getAttribute(node, name) {
    var lcName = name.toLowerCase();
    var ret = node.getAttribute(lcName);
    if (ret == null && lcName == "text") {
        );
        ret = textnode.innerText;
    }
    return ret;
}
function private_setAttribute(node, name, value) {
    var lname = name.toLowerCase();
    if (lname == "outerhtml")
        return;
    var old = node.getAttribute(name, value);
    node.setAttribute(name, value, );
    if (node.parentElement == null)
        return;
    if (node.subtree == null)
        return;
    modifyNode(node, lname, value, old);
}
function getChildren() {
    return private_getChildren(contentNode);
}
function private_getChildren(root) {
    var col = root.children.tags("treenode");
    var objArray = new Array(col.length);
    ; iNode < col.length; iNode++) {
        objArray[iNode] = private_getTreeNode(col[iNode]);
    }
    return objArray;
}
function modifyNode(node, lname, value, old) {
    switch (lname) {
        case "defaultstyle":
        case "hoverstyle":
        case "selectedstyle":
        case "style":
            );
            var stylename = oItem.className;
            if (stylename == "")
                stylename = "defaultstyle";
            SetAnchorClass(oItem, stylename);
            if (!g_bFocus && (stylename == "selectedstyle")) {
                blurFilter(oItem);
            }
            break;
        case "text":
        case "innertext":
        case "innerhtml":
            );
            var newText = generateTextNode(node);
            tntext.replaceNode(newText);
            );
            if (accessAnchor.getAttribute("title") != "")
                accessAnchor.title = newText.innerText + " : " + L_strToolTip_Text;
            reselectNode(node);
            break;
        case "imageurl":
            if (selectedNodeIndex == getNodeIndex(node)) {
                if (getNodeAttribute(node, "selectedImageUrl") == null)
                    changeIcon(node, lname);
            }
            else if (node.getAttribute("Expanded") == true)
                changeIcon(node, "expandedimageurl");
            else
                changeIcon(node, lname);
            break;
        case "selectedimageurl":
            if (selectedNodeIndex == getNodeIndex(node))
                changeIcon(node, lname);
            break;
        case "expandedimageurl":
            if (node.getAttribute("Expanded") == true && (selectedNodeIndex != getNodeIndex(node) || getNodeAttribute(node, "selectedImageUrl") == null))
                changeIcon(node, lname);
            break;
        case "type":
            buildTree(node, getNodeLevel(node));
            var temp = getNodeFromIndex(selectedNodeIndex);
            prop_selectedNodeIndex = "";
            selectNode(temp);
            break;
        case "childtype":
            var col = node.children.tags("treenode");
            ; i < col.length; i++) {
                buildTree(col[i], getNodeLevel(col[i]));
                var temp = getNodeFromIndex(selectedNodeIndex);
                prop_selectedNodeIndex = "";
                selectNode(temp);
            }
            break;
        case "target":
            );
            accessnode.target = getNodeAttribute(node, lname);
            accessnode.parentElement.target = accessnode.target;
            break;
        case "navigateurl":
            );
            var url = getNodeAttribute(node, lname);
            if (url == "" || url == null) {
                accessnode.removeAttribute("href");
                accessnode.parentElement.removeAttribute("href");
                if (url == "")
                    node.removeAttribute("navigateUrl");
            }
            else {
                accessnode.href = getNodeAttribute(node, lname);
                accessnode.parentElement.href = accessnode.href;
            }
            break;
        case "expandable":
            if (verifyExpandableValue(value) == true)
                replaceJunctionNode(node);
            else
                node.setAttribute(lname, old, );
            break;
        case "expanded":
            if (verifyBooleanAttribute(node, lname) == false)
                node.setAttribute(lname, old, );
            else if (node.getAttribute(lname) != old) {
                node.setAttribute();
                doNodePlusMinusClick(node);
            }
            break;
        case "checked":
            if (verifyBooleanAttribute(node, lname) == false)
                node.setAttribute(lname, old, );
            else if (getNodeAttribute(node, "checkBox") == true && node.getAttribute(lname) != old) {
                );
                cb.setAttribute();
            }
            break;
        case "checkbox":
            if (verifyBooleanAttribute(node, lname) == false && node.getAttribute(lname) != null)
                node.setAttribute(lname, old, );
            else if (getNodeAttribute(node, "checkbox") == true) {
                if (old != true) {
                    );
                    if (jn) {
                        var cb = createCheckBox(node);
                        jn.parentElement.insertAdjacentElement("afterEnd", cb);
                    }
                }
            }
            else {
                );
                if (cb)
                    cb.removeNode(true);
            }
            break;
        case "treenodesrc":
        case "treenodexsltsrc":
            if (value != null) {
                node.setAttribute();
                node._bound = null;
            }
            break;
        case "_showplus":
            replaceJunctionNode(node);
            break;
        case "_indent":
            var strIndex = getNodeIndex(node);
            ) {
                if (isRtl())
                    node.subtree.style.marginRight = prop_indent;
                else
                    node.subtree.style.marginLeft = prop_indent;
            }
            break;
        case "_nodetypeIndex":
            node.nodetypeIndex = undefined;
            node.inheritedType = undefined;
            break;
    }
}
function f_CleanupEvents() {
    var eventArray = window.__treeviewAttachedEvents;
    ])) {
        var newArray = new Array(false);
        ; i < eventArray.length; i++) {
            ]] == null) {
                element.document.detachEvent(]);
            }
            else {
                newArray = newArray.concat(new Array(eventArray[i]));
            }
        }
        window.__treeviewAttachedEvents = newArray;
    }
}
function f_AddStopEvent() {
    var eventArray = window.__treeviewAttachedEvents;
    if (eventArray == null) {
        eventArray = new Array(false);
    }
    element.document.attachEvent("onstop", onstop);
    eventArray[] = true;
    entry = new Array(element.uniqueID, onstop);
    window.__treeviewAttachedEvents = eventArray.concat(new Array(entry));
}
function onScroll() {
    setHiddenHelperValue();
}
function isRtl() {
    if (element.currentStyle.direction.toLowerCase() == "rtl" || element.dir.toLowerCase() == "rtl")
        return true;
    else
        return false;
}
function doVisualRefresh() {
    var display = element.style.display;
    element.style.display = "none";
    element.style.display = display;
}

TreeView.htc.js

TreeView htc 改写的更多相关文章

  1. Virtual Treeview 安装以及入门

    Virtual Treeview是一套Delphi下优秀的VCL控件,代码质量高,使用灵活.功能强大.性能非常好,可以用于表达Treeview和表格类数据.它的代码现在托管在google code上. ...

  2. 为Xamarin更好的开发而改写的库

    欢迎大家加入以下开源社区 Xamarin-Cn:https://github.com/Xamarin-Cn Mvvmcross-Cn:https://github.com/Mvvmcross-Cn  ...

  3. MVC树控件,mvc中应用treeview,实现复选框树的多层级表单控件

    类似于多层级的角色与权限控制功能,用MVC实现MVC树控件,mvc中应用treeview,实现复选框树的多层级表单控件.最近我们的项目中需要用到树型菜单,以前使用WebForm时,树型菜单有微软提供的 ...

  4. WPF 自定义列表筛选 自定义TreeView模板 自定义ListBox模板

    有很多项目,都有数据筛选的操作.下面提供一个案例,给大家做参考. 左侧是数据源,搜索框加TreeView控件,右侧是ListBox控件.在左侧数据列点击添加数据,然后点击确定,得到所筛选的数据. 下面 ...

  5. .NET跨平台之旅:基于.NET Core改写EnyimMemcached,实现Linux上访问memcached缓存

    注:支持 .NET Core 的 memcached 客户端 EnyimMemcachedCore 的 NuGet 包下载地址:https://www.nuget.org/packages/Enyim ...

  6. WinForm 进程、线程、TreeView递归加载、发送邮件--2016年12月13日

    进程:一个程序就是一个进程,但是也有一个程序需要多个进程来支持的情况 进程要使用的类是:Process它在命名空间:System.Diagnostics; 静态方法Start(); Process.S ...

  7. wpf TreeView

    <Window x:Class="WpfTutorialSamples.TreeView_control.TreeViewDataBindingSample"        ...

  8. 【转载】关于treeview的多层显示的科学用法!

    http://blogs.msdn.com/b/mikehillberg/archive/2009/10/30/treeview-and-hierarchicaldatatemplate-step-b ...

  9. winform进程、线程、TreeView递归加载

    进程: 一般来说,一个程序就是一个进程,不过也有一个程序需要多个进程支持的情况. 进程所使用的类:Process 所需命名空间:System.Diagnostics; 可以通过进行来开启计算机上现有的 ...

随机推荐

  1. Swing 顶层容器

    顶层容器值得是容纳其他容器的容器组件,包括JFrame类,JWindows类,JDialog类,JApplet等.Swing中的顶层容器类Swing提供三个顶层容器类:JFrame,JDialog和J ...

  2. javascript 字符串相关知识汇总

    ① charAt(): 选中字符串内第几个元素 <script> var str="1234567389"; alert( str.charAt(1) ); // 2 ...

  3. 手动purge优化器的统计信息与AWR快照,减少对sysaux表空间的占用

    1.运行以下脚本,计算当前优化器统计信息和AWR快照表占用sysaux的空间 SQL> conn / as sysdba SQL> @?/rdbms/admin/awrinfo.sql 2 ...

  4. 为Virtual Studio Code配置Python调试插件(Ubuntu14.04)

    详情见以下python for virtual studio code插件的链接: python 安装依赖 1.Python is installed on the current system Pa ...

  5. 【转】Java多线程编程中易混淆的3个关键字( volatile、ThreadLocal、synchronized)总结

    概述 最近在看<ThinKing In Java>,看到多线程章节时觉得有一些概念比较容易混淆有必要总结一下,虽然都不是新的东西,不过还是蛮重要,很基本的,在开发或阅读源码中经常会遇到,在 ...

  6. Java基础之读文件——使用通道读二进制数据(ReadPrimes)

    控制台程序,本例读取Java基础之写文件部分(PrimesToFile)写入的primes.bin. import java.nio.file.*; import java.nio.*; import ...

  7. hunnu 修路

    ing········ 这题我一眼就想到二分修路的长度 可是还有一个问题,有个费用,如果没有的话就所有的边都连起来判断能否二分到最小可行的 可是,有费用... 怎么做呢... ... 有了费用后,就不 ...

  8. [转]gitHub客户端Desktop的安装使用总结 ---基础篇

    gitHub客户端Desktop的安装使用总结 ---基础篇 发表于2015/12/11 11:41:57  8399人阅读 分类: Android之应用实战 这段时间想把我写的东西上传到github ...

  9. Eclipse安装Ruby插件应该注意的几点

    http://www.aptana.com/products/studio3/success_plugin.html Installing via Eclipse Please copy the fo ...

  10. Socket get http request

    package wuyubao.firstsample; import java.io.BufferedReader; import java.io.IOException; import java. ...