//============================================
//============================================
// DEFINITION OF FOLDER OBJECT
//============================================
function Folder (folderDescription, hreference)
{
        // members / properties
        this.desc = folderDescription
        this.hreference = hreference
        this.id=-1
        this.level = -1
        this.navObj=0
        this.iconImg=0
        this.nodeImg=0
        this.isLastNode=0
        this.isOpen=true
        //this.iconSrc=gTopLevel + "/Images/empty.gif";
        this.children=new Array
        this.nChildren=0
        // methods
        this.initialize  = initializeFolder
        this.setState    = setStateFolder
        this.addChild    = addChild
        this.hide        = hideFolder
        this.renderOb    = drawFolder
        this.subEntries  = folderSubEntries
        this.outputLink  = outputFolderLink
        // shared methods
        this.createIndex = createEntryIndex
        this.display     = display
        this.totalHeight = totalHeight
        this.ypos		 = ypos
}
//============================================
// DEFINITION OF EXTFOLDER OBJECT FOR EXTERNAL LINKS
//============================================
function ExtFolder (folderDescription, hreference)
{
        // members / properties
        this.desc = folderDescription
        this.hreference = hreference
        this.id=-1
        this.level = -1
        this.navObj=0
        this.iconImg=0
        this.nodeImg=0
        this.isLastNode=0
        this.isOpen=true
        //this.iconSrc=gTopLevel + "/Images/empty.gif";
        this.children=new Array
        this.nChildren=0
        // methods
        this.initialize  = initializeFolder
        this.setState    = setStateFolder
        this.addChild    = addChild
        this.hide        = hideFolder
        this.renderOb    = drawFolder
        this.subEntries  = folderSubEntries
        this.outputLink  = outputExtFolderLink
        // shared methods
        this.createIndex = createEntryIndex
        this.display     = display
        this.totalHeight = totalHeight
        this.ypos		 = ypos
}
//============================================
// FOLDER'S METHODS
//============================================
// LEVEL: root level == 0; top level == 1; ...
// LAST NODE: is the last child of current level
// LEFT SIDE: is a string; it's initially empty and can be concatenated
function initializeFolder (level, lastNode, leftSide)
{
		//alert("InitFolder");
        var j=0, i=0, numberOfFolders, numberOfDocs, nc;
        this.level = level;

        nc = this.nChildren
        this.createIndex()
        var auxEv = ""

        if (browser > 0)
                auxEv="<a href='javascript:clickOnNode("+this.id+")'>";
        else
                auxEv="<a>";

        if (level > 0)
                if (lastNode)
                {
                        this.renderOb (leftSide + auxEv + "<img id='nodeIcon" + this.id + "' src='"+gTopLevel + "/Images/empty.gif' width=1 height=16 border=0></a>")
                        //Echter Abstand zur Grundlinie
                        leftSide = leftSide + "<img src='"+gTopLevel +"/Images/empty.gif' width=20 height=16>"
                        // Leerzeichen in 1. Spalte für letztes Objekt
                        this.isLastNode=1
                }
                else
                {
						this.renderOb(leftSide + auxEv + "<img id='nodeIcon" + this.id + "' src='"+gTopLevel +"/Images/empty.gif' width=1 height=16 border=0></a>")
                        leftSide = leftSide + "<img src='"+gTopLevel +"/Images/empty.gif' width=20 height=16 border=0>"
                        // erste und zweite Spalte Linie nach untern bis zum letzten Objekt
                        this.isLastNode=0
                }
        else
                this.renderOb("");

           // are there any directly connected children
        if (nc > 0)
        {
                // increment current level for all children
                level+=1;
                // initialize each child, too
                for (i=0 ; i < this.nChildren; i++)
                {
                        // is it the last child?
                        if (i==this.nChildren-1)
                        {
                                // set last node sign to 1
                                this.children[i].initialize(level, 1, leftSide);
                        }
                        else
                        {
                                this.children[i].initialize(level, 0, leftSide);
                        }
                }
        }
}

//============================================
function setStateFolder(isOpen)
{
		//alert("setstate");
        var subEntries, totalHeight, fIt=0, i=0;
      
        if (isOpen==this.isOpen)
                return;
       // if (browser==2)
       /* {	
                totalHeight=0
                for (i=0; i < this.nChildren; i++)
					{
					//totalHeight = totalHeight + this.children[i].navObj.clip.height; Test 25.4
					
					
                    }
                subEntries = this.subEntries();
                
                var Attribute;
				var Result;
				for (Attribute in this.navObj)
					{
						Result=Result+String(Attribute)+" ;  ";
					}
				//alert(Result);
				
                if (this.isOpen)
                        totalHeight = 0-totalHeight ;
                for (fIt = this.id + subEntries + 1; fIt < nEntries; fIt++)
                {
                 //alert("Index: "+indexOfEntries[fIt].navObj);
                 indexOfEntries[fIt].navObj.moveBy (0, totalHeight);
                        
                }
                 
        }*/
        
        this.isOpen = isOpen
        propagateChangesInState(this)
        //alert("Ende setstate");
        
}

//============================================
function addChild(childNode)
{
        this.children[this.nChildren] = childNode;
        this.nChildren++;
        return childNode;
}

//============================================
function hideFolder()
{
		
        //if (browser == 1)
        {
				//alert(this.navObj);
                if (this.navObj.style.display == "none")
                {
                        return;
                }
                this.navObj.style.display = "none";
        }
        /*else
        {
				if (this.navObj.visibility == "hidden")
                {
                        return;
                }
                this.navObj.visibility = "hidden";
                
        }*/
        this.setState(0)
       
}

//============================================
function drawFolder(leftSide)
{
 		//alert("DrawFolder:" + this.id);
 		/*if (browser==2)
        {
                if (!doc.yPos) doc.yPos=8
				doc.write("<layer id='folder" + this.id + "' top=" + doc.yPos + " visibility=hidden>")
		}*/
        doc.write("<table border=0")
        /*if (browser==1)*/ doc.write(" id='folder" + this.id + "' style='position:block;' ")
    
        doc.write(" cellspacing=0 cellpadding=0>")
        doc.write("<tr valign='TOP' height='12px'>")
        if (LEFTMARGIN>0) doc.write("<td width="+LEFTMARGIN+"'><img src='"+gTopLevel +"/Images/empty.gif' alt='' width="+LEFTMARGIN+" height=1></td><td>"); else doc.write('<td>');
        // ??
        doc.write(leftSide)
        
        //Zur eindeutigen Identifizierung wird der output Link deaktiviert, da sonst ID doppelt verwendet
        //this.outputLink()
         
       
        doc.write("<img id='folderIcon" + this.id + "' ")
        doc.write("src='" + this.iconSrc+"' border=0><br></a>")
        doc.write("</td><td valign=middle nowrap'>")
        if (USETEXTLINKS) 
        {
           this.outputLink()
           doc.write(this.desc + "</a>")
        }
        else doc.write("<img src='"+gTopLevel +"/Images/empty.gif' border=0 width=0 height=15 style='visibility: hidden;'>" + this.desc);
        
        doc.write("</td></tr>")
        doc.write("<tr><td><img id='folderlineleft" + this.id + "' src='"+gTopLevel +"/Images/dot.jpg' border=0 height=1 style='visibility: hidden;'></td><td><img id='folderline" + this.id + "' src='"+gTopLevel +"/Images/dot.jpg' border=0 height=1 style='visibility: hidden;'></td></tr></table>")
             
       // if (browser==2) doc.write("</layer>");
        if (browser==1) 
			{
                this.navObj = doc.all["folder"+this.id]
				this.iconImg = doc.all["folderIcon"+this.id]
                this.nodeImg = doc.all["nodeIcon"+this.id]
            }
		else
        if (browser==2) 
        {
       
				//alert(doc.getElementById("folder"+this.id).style.display);
				//this.navObj = doc.layers["folder"+this.id]; Orginal
				this.navObj = doc.getElementById("folder"+this.id);
				//var Attribute;
				//var Result;
				//for (Attribute in this.navObj)
				//	{
				//		Result=Result+String(Attribute)+" ;  ";
				//	}
				//alert(Result);
			               
                this.iconImg = doc.getElementById("folderIcon"+this.id);
                this.nodeImg = doc.getElementById("nodeIcon"+this.id);
             
                //alert(this.navObj.height);
				//doc.yPos=doc.yPos+this.navObj.clip.height; Test 25.4
			
       }
		
}

//============================================
function folderSubEntries()
{
        var i=0, se=this.nChildren
        for (i=0; i < this.nChildren; i++)
        {
                if (this.children[i].children)
                {
                        se=se+this.children[i].subEntries();
                }
        }
        return se
}

//============================================
//links and opens in the mainframe
function outputFolderLink()
{
	
        if (this.hreference) 
        		{
                // ohne ID if (this.hreference!=" ") doc.write("<img src='"+gTopLevel +"/Images/empty.gif' border=0 width=0 height=15 style='visibility: hidden;'><a id=folderdesc"+this.id +" style='wrap: soft; font-size: 11px; text-decoration: none;' href='" + this.hreference +"' target=\'_self\' ");
                if (this.hreference!=" ") doc.write("<img src='"+gTopLevel +"/Images/empty.gif' border=0 width=0 height=15 style='visibility: hidden;'><a id=folderdesc"+this.id +" style='wrap: soft; font-size: 11px; text-decoration: none;' href='" + this.hreference + "?ID="+this.id+"' target=\'Mainframe\' ");
                else doc.write("<a href='#'");
                if (browser>0) doc.write("onClick='clickOnFolder("+this.id+")'")
               // if (GLOWFOLDER) {
                //		 alert(gTopLevel);
                  //       if (browser==1) doc.write("onMouseOver=\"document.images['folderIcon"+this.id+"'].src='"+gTopLevel + "/Images/empty.gif'\" onMouseOut=\"document.images['folderIcon"+this.id+"'].src='"+gTopLevel +"/Images/empty.gif'\"");
                        // 1. Kasten vor Ordnern mit Unterordnern on Mouse 2. Kasten vor Ordnern mit Unterordner off Mouse
                   //      if (browser==2) {
                    //             doc.write("onMouseOver=\"document.layers['folder"+this.id+"'].document.images['folderIcon"+this.id+"'].src='"+gTopLevel + "/Images/empty.gif'");
                                // ??
                    //             doc.write("onMouseOut=\"document.layers['folder"+this.id+"'].document.images['folderIcon"+this.id+"'].src='"+gTopLevel + "/Images/empty.gif'");
                                // ??
                     //    }
                 //}
                doc.write(">");
  				}
  		else doc.write("<a>");
}
//============================================
//links and opens a new window
function outputExtFolderLink()
{
	
        if (this.hreference) 
        		{
                if (this.hreference!=" ") doc.write("<img src='"+gTopLevel +"/Images/empty.gif' border=0 width=0 height=15 style='visibility: hidden;'><a id=folderdesc"+this.id +" style='wrap: soft; font-size: 11px; text-decoration: none;' href='" + this.hreference + "?ID="+this.id+"' target=\'new\' ");
                else doc.write("<a href='#'");
                if (browser>0) doc.write("onClick='clickOnFolder("+this.id+")'")
                doc.write(">");
  				}
  		else doc.write("<a>");
}
//============================================
// FOLDER'S LOCAL FUNCTION SECTION
//============================================
function propagateChangesInState(folder)
{
  //alert("propagateChangesInState");
   var i=0
        if (folder.isOpen) {
                		
        	    if (folder.nodeImg)
                        if (folder.isLastNode) folder.nodeImg.src = gTopLevel + "/Images/xempty.gif" //nicht benötigt ?
                                             
                        // 1. Spalte letzte Reihe 1. Zeichen (Weiche). Nicht zweite Reihe
                        else folder.nodeImg.src = gTopLevel + "/Images/xempty.gif"; //nicht benötigt ?
                                                
                folder.iconImg.src=gTopLevel + "/Images/empty.gif"; //offener Ordner vor Mouseover
                //   Erster Kasten Zeichen beim öffnen vom Ordner
                for (i=0; i<folder.nChildren; i++) folder.children[i].display()
                                
        } else {
                if (folder.nodeImg)
                        if (folder.isLastNode) folder.nodeImg.src = gTopLevel + "/Images/xempty.gif"; //nicht benötigt ?
                        // erstes Zeichen offener Ordner (Weiche)
                        else folder.nodeImg.src = gTopLevel + "/Images/xempty.gif" //nicht benötigt ?
                        // geschlossener Ordner (Weiche)
                folder.iconImg.src = gTopLevel + "/Images/empty.gif" //offener Ordner vor Mouseover
                // erstes Zeichen Ordner geschlossen (Kasten)
                for (i=0; i<folder.nChildren; i++) folder.children[i].hide()
        }
        //alert("Ende propagateChangesInState");
}


//============================================
//============================================
// SHARED METHOD SECTION
//============================================
function createEntryIndex()
{
  this.id=nEntries
  // the root is the first entry
  indexOfEntries[nEntries]=this
  nEntries++
}

//============================================
function display()
{
		//alert("Display");
        //if (browser==1)
            this.navObj.style.display="block";
        //else
          //  {
           // this.navObj.style.display="block";
           // alert(this.navObj.innerHTML);
            
          //  }
}

//============================================
function totalHeight()
{
        var h = this.navObj.clip.height;
        var i = 0;
        if (this.isOpen)
                for (i=0; i<this.nChildren; i++)
                {
                    h+=this.children[i].totalHeight()
                }
        return h
}
//

//============================================
function ypos()
{
        var h = this.navObj.clip.top;
        //alert("yPos:"+h);
        return h
}
//============================================
//============================================
// GLOBAL FUNCTION SECTION
//============================================

//============================================
// Create a new folder (node)
function gFld (description, hreference)
{
        folder = new Folder (description, hreference);
        return folder;
}

//============================================
// Create a new folder (node) for an external link
function gExtFld (description, hreference)
{
        Extfolder = new ExtFolder (description, hreference);
        return Extfolder;
}

//============================================
// create a new item (leaf)
function xxgLnk (target, description, linkData)
{
        linkItem = new Item(description, "'"+linkData+"' target='"+target+"'");
        // OLD Test
        // linkItem = new Item(description, linkData);

        return linkItem;
}

//============================================
function insFld (parentFolder, childFolder)
{
        return parentFolder.addChild(childFolder)
}

//============================================
function insDoc (parentFolder, document)
{
        parentFolder.addChild(document)
}

//============================================
function initializeDocument()
{
		
	function msieversion()
	// return Microsoft Internet Explorer (major) version number, or 0 for others
	// This function works by finding the "MSIE " string and extracting the version number
	// following the space, up to the decimal point for the minor version which is ignored.
	{
		var ua = window.navigator.userAgent
		var msie = ua.indexOf ( "MSIE " )
		if ( msie > 0 )		// is Microsoft Internet Explorer; return version number
			return parseInt ( ua.substring ( msie+5, ua.indexOf ( ".", msie ) ) )
		else
			return 0	// is other browser
	}

      
        // top Level Language:
        
        if (navigator.appName == "Microsoft Internet Explorer")
			browser=1;
        else
			browser=2; //Test 24.4
        
		gTopLevel = window.location.pathname;
		getTheRoot(gTopLevel);
		//alert(gTopLevel)
			
		browserVer=parseFloat(navigator.appVersion);
        
        //Startpos wird hier definiert !  
        doc.write("<div id='FloatMenu' style='Z-INDEX: 100; LEFT: 29px; WIDTH: 195px; POSITION: absolute; TOP: 180px; HEIGHT: 500px'>");
       
        MenuTree.initialize(0,1,"");
           
        MenuTree.display();
        
		doc.write("</div>");
		if (browser>0)
        {
			document.write("<layer top="+indexOfEntries[nEntries-1].navObj.top+">&nbsp;</layer>");
                //clickOnNode(0);
                //clickOnNode(0);
        }
     	//Parsen der URL
     	//LockOpenMenu = 0
     	// getIndex ?
     	var strURL = window.document.location.href; 	    	// <= "http://www.dial.de?ID=#"
		var nlength = strURL.length; 	// <= Anzahl der Zeichen im String	
		var nPos = strURL.indexOf("=");			    			// <= Position von "=" 				
		var nIndex = strURL.substr(nPos+1, nlength-nPos);
        	//alert("Initialize"+strURL+" pos":+npos);    
   		if (nPos<0)
   		{
   		
   			nIndex = getIndex(strURL) ;
   			nIndex = parseInt(nIndex) ;
   			addIDtoURL(nIndex);
   		}
   		else
   		{
   			addIDtoURL(nIndex);
   			//addURLID()
   		}	 
   	    	
   		if (nIndex>0) 
   		{
   			clickOnNode(0);
   			clickOnNode(0);
   			
   			//Parents = ParentsofIndex(nIndex);
   			ParentsofIndex(nIndex);
   			for (i=0 ; i<Parents.length ; ++i) 
   			{
   				if (Parents[i]>0)
   				{
   					//alert(Parents[i]);
   					clickOnNode(Parents[i]);
   				}
   			}   
   						
   			clickOnFolder(nIndex);
   	   	   	if (indexOfEntries[parseInt(nIndex)+1] != undefined)		
   			if (indexOfEntries[nIndex].hreference == indexOfEntries[parseInt(nIndex)+1].hreference)
			{
				nIndex=parseInt(nIndex)+1;
			}
			
	
		HighlightMenu(nIndex);	
   		}
   		
   		else
   		{
   			clickOnNode(0);
   			clickOnNode(0);
   		}
   			
}

function openMenu(strURL)
{
		nIndex = getIndex(strURL);
		if (nIndex>0) 
   		{
   			//clickOnNode(0);
   			//clickOnNode(0);
   			var clickedFld=indexOfEntries[nIndex];
			if ((!clickedFld.isOpen))
   			{
   				Parents[Parents.length] = 0 
   				
   				//Parents = ParentsofIndex(nIndex);
   				ParentsofIndex(nIndex);
   				for (i=0 ; i<Parents.length ; ++i) 
   				{
   					if (Parents[i]>0)
   					{
   						if (!indexOfEntries[Parents[i]].isOpen)
   						{
   							clickOnFolder(Parents[i]);
   						}
   					}
   				} 
   				clickOnNode(nIndex);
   			}
   			
   		}
   		else nIndex=1
   		
   		for(i=0; i<nEntries; i++)
			{
   			UnselectMenu(i);
   			}
   		HighlightMenu(nIndex);
   		
}

function getIndex(URL)
{
	var nThislength 	
	var nThisPos 		    			// <= Position von "=" 				
	var strThisURL
	var nlength = URL.length; 	// <= Anzahl der Zeichen im String	
	var nPos = URL.lastIndexOf("/");			    			 				
	var strURL = URL.substr(nPos+1, nlength-nPos);
	
	//alert("GetIndex"+URL);
	for(i=0; i<nEntries; i++)
	{
		nThislength = indexOfEntries[i].hreference.length; 	// <= Anzahl der Zeichen im String
		nThisPos = indexOfEntries[i].hreference.lastIndexOf("/");
		strThisURL = indexOfEntries[i].hreference.substr(nThisPos+1, nThislength-nThisPos);	
    	//alert(strThisURL +" "+ strURL);
    	if (strThisURL == strURL)
		{
			return i;
		}
	}
}

function addURLID()
{	
	//alert("Fehler im Menü, bitte Administrator kontakten !");
	return;
	var strURL = window.document.location.href; 	    	// <= "http://www.dial.de?ID=#"
	var nlength = strURL.length; 	// <= Anzahl der Zeichen im String	
	var nPos = strURL.indexOf("=");			    			// <= Position von "=" 				
	var nIndex = strURL.substr(nPos+1, nlength-nPos);
		
	HighlightMenu(nIndex);
		
	if (doc.getElementById("Kurzinfolink"))
	Kurzinfolink.href=Kurzinfolink.href+"?ID=" + nIndex;
	
	if (doc.getElementById("Detaillink"))
	Detaillink.href=Detaillink.href+"?ID=" + nIndex;
	
	if (doc.getElementById("Fotolink"))
	Fotolink.href=Fotolink.href+"?ID=" + nIndex;
	
	if (doc.getElementById("PDFlink"))
	PDFlink.href=PDFlink.href+"?ID=" + nIndex;
	
	if (doc.getElementById("Drucklink"))
	Drucklink.href=Drucklink.href+"?ID=" + nIndex;
		
	if (doc.getElementById("Anmeldelink"))
	Anmeldelink.href=Anmeldelink.href+"?ID=" + nIndex;
	
}

function addIDtoURL(nIndex)
{
	
	//HighlightMenu(nIndex);
	if (browser == 1)
   	{	
	if (doc.getElementById("Kurzinfolink"))
	Kurzinfolink.href=Kurzinfolink.href+"?ID=" + nIndex;
	
	if (doc.getElementById("Detaillink"))
	Detaillink.href=Detaillink.href+"?ID=" + nIndex;
	
	if (doc.getElementById("Fotolink"))
	Fotolink.href=Fotolink.href+"?ID=" + nIndex;
	
	if (doc.getElementById("PDFlink"))
	PDFlink.href=PDFlink.href+"?ID=" + nIndex;
	
	if (doc.getElementById("Drucklink"))
	Drucklink.href=Drucklink.href+"?ID=" + nIndex;
		
	if (doc.getElementById("Anmeldelink"))
	Anmeldelink.href=Anmeldelink.href+"?ID=" + nIndex;
	
	if (doc.getElementById("FAQ_Technik"))
	FAQ_Technik.href=FAQ_Technik.href+"?ID=" + nIndex;
	
	if (doc.getElementById("FAQ_Anwendung"))
	FAQ_Anwendung.href=FAQ_Anwendung.href+"?ID=" + nIndex;
	
	if (doc.getElementById("Presseinformation1"))
	Presseinformation1.href=Presseinformation1.href+"?ID=" + nIndex;

	if (doc.getElementById("Presseinformation2"))
	Presseinformation2.href=Presseinformation2.href+"?ID=" + nIndex;
	}
	else
	{
	if (doc.getElementById("Kurzinfolink"))
	doc.getElementById("Kurzinfolink").href=doc.getElementById("Kurzinfolink").href+"?ID=" + nIndex;
	
	if (doc.getElementById("Detaillink"))
	doc.getElementById("Detaillink").href=doc.getElementById("Detaillink").href+"?ID=" + nIndex;
	
	if (doc.getElementById("Fotolink"))
	doc.getElementById("Fotolink").href=doc.getElementById("Fotolink").href+"?ID=" + nIndex;
	
	if (doc.getElementById("PDFlink"))
	doc.getElementById("PDFlink").href=doc.getElementById("PDFlink").href+"?ID=" + nIndex;

	if (doc.getElementById("Anmeldelink"))
	doc.getElementById("Anmeldelink").href=doc.getElementById("Anmeldelink").href+"?ID=" + nIndex;
	
	if (doc.getElementById("FAQ_Technik"))
	doc.getElementById("FAQ_Technik").href=doc.getElementById("FAQ_Technik").href+"?ID=" + nIndex;
	
	if (doc.getElementById("FAQ_Anwendung"))
	doc.getElementById("FAQ_Anwendung").href=doc.getElementById("FAQ_Anwendung").href+"?ID=" + nIndex;
	
	if (doc.getElementById("Presseinformation1"))
	doc.getElementById("Presseinformation1").href=doc.getElementById("Presseinformation1").href+"?ID=" + nIndex;

	if (doc.getElementById("Presseinformation2"))
	doc.getElementById("Presseinformation2").href=doc.getElementById("Presseinformation2").href+"?ID=" + nIndex;
	
	if (doc.getElementById("Presseinformation3"))
	doc.getElementById("Presseinformation3").href=doc.getElementById("Presseinformation3").href+"?ID=" + nIndex;

	if (doc.getElementById("Presseinformation4"))
	doc.getElementById("Presseinformation4").href=doc.getElementById("Presseinformation4").href+"?ID=" + nIndex;
	
	if (doc.getElementById("Presseinformation5"))
	doc.getElementById("Presseinformation5").href=doc.getElementById("Presseinformation5").href+"?ID=" + nIndex;

	
	
	
		
	}	
}

//Underline the Menu from Index
function HighlightMenu(nIndex)
{
		//   if (navigator.appName == "Microsoft Internet Explorer")
		//		browser=1;
	  //      else
		//		browser=2; //Test 02.07.2008 schmahl
			
			if (nIndex>0)
			{
				if (browser == 1)
   				{
   				document.all['folderdesc'+nIndex].style.color = "#52576B";
        		document.all['folderdesc'+nIndex].style.fontWeight = "bold";
        		document.all['folderdesc'+nIndex].style.lineHeight = "9px";
            		document.all['folderline'+nIndex].style.visibility = "visible";
        		document.all['folderlineleft'+nIndex].style.visibility = "visible";
           		document.all['folderline'+nIndex].width=220-((indexOfEntries[nIndex].level) * 20);
           		document.all['folderlineleft'+nIndex].width=2+((indexOfEntries[nIndex].level-1) * 20);
        		}
        		else if (browser == 2) //if (browser == 2) - Test 03.07.2008 schmahl
        		{
        		//alert(nIndex);
        		doc.getElementById("folderdesc"+nIndex).style.color = "#52576B";
        		doc.getElementById("folderdesc"+nIndex).style.fontWeight = "bold";
        		doc.getElementById("folderline"+nIndex).style.visibility = "visible";
        		doc.getElementById("folderlineleft"+nIndex).style.visibility = "visible";
        		doc.getElementById("folderline"+nIndex).style.width=220-((indexOfEntries[nIndex].level) * 20);
        		doc.getElementById("folderlineleft"+nIndex).style.width=2+((indexOfEntries[nIndex].level-1) * 20);
        		}
        	}	
} 
function UnselectMenu(nIndex)
{
			if (nIndex>0)
			{
				if (browser == 1)
   				{
   				document.all['folderdesc'+nIndex].style.color = "#52576B";
        		document.all['folderdesc'+nIndex].style.fontWeight = "normal";
        		document.all['folderdesc'+nIndex].style.lineHeight = "9px";
            	document.all['folderline'+nIndex].style.visibility = "hidden";
        		document.all['folderlineleft'+nIndex].style.visibility = "hidden";
           		document.all['folderline'+nIndex].width=1;
           		document.all['folderlineleft'+nIndex].width=1;
        		}
        		else
        		{
        		//alert(nIndex);
        		doc.getElementById("folderdesc"+nIndex).style.color = "#52576B";
        		doc.getElementById("folderdesc"+nIndex).style.fontWeight = "normal";
        		doc.getElementById("folderline"+nIndex).style.visibility = "hidden";
        		doc.getElementById("folderlineleft"+nIndex).style.visibility = "hidden";
        		doc.getElementById("folderline"+nIndex).style.width=1;
        		doc.getElementById("folderlineleft"+nIndex).style.width=1;
        		}
        	}	
} 
//============================================
function ParentsofIndex(Index)
{
	var IsParent=false; 
	if (Index==0)
		{
//		Parents[Parents.length] = 0 
		return //Parents
		}
	else
	{
	//Parents=new Array

		for (i=0 ; i<Index ; ++i)
		{
			for(z=0 ; z<indexOfEntries[i].nChildren ; ++z)
				if (indexOfEntries[i].children[z].id == Index) 
				{
					//alert(indexOfEntries[i].id)
					ParentsofIndex(indexOfEntries[i].id)
					Parents[Parents.length] = indexOfEntries[i].id
					IsParent = true
					break
				}
		
		}
		return //Parents;
	}
}

function clickOnFolder(folderId)
{
        //alert ("==clickOnFolder==\ncurFolder:"+folderId+"\nlastTopFolder:"+lastTopFolder+"\nlastFolder:"+lastFolder);
        var clickedFld=indexOfEntries[folderId];
        if ((!clickedFld.isOpen)||(folderId!=0))
        {
           
           		clickOnNode(folderId);
    }
        if (folderId==0)
        {
				lastTopFolder=-1;
                lastFolder=-1;
                
                clickOnNode(0);
		}
}

//============================================
function clickOnNode(folderId)
{
       // alert ("==clickOnNode("+folderId+")==");
        var clickedFolder=0, state=0;
        clickedFolder=indexOfEntries[folderId]
        state=clickedFolder.isOpen
       
        if (isTopFolder(folderId))
        {
                if (lastTopFolder>=0)
                {
                indexOfEntries[lastTopFolder].setState(false);
            }
                lastTopFolder=folderId;
        }
        else
        {
		
                if ( ((browser==1)||(browserVer>=4.5)) &&
                     (lastFolder>=0) &&
                         (canClose(lastFolder)))
                {
                        //alert("Fehler Zeile 642!");
                        indexOfEntries[lastFolder].setState(false);
                }
                lastFolder=folderId;
        }
        clickedFolder.setState(!state)
}

//============================================
// some global functions to control closable nodes
function isTopFolder(id)
{
        //return ((id==1)||(id==5)||(id==9)||(id==21)||(id==34)||(id==46));
        if (indexOfEntries[id].level == 1)
        {
                return true;
        }
        else
        {
                return false;
        }
}

//============================================
function canClose(id)
{
        // alert ("==canClose("+id+")==");
        //return ((id==11)||(id==16)||(id==24)||(id==29)||(id==36)||(id==42));
        // 22 is another node but that contains another subnode
}
// all other ids belong to leaves (items)
//============================================
function closeAll()
{
		clickOnNode(0);
        clickOnNode(0);
}
//============================================
//get Language root
function getTheRoot(path)
{
var nIndex = gTopLevel.lastIndexOf("\\")
if (nIndex <= 0)
{
nIndex = gTopLevel.lastIndexOf("/");
}
var temp = gTopLevel.substr(nIndex,gTopLevel.length);
gTopLevel = gTopLevel.substr(0,nIndex);
if (temp == "\\Articles" || temp == "/Articles" || temp == "\\Script" || temp == "/Script" || temp =="")
{
return;
}
else{
getTheRoot(gTopLevel);
}
}


// =====================
// GLOBAL VAR SECTION
// =====================
indexOfEntries=new Array
Parents = new Array
nEntries=0
doc=document
browser=0
lastFolder=-1
lastTopFolder=-1
clicked=-1
browserVer=1


LEFTMARGIN=0
GLOWFOLDER=1
AUTOCLOSE=1
USETEXTLINKS=1
USETEXTLINKS=1
USETEXTLINKS=1
USETEXTLINKS=1
USETEXTLINKS=1
USETEXTLINKS=1