function preloadimgs()
{
    var imgcount = 1;
    document.imageArray = new Array(typeList.type.length * 4);
    for(var i = 0; i < typeList.type.length; i++) {
        preloadimg(imgcount++, typeList.type[i].pImg);
        preloadimg(imgcount++, typeList.type[i].mImg);
        preloadimg(imgcount++, typeList.type[i].bpImg);
        preloadimg(imgcount++, typeList.type[i].bmImg);
    }
}
function preloadimg(imgcount, imgsrc)
{
    document.imageArray[imgcount] = new Image;
    document.imageArray[imgcount].src = imgsrc;
}
function spantoggle(node_info, state)
{
    var node_id = node_info;
    node_info = node_info.split("-");
    node_img = node_info[0];
    var this_type = typeList.type[node_info[1]];
    var theSpan = document.getElementById ? document.getElementById(node_id) : document.all ? document.all[node_id] : (new Object());
    if(!theSpan) {
        return;
    }
    if(theSpan.style) {
        theSpan = theSpan.style;
    }
    if (theSpan.display == 'none') {
        var collapse = false;
    } else {
        var collapse = true;
    }
    if (state != null) {
        collapse = state;
    }
    if (collapse == false) {
        theSpan.display = 'inline';
        document.images[node_img + '_icon'].src = this_type.mImg;
        document.images[node_img + '_branch'].src = this_type.bmImg;
    } else {
        theSpan.display = 'none';
        document.images[node_img + '_icon'].src = this_type.pImg;
        document.images[node_img + '_branch'].src = this_type.bpImg;
    }
}
function spantoggleall(value)
{
    var oSpan = document.getElementsByTagName('span');
    var node_id = '';
    var this_type = '';
    for (var i = 0; i < oSpan.length; i++) {
        node_info = oSpan[i].id.split("-");
        if (node_info[1] != null) spantoggle(oSpan[i].id, value);
    }
}
function toggleclass(classname, value)
{
    var oSpan = document.getElementsByTagName('span');
    for (var i = 0; i < oSpan.length; i++) {
        if (oSpan[i].className == classname) {
            spantoggle(oSpan[i].id, value);
        }
    }
}
function typeList() {this.type = [];}
function type()
{
    this.pImg  = arguments[0];
    this.mImg  = arguments[1];
    this.bpImg = arguments[2];
    this.bmImg = arguments[3];
}
var typeList = new typeList();

