ver4 = (NS4 || IE4 || NS6) ? 1 : 0;

if (ver4) {
    
    with (document) {
    
        write("<STYLE TYPE='text/css'>");
        
	if (NS4) {
            write(".parent {position:absolute; visibility:visible}");
            write(".child {position:absolute; visibility:visible}");
            write(".regular {position:absolute; visibility:visible}")
        
	} else {
        
		write(".child {display:none}")
        }
        
	write("</STYLE>");
    }
    
}

isExpanded = false;

function getIndex(el) {
    ind = null;
    for (i=0; i<document.layers.length; i++) {
        whichEl = document.layers[i];
        if (whichEl.id == el) {
            ind = i;
            break;
        }
    }
    return ind;
}

function arrange() {
    nextY = document.layers[firstInd].pageY + document.layers[firstInd].document.height;
    for (i=firstInd+1; i<document.layers.length; i++) {
        whichEl = document.layers[i];
        if (whichEl.visibility != "hide") {
            whichEl.pageY = nextY;
            nextY += whichEl.document.height;
        }
    }
    
    nextY = null;
    whichEl = null;
    
}

function initIt(){
    
    if (!ver4) return;
    
    if (NS4) {
        
	for (i=0; i<document.layers.length; i++) {
            if (document.layers[i].id.indexOf("Child") != -1) { 
	    	document.layers[i].visibility = "hide";
	    }	
        }
	
	arrange();
    
    } else if (IE4) {
    
        divColl = document.all.tags("DIV");

	for (i=0; i<divColl.length; i++) {
            if (divColl[i].className == "child") { 
	    	divColl[i].style.display = "none";
	    }	
        }
	
	divColl = null;
	
    } else if (NS6) {
    
        var divColl = document.getElementsByTagName("DIV");
	
	for (i = 0; i < divColl.length; i++) {
            if (divColl[i].getAttribute("CLASS") == "child") {
		divColl[i].style.display = "hidden";
	    }
        }
	
	divColl = null;
	
    }
    
}

function expandIt(el) {
    if (!ver4) return;
    if (IE4) {
        whichEl = eval(el + "Child");
        //whichIm = event.srcElement;
	divImg = eval(document.images["imEx_" + el]);
	 
        if (whichEl.style.display == "none") {
            whichEl.style.display = "block";
            divImg.src = "images/arrow-down.jpg";        
        
	} else {
        
	    whichEl.style.display = "none";
            divImg.src = "images/arrow-up.jpg";
        }
	
	whichEl = null;
	divImg = null;
	
    } else if (NS4) {
        whichEl = eval("document." + el + "Child");
	
        whichIm = eval("document." + el + "Parent.document.images['imEx_" + el + "']");
        
	if (whichEl.visibility == "hide") {
            whichEl.visibility = "show";
            whichIm.src = "images/arrow-up.jpg";
        }
        else {
            whichEl.visibility = "hide";
            whichIm.src = "images/arrow-down.jpg";
        }
	
	whichEl = null;
	whichIm = null;
	
        arrange();
	
    } else if (NS6) {
	
	divColl = document.getElementById(el + "Child");
	divImg = document.images["imEx_" + el];
	
	if (divColl.style.display == "block") {
		divColl.style.display = "none";
		divImg.src = "images/arrow-up.jpg";
        } else {
		divColl.style.display = "block";
		divImg.src = "images/arrow-down.jpg";
	}
	
	divColl = null;
	divImg = null;
	
    }
}

function expandAll() {

    if (!ver4) return;
    
    newSrc = (isExpanded) ? "images/arrow-up.jpg" : "images/arrow-down.jpg";

    if (NS4) {
    
        document.images["imEx"].src = newSrc;
        for (i=firstInd; i<document.layers.length; i++) {
            
	    if (document.layers[i].id.indexOf("Parent") != -1) {
                document.layers[i].document.images["imEx"].src = newSrc;
            }
            
	    if (document.layers[i].id.indexOf("Child") != -1) {
                document.layers[i].visibility = (isExpanded) ? "hide" : "show";
            }
	    
        }

        arrange();
        if (isExpanded) scrollTo(0,document.layers[firstInd].pageY);
	
    } else if (IE4) {
        
	divColl = document.all.tags("DIV");
        
	a = 1;
	
	for (i=0; i<divColl.length; i++) {
            if (divColl[i].className == "child") {
                divColl[i].style.display = (isExpanded) ? "none" : "block";
            }
	    
	    divImg = eval(document.images["imEx_el" + a]);
	    if (divImg != null) {
		    divImg.src = newSrc;
	    }
	    a++;
        }
	
	
    } else if (NS6) {
    
        divColl = document.getElementsByTagName("DIV");
    
	a = 1;
    
        for (i=0; i < divColl.length; i++) {
            if (divColl[i].className == "child") {
                divColl[i].style.display = (isExpanded) ? "none" : "block";
	    }
	    
	    divImg = eval(document.images["imEx_el" + a]);
	    if (divImg != null) {
		    divImg.src = newSrc;
	    }
	    a++;
	
        }
	
	
	divColl = null;
	imColl = null;
		
    }
    
    isExpanded = !isExpanded;
}

onload = initIt;
