function init()
{
    var topFolderNode;
    var firstFolder;
    topFolderNode = document.getElementById("topFolder");
    firstFolder = topFolderNode.firstChild.firstChild;
    clickFolder(firstFolder);
		
}
/*function init(id)
{
	if(id==0){
    var topFolderNode;
    var firstFolder;
    topFolderNode = document.getElementById("topFolder");
    firstFolder = topFolderNode.firstChild.firstChild;
    clickFolder(firstFolder);
	}else{
	var topFolderNode;
    var firstFolder;
    topFolderNode = document.getElementById("topFolder");
    firstFolder = topFolderNode.firstChild.firstChild;    
	
	var thisFolderNode;
    var thisFolder;
    thisFolderNode = document.getElementById(id);
    thisFolder = thisFolderNode.firstChild;
	
	
    clickFolder(thisFolder);
	if(topFolderNode.firstChild.className != "folder"){
	clickFolder(firstFolder);
	}
	
	thisFolder.scrollIntoView();
	//window.scrollTo(thisFolderNode.clientLeft,thisFolderNode.clientTop);
	//window.scrollTo(900,700)
	}
	//alert(document.links.length);
	//for(i=0;i<document.links.length-1;i++){
	//	clickFolder(document.links[i]);
	//}
}

*/
function clickFolder(thisLink)
{
    var thisFolder;
    var thisImage;
    var newClass;
    var newSource;

    thisFolder = thisLink.parentNode;
    thisImage = thisLink.firstChild;

    if (thisFolder.className == "folder")
    {
        newClass = "folderClosed";
        newSource = "/scripts/images/folder.gif";
    }
    else
    {
        newClass = "folder";
        newSource = "/scripts/images/open_folder.gif";
    }

    thisFolder.className = newClass;
    thisImage.setAttribute("src", newSource);
}

function overFolder(thisLink)
{
    thisLink.className = "hiLite";
}

function outFolder(thisLink)
{
    thisLink.className = "loLite";
}
var treeStat = 0;
function expandAll() {
//in case if top level is closed - open it
topFolderNode = document.getElementById("topFolder");
if (topFolderNode.firstChild.className == "folderClosed") init();
//loop trhough all links and open closed
	for(i=0;i<document.links.length-1;i++){
			thisLink = document.links[i];
			thisFolder = thisLink.parentNode;
			thisImage = thisFolder.firstChild.firstChild;
			if (thisFolder.className == "folderClosed") {
			newSource = "images/open_folder.gif";
			thisImage.setAttribute("src",newSource);
			thisFolder.className = "folder";
			
			}
	}

}

function collapseAll () {
//close all open folders
	for(i=0;i<document.links.length-1;i++){
			thisLink = document.links[i];
			thisFolder = thisLink.parentNode;
			thisImage = thisFolder.firstChild.firstChild;
			if (thisFolder.className == "folder") {
			newSource = "images/folder.gif";
			thisImage.setAttribute("src",newSource);
			thisFolder.className = "folderClosed";
			
			}
	}

}