//////////////////////////////////////////////
// Cross DHTML TOC
// menu.js
// COPYRIGHT kees 2000
// Last modified : april 2000
//////////////////////////////////////////////
var imagemap='menu/images/';
var iconWidth		= "22";	// breedte icoon
var iconHeight		= "22";	// hoogte icoon
var closeOtherFolders	=false;	// als true worden de andere folders gesloten als je een folder opent.
var plusMin		=false;	// als true kan je klikken op plus of min teken
var itemImage		=true;	// als true dan krijgt item image anders niet
var showIcons		=true;	// als true dan worden icoontjes getoond, anders niet
var showRoot		=true;	// als false dan wordt de Root niet getoond
var firstToc //= new TgSpToc_toc('firstToc');


//--------------------------------------------
var spatie=''//'&nbsp;'
var firstFolder='';
var lastFolder='';
var blnTest=false;
var C_root=0;
var C_folder=1;
var C_item=2;
var C_colexp=3;
function maakRoot(description,link,target,icon,klasse)
{ 	firstToc = new TgSpToc_toc('firstToc');
	var objname=makeObjname();
	firstFolder=objname; 
	lastFolder=objname;
	eval(objname + '=firstToc.makeFolder(objname,description,link,target,icon,klasse,C_root)');
} 
//...........
function maakFolder(infolder,description,link,target,icon,klasse)
{ 	var objname=makeObjname(); 
	parentFolder=getParentFolder(infolder)
	eval(objname + '=firstToc.makeFolder(objname,description,link,target,icon,klasse,C_folder)');
	lastFolder=objname;
	eval('firstToc.insertNode(' + parentFolder + ',' + objname + ')');
}
//...........
function maakItem(infolder,description,link,target,icon,klasse)
{ 	var objname=makeObjname();
	parentFolder=getParentFolder(infolder)
	eval(objname + '=firstToc.makeItem(objname,description,link,target,icon,klasse,C_item)');
	eval('firstToc.insertNode(' + parentFolder + ',' + objname + ')');
}
//...........
function maakCollapsExpand(infolder)
{ 	iconCollaps= imagemap + 'collapseall.gif'
	iconExpand=  imagemap + 'expandall.gif'
	var objname=makeObjname();
	parentFolder=getParentFolder(infolder);
	linkExpand= '<A HREF=\"javascript:' + parentFolder + '.expandAll();void(0);\"><IMG SRC=' + iconExpand + ' border=0></A>'
	linkCollaps= '<A HREF=\"javascript:' + parentFolder + '.expand(1);void(0);\"><IMG SRC=' + iconCollaps + ' border=0></A>'
	//linkExpand= '<IMG SRC=\"' + iconExpand + '\" border=1>'
	//linkCollaps= '';//'<IMG SRC=\"' + iconCollaps + '\" border=1>'
	
	description=linkExpand + linkCollaps;
	icon=imagemap + 'space.gif';
	eval(objname + '=firstToc.makeItem(objname,description,\'\',\'\',icon,null,C_colexp)');
	eval('firstToc.insertNode(' + parentFolder + ',' + objname + ')');
	//alert(eval(objname + '.desc'))
}

//...........




var objTel=0;
function makeObjname()
{ 	var objname='obj_'+ objTel; 
	objTel+=1; 
	return(objname);
}
//...........
function getParentFolder(infolder)
{ 	if  (infolder=='') return(lastFolder);
	else
	{	var ret='notfound';
		i=0;
		while (i < objTel-1 & ret=='notfound')
		{	if (eval('obj_' + i +'.isFolder') & eval('obj_' + i +'.desc')==infolder) ret='obj_' + i;
			i++;
		}
		return(ret);	
	}
}
//..........


function openMenu()
{ firstToc.display (eval(firstFolder),1)
}
//////////////////////////////////////////////

// TgSpToc_toc
// Constructor	 
function TgSpToc_toc(tocName)
{ 	
	// Data member
	//////////////////////////////
	this.test='';
	this.soort=-1;
	this.objname=''
	this.name= tocName
	this.parentFolder=''
	this.naam=''
	this.doc = document 
	this.rootNode = 0	
	this.nodesIndex = new Array 
	this.nodesCounter = 0 	
	this.currentTopPos = 0
	this.showRoot = showRoot
	this.showIcons =showIcons
	this.showTextLinks = true 
	if (this.doc.all) 
		this.browserVersion = 1 
	else 
		if (this.doc.layers) 
			this.browserVersion = 2 //2 
		else	 
			this.browserVersion = 0 
	
	// Styles
	this.styleItemFolderLink=0
	this.styleItemFolderNoLink=0
	this.styleItemLink=0
	this.styleItemNoLink=0

	// Icons
	this.iconPath			= imagemap
	this.iconWidth			= iconWidth
	this.iconHeight			= iconHeight
	if (plusMin==true)
	{	this.iconPlus		= imagemap + "plus.gif";  
		this.iconMinus		= imagemap + "minus.gif"; 
		this.iconPlus1		= imagemap + "plus1.gif"; 
		this.iconPlus2		= imagemap + "plus2.gif"; 
		this.iconMinus1		= imagemap + "minus1.gif";
		this.iconMinus2		= imagemap + "minus2.gif";
	} else 
	{	this.iconPlus	= imagemap + "empty.gif";
		this.iconMinus	= imagemap + "empty.gif";
		this.iconPlus1	= imagemap + "line1.gif";
		this.iconPlus2	= imagemap + "line2.gif";
		this.iconMinus1	= imagemap + "line1.gif";
		this.iconMinus2	= imagemap + "line2.gif";
	}

	this.iconItem			= imagemap + "item.gif"
	this.iconFolderCollapsed	= imagemap + "foldercol.gif"
	this.iconFolderExpanded		= imagemap + "folderexp.gif"
	this.iconEmpty			= imagemap + "empty.gif"
	this.iconLine1			= imagemap + "line1.gif"
	this.iconLine2			= imagemap + "line2.gif"
	this.iconLine3			= imagemap + "line3.gif"
	this.iconLine4			= imagemap + "line4.gif"

	// Methods
	this.display		= TgSpToc_tocDisplay	
	this.makeFolder		= TgSpToc_tocmakeFolder
	this.makeItem		= TgSpToc_tocmakeItem
	this.insertNode		= TgSpToc_tocInsertNode
	this.nodeClicked	= TgSpToc_tocnodeClicked	
	this.expand		= TgSpToc_tocExpand
	this.expandAll		= TgSpToc_tocExpandAll	
	this.collapseAll	= TgSpToc_tocCollapseAll

}

// TgSpToc_tocDisplay
// Display the Toc
function TgSpToc_tocDisplay(startNode,expandLevel) 
{   
	this.rootNode = startNode

	if (!this.showIcons){
		this.iconPlus1			= this.iconPlus
		this.iconPlus2			= this.iconPlus
		this.iconMinus			= this.iconMinus
		this.iconMinus1			= this.iconMinus		
		this.iconMinus2			= this.iconMinus				
		this.iconLine3			= this.iconEmpty	
	}

	if (this.browserVersion == 2) 
		this.doc.write("<ILAYER position='relative' id='" + this.name +"'>\n")   

	this.rootNode.initialize(0, 1, '') 
	this.rootNode.display()

	if (this.browserVersion == 2) 
		this.doc.write("</ILAYER>\n")   

	if (this.browserVersion > 0){ 	
		 this.rootNode.expand(expandLevel)				 		 
	} 	
} 

// TgSpToc_tocmakeFolder
// Create a folder
function TgSpToc_tocmakeFolder(objname,description,href,target,icon,klasse,soort) 
{ 	
	newFolder = new TgSpToc_folder(this,objname,description,href,target,icon,klasse,soort) 

	return newFolder ;
} 

// TgSpToc_tocmakeItem
// Create a item
function TgSpToc_tocmakeItem(objname,description, href,target,icon,klasse,soort) 
{ 	
	newItem = new TgSpToc_item(this,objname,description, href,target,icon,klasse,soort)           
	return newItem
} 

// insertNode
// Insert a item
function TgSpToc_tocInsertNode(parentFolder, nodeToInsert) 
{ 	nodeToInsert.parentFolder=parentFolder; 
	return parentFolder.addChild(nodeToInsert)  

} 


// nodeClicked
// Event
function folder(nodeId) 
{	var clickedNode = firstToc.nodesIndex[nodeId] 
	var status=clickedNode.isExpanded
	if (closeOtherFolders)
	{	clickedNode.parentFolder.setState(false) // parentfolder sluit
		clickedNode.parentFolder.setState(true)  // parentfolder gaat open
		clickedNode.setState(status)
	}
	eval('firstToc.nodeClicked(' + nodeId + ')');
}

function TgSpToc_tocnodeClicked(nodeId) 
{ 	var clickedNode = this.nodesIndex[nodeId] 
	clickedNode.setState(!clickedNode.isExpanded) 
} 

// TgSpToc_tocExpandAll
// 
function TgSpToc_tocExpandAll() 
{ 
	this.rootNode.expandAll();
} 


// TgSpToc_tocExpand
// 
function TgSpToc_tocExpand(maxlevel) 
{ 	this.rootNode.expand(maxlevel);
} 


// TgSpToc_tocCollapseAll
// 
function TgSpToc_tocCollapseAll() 
{ 		
	this.expand(1)
}




// TgSpToc_folder
// Constructor
function TgSpToc_folder(activeToc,objname,description,href,target,icon,klasse,soort) 
{ 	

	
	
	// Data member
	this.soort=soort; 
	this.test=''; if (blnTest) this.test=' (' + this.soort + ')' 
	this.objname=objname;
	this.id = -1   
	this.toc = activeToc
	this.desc = description; 
	this.href = href
	this.target = target
	this.layer = 0  
	this.iconSrc = this.toc.iconFolderExpanded
	this.iconPersoSrc = icon
	if (icon)
		this.iconSrc = this.iconPersoSrc
	if (klasse) this.klasse = 'class=\"'+ klasse + '\"';

	this.iconImg = 0  
	this.nodeImg = 0  
	this.isLastNode = 0 
	this.isExpanded = true   
	this.isFolder = true   
	this.children = new Array 
	this.childrensCounter = 0 

	// Methods
	this.initialize		= TgSpToc_folderInitialize 
	this.setState		= TgSpToc_folderSetState 
	this.addChild		= TgSpToc_folderAddChild 
	this.createIndex	= TgSpToc_createIndex 
	this.hide		= TgSpToc_folderHide 
	this.display		= TgSpToc_display 
	this.draw		= TgSpToc_folderDraw 
	this.totalHeight	= TgSpToc_totalHeight 
	this.subEntries		= TgSpToc_folderSubEntries 
	this.outputLink		= TgSpToc_folderOutputLink 
	this.expand		= TgSpToc_folderExpand
	this.expandAll		= TgSpToc_folderExpandAll
	this.expandRec		= TgSpToc_folderExpandRec
	
} 

// TgSpToc_folderInitialize
// 
function TgSpToc_folderInitialize(level, lastNode, leftSide) 
{ 	
	var j=0 
	var i=0 
	var numberOfFolders 
	var numberOfDocs 
	var nc 
	
	nc = this.childrensCounter 

	this.createIndex() 

	if (level==0 && !this.toc.showRoot) {
		   
	}
	else {
	   var auxEv = '' 
	   if (this.toc.browserVersion > 0 & plusMin) 

	 	auxEv ="<a href='javascript:folder("+this.id+")'>" 
	
	   else 
		 auxEv = "<a>"
		 
	   if (level>0)
		 if (lastNode) //the last 'brother' in the children array 
		 { 
		   this.draw(leftSide + auxEv + "<img name='" + this.toc.name + "nodeIcon" + this.id + "' src='" + this.toc.iconMinus1 + "' width=" + this.toc.iconWidth + " height=" + this.toc.iconHeight + " border=0></a>")
		   leftSide = leftSide + "<img src='" + this.toc.iconEmpty + "' width=" + this.toc.iconWidth + " height=" + this.toc.iconHeight + ">" 
			
		   this.isLastNode = 1 
		 } //this.toc.iconEmpty
		 else 
		 { 
		   this.draw(leftSide + auxEv + "<img name='" + this.toc.name + "nodeIcon" + this.id + "' src='" + this.toc.iconMinus2 + "' width=" + this.toc.iconWidth + " height=" + this.toc.iconHeight + " border=0></a>") 
		   leftSide = leftSide + "<img src='" + this.toc.iconLine3 + "' width=" + this.toc.iconWidth + " height=" + this.toc.iconHeight + ">" 
		   this.isLastNode = 0 
		  } 
	   else 
		 this.draw('') 
	} 
	

	if (nc > 0) 
	{ 
	 level = level + 1 
	 for (i=0 ; i < this.childrensCounter; i++)  
	 { 
	   if (i == this.childrensCounter-1) 
		 this.children[i].initialize(level, 1, leftSide) 
	   else 
		 this.children[i].initialize(level, 0, leftSide) 
	  } 
		
	}  
} 

// TgSpToc_folderDraw
// 
function TgSpToc_folderDraw(leftSide) 
{ 	//alert(this.toc.rootNode.id)
	if (this.soort!=C_colexp) spat=spatie; else spat='';
	if (this.toc.browserVersion == 2) { 
		if (!this.toc.currentTopPos) 
			this.toc.currentTopPos=8 
		this.toc.doc.write("<layer postion='absolute' id='" + this.toc.name + "folder" + this.id + "' top=" + this.toc.currentTopPos + " visibility=hidden>\n") 
	} 

	this.toc.doc.write("<table ") 
	if (this.toc.browserVersion == 1) 
		this.toc.doc.write(" id='" + this.toc.name + "folder" + this.id + "' style='position:block;' ")   
	this.toc.doc.write(" border=0 cellspacing=0 cellpadding=0>\n") 

	this.toc.doc.write('<tr><td>') 
	//alert(this.desc + '\n' + leftSide)
	this.toc.doc.write(leftSide) 
	if (this.toc.showIcons){
		this.outputLink() 
	
		//auxEv ="<a href='javascript:" + this.toc.name +".nodeClicked("+this.id+")'>"; 
		auxEv ="<a href='javascript:folder("+this.id+")'>"; 
	
		if (this.id==0) auxEv=''
		this.toc.doc.write(auxEv + "<img name='" + this.toc.name + "folderIcon" + this.id + "' ") 
		this.toc.doc.write("src='" + this.iconSrc + "' border=0>");
		this.toc.doc.write("</a>");
		
	}
	
	this.toc.doc.write('</td><td valign=middle nowrap ' + this.klasse + '>') 
	if (this.toc.showTextLinks && this.href){ 
		this.outputLink() 
		this.toc.doc.write(spat + '<b>' + this.desc + this.test  + '</b></a>') 		
	} 
	else 
	{	auxEv ="<a href='javascript:folder("+this.id+")'>"; 
		auxEv='';
		this.toc.doc.write(spat + "<b><font class='" + this.toc.styleItemFolderNoLink + "'>" + auxEv + this.desc + this.test + "</font></b>")
	}
	this.toc.doc.write('</td>')  
	this.toc.doc.write("</table>\n") 

	if (this.toc.browserVersion == 2) { 
		this.toc.doc.write("</layer>\n\n") 
	} 

	if (this.toc.browserVersion == 1) { 
		this.layer  = eval(this.toc.name + "folder" + this.id)	
		if (this.toc.showIcons)
			this.iconImg = eval(this.toc.name + "folderIcon"+ this.id)	
		if (this.id>0)
			  this.nodeImg = eval(this.toc.name + "nodeIcon" + this.id) 			
	} 
	if (this.toc.browserVersion == 2) { 
		this.layer  = eval("document." + this.toc.name +".document." + this.toc.name + "folder"+this.id);
		if (this.toc.showIcons)
			this.iconImg = this.layer.document.images[this.toc.name +"folderIcon"+this.id] 
		if (this.id>0)
			this.nodeImg = this.layer.document.images[this.toc.name +"nodeIcon"+this.id] ;
		this.toc.currentTopPos=this.toc.currentTopPos+this.layer.clip.height 
	} 
} 


// TgSpToc_folderOutputLink
// 
function TgSpToc_folderOutputLink() 
{ 
	if (this.toc.browserVersion > 0) 		
		if (this.href)
			this.toc.doc.write("<a class='" + this.toc.styleItemFolderLink + "' href='" + this.href +  "' target='" + this.target + "'>") 		
} 

// TgSpToc_folderSetState
// Change the state of a folder
function TgSpToc_folderSetState(isExpanded) 
{	
	var subEntries 
	var totalHeight 
	var fIt = 0 
	var i=0 

	if (isExpanded == this.isExpanded) 
		return 

	if (this.toc.browserVersion == 2){ 
		totalHeight = 0 
		for (i=0; i < this.childrensCounter; i++) 
			totalHeight = totalHeight + this.children[i].layer.clip.height 
		subEntries = this.subEntries() 
		if (this.isExpanded) 
			totalHeight = 0 - totalHeight 
		for (fIt = this.id + subEntries + 1; fIt < this.toc.nodesCounter; fIt++) 
			this.toc.nodesIndex[fIt].layer.moveBy(0, totalHeight) 
	}  
	this.isExpanded =isExpanded 
	TgSpToc_applyChanges(this) 
} 


// hide folder
// 
function TgSpToc_folderHide() 
{ 
	if (this.toc.browserVersion >0) { 
	  if (this.toc.browserVersion == 1) { 
		if (this.layer.style.display == 'none') 
		  return 
		this.layer.style.display = 'none'
	  } else { 
		if (this.layer.visibility == 'hidden') 
		  return 
		this.layer.visibility = 'hidden'
	  } 
	  this.setState(0) 
	}
} 


// TgSpToc_folderAddChild
// 
function TgSpToc_folderAddChild(childNode) 
{ 	this.children[this.childrensCounter] = childNode 
	this.childrensCounter++ 
	return childNode 
} 

// TgSpToc_folderSubEntries
// 
function TgSpToc_folderSubEntries() 
{ 	
	var i = 0 
	var se = this.childrensCounter 
	for (i=0; i < this.childrensCounter; i++){ 
		if (this.children[i].children)
		  se = se + this.children[i].subEntries() 
	} 
	return se 
} 



// TgSpToc_folderExpandAll
// 
function TgSpToc_folderExpandAll() 
{ 		
	this.expand(1000)
}

// TgSpToc_folderExpand
// 
function TgSpToc_folderExpand(maxLevel) 
{ 		
	if (this.isExpanded)
		this.toc.nodeClicked(this.id)
	var currentLevel = 1
	if (maxLevel)
		this.expandRec(maxLevel,currentLevel)
	else
		this.expandRec(1,currentLevel)
}

// TgSpToc_folderExpand
// 
function TgSpToc_folderExpandRec(maxlevel,currentlevel) 
{ 
	var i = 0 	
	this.toc.nodeClicked(this.id)
	if 	(currentlevel<maxlevel){	
		currentlevel++;
		for (i=0; i < this.childrensCounter; i++){ 
			if (this.children[i].isFolder)						
						this.children[i].expandRec(maxlevel,currentlevel) 		
		} 
	}	
} 



// TgSpToc_item
// Constructor
function TgSpToc_item(activeToc,objname,description, href,target,icon,klasse,soort)
{ 
	// Data member
	
	this.soort=soort; 
	this.test=''; if (blnTest) this.test=' (' + this.soort + ')'  
	this.objname=objname
	this.id = -1 
	this.toc = activeToc
	this.desc = description; 
	this.isFolder = false
	this.href = href 
	this.target = target  
	this.layer = 0 
	this.iconImg = 0 
	this.iconSrc = this.toc.iconItem 
	if (icon)
	this.iconSrc = icon
	if (klasse) this.klasse = 'class=\"'+ klasse + '\"';
	// Methods
	this.initialize		= TgSpToc_itemInitialize 
	this.draw		= TgSpToc_itemDraw 
	this.hide		= TgSpToc_itemHide 
	this.createIndex	= TgSpToc_createIndex   
	this.display		= TgSpToc_display   
	this.totalHeight	= TgSpToc_totalHeight 
} 

// TgSpToc_itemInitialize
// 
function TgSpToc_itemInitialize(level, lastNode, leftSide) 
{  
	this.createIndex() 
	if (level>0) 
		if (lastNode){ 
			if (this.toc.showIcons) {  
				this.draw(leftSide + "<img src='" + this.toc.iconLine1 + "' width=" + this.toc.iconWidth + " height=" + this.toc.iconHeight + ">")
				leftSide = leftSide + "<img src='" + this.toc.iconEmpty + "' width=" + this.toc.iconWidth + " height=" + this.toc.iconHeight + ">"  
				//alert(this.desc)
				}
			else 
				this.draw(leftSide +"<img src='" + this.toc.iconEmpty + "' width=" + this.toc.iconWidth + " height=" + this.toc.iconHeight + ">") 
		} 
		else { 
		   if (this.toc.showIcons) {  
				this.draw(leftSide + "<img src='" + this.toc.iconLine2 + "' width=" + this.toc.iconWidth + " height=" + this.toc.iconHeight + ">") 
				leftSide = leftSide + "<img src='" + this.toc.iconLine3 + "' width=" + this.toc.iconWidth + " height=" + this.toc.iconHeight + ">" 
			    } 
		   else 
				this.draw(leftSide +"<img src='" + this.toc.iconEmpty + "' width=" + this.toc.iconWidth + " height=" + this.toc.iconHeight + ">")
		} 
	else
		this.draw('')
} 

// TgSpToc_itemDraw
// 
function TgSpToc_itemDraw(leftSide) 
{ 	if (this.soort!=C_colexp) spat=spatie; else spat='';
	if (this.toc.browserVersion == 2) 
		this.toc.doc.write("<layer postion='absolute' id='" + this.toc.name + "item" + this.id + "' top=" + this.toc.currentTopPos + " visibility=hidden>\n") 

	this.toc.doc.write("<table ") 
	if (this.toc.browserVersion == 1) 
		this.toc.doc.write(" id='" + this.toc.name + "item" + this.id + "' style='position:block;' ") 
	this.toc.doc.write(" border=0 cellspacing=0 cellpadding=0>\n") 

	this.toc.doc.write('<tr><td>') 

	this.toc.doc.write(leftSide) 
		//var k=firstToc.nodesIndex[this.id]
		//alert(k.desc) 
		//alert(this.id) 
	if (this.toc.showIcons & itemImage & this.soort!=C_colexp) {  
		if (this.href)
			this.toc.doc.write("<a href='" + this.href + "' target='" + this.target + "'>") 
		this.toc.doc.write("<img id='" + this.toc.name + "itemIcon" + this.id +"' src='"+ this.iconSrc +"' border=0>") 
		if (this.href)
			this.toc.doc.write('</a>') 
	}
	this.toc.doc.write('</td><td valign=middle nowrap ' + this.klasse + '>') 

	if (this.href && this.toc.showTextLinks) 
		this.toc.doc.write(spat + "<a class='" + this.toc.styleItemLink + "' href='" + this.href + "' target='" + this.target + "'>" + this.desc + this.test + "</a>") 
	else 
		if (this.desc!='') this.toc.doc.write(spat +"<font class='" + this.toc.styleItemNoLink + "'>" + this.desc + this.test + "</font>")

	//if (this.id==5) alert(this.desc + '\n' + this.href)
	this.toc.doc.write("</table>\n") 

	if (this.toc.browserVersion == 2) 
		this.toc.doc.write("</layer>\n\n") 

	if (this.toc.browserVersion == 1) { 
		
		this.layer = eval(this.toc.name + "item" + this.id)
		if (this.toc.showIcons & itemImage & this.soort!=C_colexp)
			this.iconImg = eval(this.toc.name + "itemIcon"+ this.id)        
	} 
	if (this.toc.browserVersion == 2) { 		
		this.layer = eval("document." + this.toc.name +".document." + this.toc.name + "item"+this.id);		
		this.iconImg = this.layer.document.images[this.toc.name + "itemIcon"+this.id] 
		this.toc.currentTopPos=this.toc.currentTopPos+this.layer.clip.height 
	} 
} 

// TgSpToc_itemHide
// 
function TgSpToc_itemHide() 
{ 
	if (this.toc.browserVersion >0) { 
		if (this.toc.browserVersion == 1) { 
			if (this.layer.style.display == 'none') 
			  return 
			this.layer.style.display = 'none' 
		} else { 
			if (this.layer.visibility == 'hidden') 
				return 
			this.layer.visibility = 'hidden' 
		}     
	}
} 


// TgSpToc_applyChanges
// 
function TgSpToc_applyChanges(folder) 
{   
	var i=0 
	if (folder.isExpanded){ 
	
		if (folder.nodeImg) 
			if (folder.isLastNode) 
				folder.nodeImg.src = folder.toc.iconMinus1
			else 
				folder.nodeImg.src = folder.toc.iconMinus2

		if (folder.iconPersoSrc)
			folder.iconImg.src =folder.iconPersoSrc
		else
			folder.iconImg.src = folder.toc.iconFolderExpanded 
			

		for (i=0; i<folder.childrensCounter; i++) 
			folder.children[i].display() 
	} 
	else { 
		if (folder.nodeImg) 
			if (folder.isLastNode) 
				folder.nodeImg.src = folder.toc.iconPlus1 
			else 
				folder.nodeImg.src = folder.toc.iconPlus2

		if (folder.iconPersoSrc)
			folder.iconImg.src =folder.iconPersoSrc
		else
			if (folder.id==0) folder.iconImg.src = folder.toc.iconRoot;
			else
			{	folder.iconImg.src = folder.toc.iconFolderCollapsed
			}

		for (i=0; i<folder.childrensCounter; i++) 
			folder.children[i].hide() 
	}  
} 

// TgSpToc_display
// 
function TgSpToc_display() 
{ 	var obj=this.layer;
	

	if (obj){
		if (this.toc.browserVersion == 1)
			obj.style.display = 'block' 
		else 
			obj.visibility = 'show' 
	}
} 




// TgSpToc_createIndex
// 
function TgSpToc_createIndex() 
{ 
	this.id = this.toc.nodesCounter       
	this.toc.nodesIndex[this.toc.nodesCounter] = this 
	this.toc.nodesCounter++   
	
} 

// TgSpToc_totalHeight
// 
function TgSpToc_totalHeight()
{ 
	var h = this.layer.clip.height 
	var i = 0 
	if (this.isExpanded)
		for (i=0 ; i < this.childrensCounter; i++)  
			h = h + this.children[i].TgSpToc_totalHeight() 
	return h 
} 

function loopTree(obj)
{ 	var i=0;
	var n='';
	n+='\n obj.objname=' + obj.objname;
	n+='\n obj.desc=' + obj.desc;
	n+='\n obj.isFolder=' + obj.isFolder
	n+='\n obj.childrensCounter=' + obj.childrensCounter;
	alert(n)
	if (obj.isFolder)		
		for (i=0; i < obj.childrensCounter; i++) loopTree(obj.children[i])

}



// END

