<!--

function initTree() {
    var ms = navigator.appVersion.indexOf("MSIE");
    ie4 = (ms>0) && (parseInt(navigator.appVersion.substring(ms+5, ms+6)) >= 4);
    if(!ie4) return;
    coll=document.all.tags("DIV")
    for(i=0; i<coll.length; i++) {
        if(TreeEnabled(coll[i])) {
            if(initCollapse(coll[i])) coll[i].style.display="none"
        }
    }
    if (top.location.href != window.location.href) {
        coll=document.all.tags("a")
        for (i=0;i<coll.length;i++){
            if (coll[i].getAttribute("href",2) == parent.mainPage){
//            coll[i].style.textDecorationUnderline = true
                src=coll[i].parentElement
coll[i].style.backgroundColor = "#E0EAF3"
// test version - 2 lines
                while ("BODY" != src.parentElement.tagName) {
                    if ("DIV" == src.parentElement.tagName) {
                        for (j=0;j<src.parentElement.children.length;j++){
                            if ("DIV" == src.parentElement.children(j).tagName) src.parentElement.children(j).style.display = ""
                            if ("IMG" == src.parentElement.children(j).tagName) {
                                ind = src.parentElement.children(j).src.lastIndexOf("/")
                                filename = src.parentElement.children(j).src.substr(ind + 1)
                                if ("plus.gif" == filename) src.parentElement.children(j).src = "images/minus.gif"
                                if ("plusbottom.gif" == filename) src.parentElement.children(j).src="images/minusbottom.gif"
                                if ("folder.gif" == filename) src.parentElement.children(j).src="images/folder_o.gif"
                            }
                        }
                    }
                    src=src.parentElement
                }
            }
        }
    }
//----------------------
}

function TreeEnabled(src) {
    while ("BODY" != src.tagName) {
        if("DIV" == src.tagName) {
            if(null != src.getAttribute("noTree", false)) return false
            if(null != src.getAttribute("myTree", false)) return true
        }
        src = src.parentElement
    }
    return false
}

function initCollapse(src) {
    while ("BODY" != src.tagName) {
        if ("DIV" == src.tagName) {
            if (null != src.parentElement.getAttribute("initcollapsed", false))
            return true
        }
        src = src.parentElement
    }
    return false
}

function myTree() {
    var ms = navigator.appVersion.indexOf("MSIE");
    ie4 = (ms>0) && (parseInt(navigator.appVersion.substring(ms+5, ms+6)) >= 4);
    if(!ie4) return;
    var src = event.srcElement

    src = getControlTag(src)
    if (null == src) return
    if (!TreeEnabled(src)) return


    if ("A" == event.srcElement.tagName) {
        coll=document.all.tags("A")
        for(i=0; i<coll.length; i++) {
            if(TreeEnabled(coll[i])) coll[i].style.backgroundColor=""
        }
        event.srcElement.style.backgroundColor="#E0EAF3"
    }
    var idx = src.sourceIndex+1
    while (idx < document.all.length) {
        if (containedIn(document.all[idx], src))
        {
            srcTmp = document.all[idx]
            tag = srcTmp.tagName
            if ("DIV" == tag) {
                srcTmp.style.display = srcTmp.style.display == "none" ? "" : "none"
            } 
            if ("IMG" == tag ) {
                atr = srcTmp.getAttribute("src")
                atr = atr.substr(atr.lastIndexOf("/") + 1)
                if (atr == "plustop.gif") srcTmp.setAttribute("src","images/minustop.gif")
                if (atr == "minustop.gif") srcTmp.setAttribute("src","images/plustop.gif")
                if (atr == "plusbottom.gif") srcTmp.setAttribute("src","images/minusbottom.gif")
                if (atr == "minusbottom.gif") srcTmp.setAttribute("src","images/plusbottom.gif")
                if (atr == "plus.gif") srcTmp.setAttribute("src","images/minus.gif")
                if (atr == "minus.gif") srcTmp.setAttribute("src","images/plus.gif")
                if (atr == "folder.gif") srcTmp.setAttribute("src","images/folder_o.gif")
                if (atr == "folder_o.gif") srcTmp.setAttribute("src", "images/folder.gif")
            }
        }
        idx++;
    }
}

function getControlTag(src) {
    src = src.parentElement
    while (("HTML" != src.tagName) && ("DIV" != src.tagName)) {
        src = src.parentElement
    }
    if ("DIV" == src.tagName) return src
    return null
}

function containedIn(src, dest) {
    if ("!" == src.tagName) return true
    src = getControlTag(src)

    if ((src == dest) && (dest.getAttribute("ID") != "autonav")) return true
    return false
}
//-->
