//-----------------------------------------------------------------------------
//	Project:	NOSE WEB NAVIGATOR
//	Authors:	Stefan Tan, Walter Stulzer, Alexandra Papadopoulos
//	(c):		1998-1999, Nose GmbH Interactive Media
//	(c):		1999-2000, Perspectix-Nose AG, Digital Business Intelligence
//	(c):		2001, Nose Applied Intelligence
//	History:
//	[04/99]		Rel. 1.0.0 [WS/AP]
//	[04/99]		Rel. 1.0.1 'Debugging Programmlogik, NEW: Powerfunctions' [WS]
//	[04/99]		Rel. 1.0.2 'Kompatibilitaet HTML 3.0' [WS]
//	[04/99]		Rel. 1.0.3 'Reaktion des Menues auf Links im Hauptfenster' [WS]
//	[01/00]		Rel. 1.0.4 'generische Ordnungsnummer, oparent' [WS]
//	[01/00]		Rel. 1.1.0 'generischer expanded-Wert' [WS/MH/NS]
//	[02/00]		Rel. 1.1.1 'Neuer Menueintrag' [WS]
//	[07/00]		Rel. 1.1.2 'Korrektur für Mac-Explorer 5.0' [ST]
//	[08/00]		Rel. 2.0.0 'CSS-capability' [ST]
//	[03/01]		Rel. 2.0.1 'Rewriting refresh(), debugging' [ST/SA]
//	[12/01]		Rel. 2.1.0 'Codewashing' [ST/FS]
//-----------------------------------------------------------------------------
//	layout of a menu cell (a cell is build with one table)
//
//	--------------------------------------------------------
//	|  |     |   | |                                       |
//	|1 |  2  | 3 |4|               5                       |  6
//	|  |     |   | |                                       |
//	--------------------------------------------------------
//	|                                                      |  7
//	--------------------------------------------------------
//                             8
//	legend:
//	[1] fix distance --> spaceLeft
//	[2] var distance (level dependend) --> einruecken
//	[3] arrow area --> arrowGifHeight, arrowGifWidth
//	[4] text distance holder --> textSpace
//	[5] text field
//	[6] content cell height --> trHeightBig
//	[7] space cell height --> trHeightSmall
//	[8] total cell width --> widthTotal
//
//	Definition eines Menueintrages:
//	level           Hierarchie (0, 1, 2 usw.)
//					level -1 ersetzen den Inhalt des gesamten Browserfensters
//	descr			Text
//	menulink		Link zur zugehoerigen Seite im Target Frame
//					"none" zeigt den Text ohne Link
//	tooltip			Tooltip
//
//	expand			dieser Wert muss nicht angegeben werden --> automatisiert
//					0 sichtbar zu mit pfeil 
//					1 sichtbar offen mit pfeil
//					2 sichtbar ohne pfeil
//					3 unsichtbar mit pfeil
//					4 unsichtbar ohne pfeil
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
//	[look] --> global vars of navigator look 
//	[work] --> global vars of navigator internal workflows
//-----------------------------------------------------------------------------

//	[look] text colors and styles 
	var style_txt_noact = "txtnoact";		// nicht aktive Menüschrift Level 0 oder -1
	var style_txt_act = "txtact";			// aktive Menüschrift
	var style_txt_sel = "txtsel";			// selektierte, aktive Menüschrift

//	[look] background colors of the text areas
	var style_hg_noact = "hgnoact";			// nicht aktiver Hintergrund  
	var style_hg_L = "hgL";					// aktiver Hintergrund aufgrund der Hierarchie
	var style_hg_Line = "hgLine";			// style für zwischenzeilen
	var style_hg_Line_activ = "hgLineActiv";// style für aktive zwischenzeile

//	[look] background colors of the arrow areas
	var style_arr_node_ = "node";			// kein Menüpunkt
	var style_arr_clos_ = "clos";			// geschlossener Menüpfeil
	var style_arr_open_ = "open";			// offener Menüpfeil

//	[look] sizes, distances and look options
	var trHeightBig = 18;					// Zellenhoehe fuer TextZeilen
	var trHeightSmall = 1;					// Zellenhoehe fuer Zwischenzeilen
	var widthTotal = 150;					// gesamtbreite des Navigators
	var textSpace = 5;						// abstand zwischen arrow und Text
	var einruecken = 0;						// Grundwert für die Einrückung 
	var spaceLeft = 5;						// genereller Abstand zum linken rand
	var arrowGifHeight = 18;				// hoehe der arrow-gifs eingeben
	var arrowGifWidth = 15;					// breite des arrow-gifs eingeben
	var menufocus = false;					// menue erhaelt bei expand hintergrund des nächsten levels on / off
											// - true = hintergrund naechster Level
											// - false = hintergrund aktueller Level  
//	[look] gif definitions (path!)
	var spaceGif = "src='style/transparent.gif'";
	var nodeGif = "src='style/node.gif'";
	var nodeGif_activ = "src='style/node_activ.gif'";
	var arrowClose = "src='style/right.gif'";
	var arrowOpen = "src='style/down.gif'";
	var arrowClose_activ = "src='style/right_activ.gif'";
	var arrowOpen_activ = "src='style/down_activ.gif'";
	var arrowClose_path = "src='style/path.gif'";
	var arrowExit = "src='style/exit.gif'";
	var spaceString = "<img " + spaceGif + " width=\"" + textSpace + "\" height=\"" + arrowGifHeight + "\" align=\"center\">";

//	[work] arrays and more var definitions
	var aMain = new Array();					// main working array containing the total information
	var bMain = new Array();					// temporary copy of aMain
	var actLevel = new Array(10);				// number of maximum levels allowed (e.g. 10)
	var actLength = 0;							// internal count of menu entries
	var waitSec = 0;							// timeout var for refresh function
	var actMother = 0;							// var for counting number of top levels (level 0 and -1)
	var actParent = 0;							// var for saving order number of direct mother level
	var defaultFolder = "pages/";				// default folder of the content pages	
	var navigatorHTMFile = "navigation.htm";	// name of file where the navigator menu is beeing written
	var basisURL = top.window.location.href;	// get initial path (url)
	var actLink = "nose@2775731.html";			// don't change this var! init only
	var redirect = false;						// don't change this var! init only
	var redirectsite = "";						// don't change this var! init only
	var intURL = 0;								// don't change this var! init only
                                    
//-----------------------------------------------------------------------------
// init: initialize navigator										   [mod 00]
//-----------------------------------------------------------------------------
function init()
{
	if (basisURL.lastIndexOf("?") >= 0)
	{    
		redirect = true;
		redirectvar = location.href;
		redirectpoint = redirectvar.indexOf("?")+1;
		redirectlength = redirectvar.length;
		redirectsite = redirectvar.substring(redirectpoint,redirectlength);
		actLink = redirectsite;
	}
	
	if (basisURL.lastIndexOf("?") >= 0) 
	{
		basisURL = basisURL.substring(0, basisURL.lastIndexOf("?"));
	}
	var i = basisURL.lastIndexOf("\\")+2;
	if (i < basisURL.lastIndexOf("/")+1)
	{
		i = basisURL.lastIndexOf("/")+1;
	}
	basisURL = basisURL.substr(0,i);
	intURL = basisURL.length;
}

//-----------------------------------------------------------------------------
// makeTree: build the menu tree matrix								   [mod 01]
//-----------------------------------------------------------------------------
function makeTree()
{
	makeLevel(0,"Page d&acute;accueil",defaultFolder+"welcome.htm","");
	makeLevel(0,"L&acute;essentiel en bref",defaultFolder+"redirect.htm?factsandfigures.htm","");
	makeLevel(1,"Chiffres-cl&eacute;s",defaultFolder+"factsandfigures.htm","");
	makeLevel(1,"Les faits marquants",defaultFolder+"highlights.htm","");
	makeLevel(1,"Agenda 2002",defaultFolder+"termine.htm",""); 
	makeLevel(0,"Organisation",defaultFolder+"organisation.htm",""); 
	makeLevel(1,"Conseil d&acute;administration",defaultFolder+"verwaltungsrat.htm","");          
	makeLevel(1,"Direction du groupe",defaultFolder+"gruppenleitung.htm","");
	makeLevel(1,"Adresses",defaultFolder+"adressen.htm","");
	makeLevel(0,"Rapport d&acute;activit&eacute;",defaultFolder+"redirect.htm?overview.htm","");  
	makeLevel(1,"Survol de l&acute;exercice",defaultFolder+"overview.htm","");                                                                            
	makeLevel(1,"Swisscom Fixnet",defaultFolder+"fixnet.htm","");           
	makeLevel(1,"Swisscom Mobile",defaultFolder+"mobile.htm","");  
	makeLevel(1,"Enterprise Solutions",defaultFolder+"enterprisesolutions.htm","");    
	makeLevel(1,"debitel",defaultFolder+"debitel.htm","");    
	makeLevel(1,"Autres activit&eacute;s importantes",defaultFolder+"redirect.htm?itservices.htm","");    
	makeLevel(2,"Swisscom IT Services",defaultFolder+"itservices.htm",""); 
	makeLevel(2,"Swisscom Systems",defaultFolder+"systems.htm",""); 
	makeLevel(2,"Bluewin",defaultFolder+"bluewin.htm","");
	makeLevel(2,"Swisscom Directories",defaultFolder+"directories.htm","");
	makeLevel(2,"Billag",defaultFolder+"billag.htm","");     
	makeLevel(2,"Conextrade",defaultFolder+"conextrade.htm","");    
	makeLevel(2,"Swisscom Broadcast",defaultFolder+"broadcast.htm",""); 
	makeLevel(2,"Participations",defaultFolder+"beteiligungen.htm","");
	makeLevel(1,"Clients",defaultFolder+"kunden.htm","");
	makeLevel(1,"Collaborateurs",defaultFolder+"mitarbeiter.htm","");
	makeLevel(1,"Soci&eacute;t&eacute;",defaultFolder+"gesellschaft.htm","");
	makeLevel(1,"Environnement",defaultFolder+"umwelt.htm","");
	makeLevel(1,"Actionnaires",defaultFolder+"shareholder.htm","");
	makeLevel(0,"Rapport financier",defaultFolder+"finanzbericht.htm","");
	//makeLevel(1,"Facts & Figures",defaultFolder+"factsandfigures2.htm","");
	//makeLevel(1,"Finanzkommentar",defaultFolder+"finanzkommentar.htm","");          
	//makeLevel(1,"Konsolidierte Jahresrechnung",defaultFolder+"konsjahresrechnung.htm","");
	//makeLevel(1,"Jahresrechnung der Swisscom AG",defaultFolder+"jahresrechnung.htm","");
	//makeLevel(1,"Antrag &uuml;ber die Verwendung des Bilanzgewinns",defaultFolder+"verwendung.htm","");
	//makeLevel(1,"F&uuml;nfjahres&uuml;bersicht",defaultFolder+"fuenfjahresuebersicht.htm","");

}

//-----------------------------------------------------------------------------
// makeLevel: insert a new line into the menu tree matrix 			   [mod 02]
//-----------------------------------------------------------------------------
function makeLevel(level,descr,menulink,tooltip)
{  
	bMain[actLength] = new makeVals(actLength,level,descr,menulink,tooltip);
	actLength++;
}

//-----------------------------------------------------------------------------
// makeVals: initialize new menu entry								   [mod 03]
//-----------------------------------------------------------------------------
function makeVals(order,level,descr,menulink,tooltip)
{
	if (level < 0)
	{
		actLevel[0] = order;
	} else
	{
		actLevel[level] = order;
	}
	this.order = order;
	this.level = level;
	this.descr = descr;
	this.tooltip = tooltip;
	
	if(menulink == "none")
	{
		this.menulink = menulink;
	} else
    {
		this.menulink = makeLink(descr, menulink, level, order);
	}
	
	if (order > 0)
	{
	    if (bMain[order-1].level < level)
		{
			bMain[order-1].stylearrow = style_arr_clos_ + bMain[order-1].level;
			if (bMain[order-1].level <= 0)
			{
				bMain[order-1].expand = 0;
				bMain[order-1].styletxt = style_txt_noact + bMain[order-1].level;
			} else
			{
				bMain[order-1].expand = 3;
				bMain[order-1].styletxt = style_txt_act + bMain[order-1].level;
			}
		} else
		{
			bMain[order-1].stylearrow = style_arr_node_ + bMain[order-1].level;
			if (bMain[order-1].level <= 0)
			{
				bMain[order-1].expand = 2;
				bMain[order-1].styletxt = style_txt_noact + bMain[order-1].level;
			} else
			{
				bMain[order-1].expand = 4;
				bMain[order-1].styletxt = style_txt_act + bMain[order-1].level;
			}
		}
		bMain[order-1].stylehg = style_hg_L + bMain[order-1].level;
		bMain[order-1].exparrow = makeArrow(bMain[order-1].level, bMain[order-1].order, bMain[order-1].expand, bMain[order-1].mother);
	}
	
	if (level <= 0)
	{
		this.expand = 2;
		this.oparent = null;
		this.styletxt = style_txt_noact + level;
	} else
	{
		this.expand = 4;
		this.oparent = actLevel[level-1];
		this.styletxt = style_txt_act + level;
	}
	this.mother = actLevel[0];
	this.stylehg = style_hg_L + level;
	this.stylearrow = style_arr_node_ + level;
	this.exparrow = makeArrow(level, order, this.expand, this.mother);
	return this;
}

//-----------------------------------------------------------------------------
// makeArrow: define the arrow (string)								   [mod 04]
//-----------------------------------------------------------------------------
function makeArrow(level, order, expand, mother)
{
	var indentFix = "";
	var indentVar = "";
	var indentVarPix = space(level);
	
	if (indentVarPix > 0)
	{
		indentVar = "<img " + spaceGif + " width=\"" + indentVarPix + "\" height=\"" + arrowGifHeight + "\" border=\"0\" align=\"center\">";
	}
	if (spaceLeft > 0)
	{
		indentFix = "<img " + spaceGif + " width=\"" + spaceLeft + "\" height=\"" + arrowGifHeight + "\" align=\"center\">";
	}

	if (level < 0) 
	{
		arrow = indentFix + "<img " + arrowExit + " width=\"" + arrowGifWidth + "\" height=\"" + arrowGifHeight + "\" align=\"center\">";
	} else
	{ 
		switch(expand)
		{
 			case 0:
			arrow = indentFix + indentVar + "<a href=javascript:top.expandLevel(" + level + "," + order + ")><img " + arrowClose + "\" width=\"" + arrowGifWidth + "\" height=\"" + arrowGifHeight + "\" border=\"0\" align=\"center\"></a>";
 			break;
			case 1:
			arrow = indentFix + indentVar + "<a href=javascript:top.contractLevel(" + level + "," + order + ")><img " + arrowOpen + "\" width=\"" + arrowGifWidth + "\" height=\"" + arrowGifHeight + "\" border=\"0\" align=\"center\"></a>";
			break;
			default:
			arrow = indentFix + indentVar + "<img " + nodeGif + " width=\"" + arrowGifWidth + "\" height=\"" + arrowGifHeight + "\" align=\"center\">";
			break;
		}
	}
	return arrow;
}

//-----------------------------------------------------------------------------
// markPath: mark the closed path 									   [mod 05]
//-----------------------------------------------------------------------------
function markPath(nextParent)
{ 
	var indentFix = "";
	var indentVar = "";
	var indentVarPix = 0;

	if (spaceLeft > 0)
	{
		indentFix = "<img " + spaceGif + " width=\"" + spaceLeft + "\" height=\"" + arrowGifHeight + "\" align=\"center\">";
	}
	
	while (nextParent >= actMother && nextParent != null)
	{
		if (aMain[nextParent].expand == 0)
		{
			indentVarPix = space(aMain[nextParent].level);
			if (indentVarPix > 0)
			{
				indentVar = "<img " + spaceGif + " width=\"" + indentVarPix + "\" height=\"" + arrowGifHeight + "\" border=\"0\" align=\"center\">";
			}
			aMain[nextParent].exparrow = indentFix + indentVar + "<a href=javascript:top.expandLevel(" + aMain[nextParent].level + "," + aMain[nextParent].order + ")><img " + arrowClose_path + "\" width=\"" + arrowGifWidth + "\" height=\"" + arrowGifHeight + "\" border=\"0\" align=\"center\"></a>";
		}
		nextParent = aMain[nextParent].oparent;
	}
}

//-----------------------------------------------------------------------------
// markActivArrow: mark the activ arrow								   [mod 06]
//-----------------------------------------------------------------------------
function markActivArrow(myexpand, mylevel, myorder)
{
	var indentFix = "";
	var indentVar = "";
	var myArrow ="";
	var indentVarPix = space(mylevel);

	if (spaceLeft > 0)
	{
		indentFix = "<img " + spaceGif + " width=\"" + spaceLeft + "\" height=\"" + arrowGifHeight + "\" align=\"center\">";
	}
	if (indentVarPix > 0)
	{
		indentVar = "<img " + spaceGif + " width=\"" + indentVarPix + "\" height=\"" + arrowGifHeight + "\" border=\"0\" align=\"center\">";
	}

	switch(myexpand)
	{
 		case 0:
 		myArrow = indentFix + indentVar + "<a href=javascript:top.expandLevel(" + mylevel + "," + myorder + ")><img " + arrowClose_activ + "\" width=\"" + arrowGifWidth + "\" height=\"" + arrowGifHeight + "\" border=\"0\" align=\"center\"></a>";
 		break;
		case 1:
 		myArrow = indentFix + indentVar + "<a href=javascript:top.contractLevel(" + mylevel + "," + myorder + ")><img " + arrowOpen_activ + "\" width=\"" + arrowGifWidth + "\" height=\"" + arrowGifHeight + "\" border=\"0\" align=\"center\"></a>";
 		break;
		default:
		myArrow = indentFix + indentVar + "<img " + nodeGif_activ + " width=\"" + arrowGifWidth + "\" height=\"" + arrowGifHeight + "\" align=\"center\">";
		break;
	}
	return(myArrow);
}

//-----------------------------------------------------------------------------
// space: calculate the insertion value (pixel)						   [mod 07]
//-----------------------------------------------------------------------------
function space(mylevel)
{
	indent_pixel = 0;
	if (mylevel > 0)
	{
		indent_pixel = mylevel * einruecken;
	}
	return indent_pixel;
}

//-----------------------------------------------------------------------------
// makeLink: make links where needed								   [mod 08]
//-----------------------------------------------------------------------------
function makeLink(descr, menulink, level, order)
{  		
	var myLink = "";
	if ((menulink).lastIndexOf(actLink) >= 0)
	{
		myLink = "";
	} else
	{
		if (level < 0)		
		{ 
		  myLink = menulink + " target=_top";
		} else
		{
		  myLink = "\"javascript:top.goLink(\'" + menulink + "\'," + level + "," + order + ")\"";
		}
	}  
	return myLink;
}


//-----------------------------------------------------------------------------
// expandLevel: open a menu											   [mod 09]
//-----------------------------------------------------------------------------
function expandLevel(level, order)
{
	window.clearTimeout(waitSec);
	actLength = 0;
	makeTree();
	expandDown(level, order);
}

//-----------------------------------------------------------------------------
// expandDown: rekursiv Oeffnen										   [mod 10]
//-----------------------------------------------------------------------------
function expandDown(level, order)
{	
	window.clearTimeout(waitSec);
	var oparent = 0;
	for (i = 0 ; i < bMain.length ; i++)
	{   
		if (bMain[i].level == level)
		{
			if (bMain[i].order == order)
			{
				if (bMain[i].expand == 0)
				{
					bMain[i].expand = 1;
					if (menufocus)
					{
						bMain[i].stylehg = style_hg_L + (level+1);
						bMain[i].stylearrow = style_arr_open_ + (level+1);
					} else
					{
						bMain[i].stylearrow = style_arr_open_ + level;
					}
				}
				if (bMain[i].expand == 2) bMain[i].expand = 2;
				if (bMain[i].expand == 3)
				{
					bMain[i].expand = 1;
					if (menufocus)
					{
						bMain[i].stylehg = style_hg_L + (level+1);
						bMain[i].stylearrow = style_arr_open_ + (level+1);
					} else
					{
						bMain[i].stylearrow = style_arr_open_ + level;
					}
				}
				if (bMain[i].expand == 4) bMain[i].expand = 2;
				oparent = bMain[i].oparent;
			}
		} else
		{
			if (bMain[i].oparent == order)
			{
				if (bMain[i].expand == 3) bMain[i].expand = 0;
				if (bMain[i].expand == 4) bMain[i].expand = 2;
			}
		}
		bMain[i].exparrow = makeArrow(bMain[i].level, bMain[i].order, bMain[i].expand, bMain[i].mother);
	}
	
	if (level == 0) 
	{
		aMain = bMain;
		if (menufocus)
		{
			aMain[order].stylehg = style_hg_L + (level+1);
		} else
		{
			aMain[order].stylehg = style_hg_L + level;
		}
		
		if (bMain[order].expand == 2)
		{
			aMain[order].stylearrow = style_arr_node_ + level;
		} else
		{
			if (menufocus)
			{
				aMain[order].stylearrow = style_arr_open_ + (level+1);
			} else
			{
				aMain[order].stylearrow = style_arr_open_ + level;
			}
		}
		aMain[order].styletxt = style_txt_act + "0";
		markPath(actParent);
		top.botl.window.location = navigatorHTMFile;
		waitSec = window.setTimeout("refreshTree()", 1000);
	} else
	{   
		expandDown(level - 1, oparent);
	}
}


//-----------------------------------------------------------------------------
// contractLevel: close an open menu								   [mod 11]
//-----------------------------------------------------------------------------
function contractLevel(level, order)
{
	window.clearTimeout(waitSec);
	for (i = 0 ; i < bMain.length ; i++)
	{
		var testVal = bMain[i].level - level
		if (i == order)
        { 
        	bMain[i].expand = 0;
            bMain[i].stylehg = style_hg_L + level; //style retour
            bMain[i].stylearrow = style_arr_open_ + level; //style pfeil retour
        }
        
		if ((i > order) && (((bMain[i].oparent == order) && (testVal == 1)) || ((testVal > 1) && (testVal < 5))))
		{
			if (bMain[i].expand == 0) bMain[i].expand = 3;    
 			if (bMain[i].expand == 1) bMain[i].expand = 3;
			if (bMain[i].expand == 2) bMain[i].expand = 3;
		}    
		bMain[i].exparrow = makeArrow(bMain[i].level, bMain[i].order, bMain[i].expand, bMain[i].mother);
	}
	aMain = bMain;
	if (level == 0)
	{
		aMain[order].stylehg = style_hg_L + level;
		aMain[order].styletxt = style_txt_noact + level;
		aMain[order].stylearrow = style_arr_clos_ + level;
	} 
	markPath(actParent);
	top.botl.window.location = navigatorHTMFile;
	waitSec = window.setTimeout("refreshTree()", 1000);
}


//-----------------------------------------------------------------------------
// goLink: link to the desired path									   [mod 12]
//-----------------------------------------------------------------------------
function goLink(myLink, myLevel, myOrder)
{
	window.clearTimeout(waitSec);
	actLink = myLink;
	actMother = aMain[myOrder].mother;
	actParent = aMain[myOrder].oparent;
	top.botr.window.location = myLink;
	expandLevel(myLevel, myOrder);
}

//-----------------------------------------------------------------------------
// writeDoc: write the navigator menu tree							  [mod 13a]
//-----------------------------------------------------------------------------
function writeDoc()
{
	var windoc = top.botl.window.document;
	var rightLine = "hgLine";
	var rightLineActiv = "hgLineActive";
	windoc.writeln("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"" + widthTotal + "\" align=\"top\">"); 
	for (i=0; i < aMain.length; i++)
	{
		var arrowWidth = spaceLeft + space(aMain[i].level) + arrowGifWidth;
		var textWidth = widthTotal - textSpace - arrowWidth - 1;
		if (aMain[i].expand < 3)
		{
		switch(aMain[i].menulink)
			{
				case "":
					writeTableSmall(windoc, rightLineActiv);
					writeBeginTableBig(windoc);
					var frontarrow = markActivArrow(aMain[i].expand, aMain[i].level, aMain[i].order);				
					windoc.writeln("<td width=\"" + arrowWidth + "\" height=\"" + trHeightBig + "\" valign=\"top\"  align=\"left\" valign =\"top\" class=\"" + aMain[i].stylearrow + "\">" + frontarrow + "</td>");
					windoc.writeln("<td width=\"" + textSpace + "\" height=\"" + trHeightBig + "\" align=\"left\" class=\"" + aMain[i].stylehg + "\"> " + spaceString + "</td>");				
					windoc.writeln("<td width=\"" + textWidth + "\" height=\"" + trHeightBig + "\" align=\"left\" class=\"" + aMain[i].stylehg + "\">" + "<a href=\"javascript:void(0);\" title=\"" + aMain[i].tooltip + "\"><span class=\"" + style_txt_sel + aMain[i].level + "\">" + aMain[i].descr + "</span></a></td>" );
					windoc.writeln("<td width=\"1\" height=\"" + trHeightBig + "\" align=\"left\" class=\"" + rightLineActiv + "\"><img " + spaceGif + " width=\"1\" height=\"" + trHeightBig + "\"></td>" );
					writeEndTableBig(windoc);
				break;
				case "none":
					writeTableSmall(windoc, style_hg_Line);
					writeBeginTableBig(windoc);					
					windoc.writeln("<td width=\"" + arrowWidth + "\" height=\"" + trHeightBig + "\" valign=\"top\" align=\"left\" valign =\"top\" class=\"" + aMain[i].stylearrow + "\">" + aMain[i].exparrow + "</td>");
					windoc.writeln("<td width=\"" + textSpace + "\" height=\"" + trHeightBig + "\" align=\"left\" class=\"" + aMain[i].stylehg  + "\"> " + spaceString + "</td>"); 	
					windoc.writeln("<td width=\"" + textWidth + "\" height=\"" + trHeightBig + "\" align=\"left\" class=\"" + aMain[i].stylehg + "\"><a href=\"javascript:void(0);\" title=\"" + aMain[i].tooltip + "\"><span class=\"none\">"  + aMain[i].descr + "</span></a></td>");					
					windoc.writeln("<td width=\"1\" height=\"" + trHeightBig + "\" align=\"left\" class=\"" + rightLine + "\"><img " + spaceGif + " width=\"1\" height=\"" + trHeightBig + "\"></td>" );
					writeEndTableBig(windoc);
					break;
				default:
					writeTableSmall(windoc, style_hg_Line);
					writeBeginTableBig(windoc);					
					windoc.writeln("<td width=\"" + arrowWidth + "\" height=\"" + trHeightBig + "\" valign=\"top\" align=\"left\" valign =\"top\" class=\"" + aMain[i].stylearrow + "\">" + aMain[i].exparrow + "</td>");
					windoc.writeln("<td width=\"" + textSpace + "\" height=\"" + trHeightBig + "\" align=\"left\" class=\"" + aMain[i].stylehg  + "\"> " + spaceString + "</td>");
					windoc.writeln("<td width=\"" + textWidth + "\" height=\"" + trHeightBig + "\" align=\"left\" class=\"" + aMain[i].stylehg  + "\"> " + "<a href=" + aMain[i].menulink + " title=\"" + aMain[i].tooltip + "\"><span class=\""  +aMain[i].styletxt + "\">" + aMain[i].descr + "</span></a></td>");					
					windoc.writeln("<td width=\"1\" height=\"" + trHeightBig + "\" align=\"left\" class=\"" + rightLine + "\"><img " + spaceGif + " width=\"1\" height=\"" + trHeightBig + "\"></td>" );
					writeEndTableBig(windoc);
				break;
			}
		}
	}
	writeTableSmall(windoc,rightLine);
	windoc.writeln("</table>");
}

//-----------------------------------------------------------------------------
// writeDoc	part II													  [mod 13b]
// - writeBeginTableBig
// - writeEndTableBig
// - writeTableSmall
//-----------------------------------------------------------------------------
function writeBeginTableBig(windoc)
{
	windoc.writeln("<tr width=\"" + widthTotal + "\" height=\"" + trHeightBig + "\">");
	windoc.writeln("<td width=\"" + widthTotal + "\">");
	windoc.writeln("<table height=\"" + trHeightBig + "\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"top\" width=\"" + widthTotal + "\">");
	windoc.writeln("<tr align=\"top\" height=\"" + trHeightBig + "\">");
}
function writeEndTableBig(windoc)
{
	windoc.writeln("</tr>");
	windoc.writeln("</table>");
	windoc.writeln("</td>");
	windoc.writeln("</tr>");
}
function writeTableSmall(windoc,type)
{
	windoc.writeln("<tr width=\"" + widthTotal + "\" height=\"" + trHeightSmall + "\">");
	windoc.writeln("<td width=\"" + widthTotal + "\">");
	windoc.writeln("<table height=\"" + trHeightSmall + "\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"top\" width=\"" + widthTotal + "\">");
	windoc.writeln("<tr align=\"top\" height=\"" + trHeightSmall + "\">");
	windoc.writeln("<td class=\"" + type + "\" width=\"" + widthTotal + "\" height=\"" + trHeightSmall + "\"><img " + spaceGif + " width=\"" + widthTotal + "\" height=\"1\"></td>");
	windoc.writeln("</tr>");
	windoc.writeln("</table>");
	windoc.writeln("</td>");
	windoc.writeln("</tr>");
}

//-----------------------------------------------------------------------------
// refreshTree: refresh periodically the menu tree					   [mod 15]
//-----------------------------------------------------------------------------
function refreshTree()
{
	window.clearTimeout(waitSec);
	var newPathname = top.botr.window.location.href;
	newLink = newPathname.substring(intURL, newPathname.length);
	if (actLink != newLink)
	{
		for ( i = 0 ; i < aMain.length; i++ )
		{
			if (aMain[i].menulink.lastIndexOf(newLink) >= 0)
			{
				actLink = newLink;
				actMother = aMain[i].mother;
				actParent = aMain[i].oparent;
				expandLevel(aMain[i].level, aMain[i].order);
				break;
			}
		}
	}
	waitSec = window.setTimeout("refreshTree()", 5000);

    if (redirect)
	{
		top.botr.window.location.href = redirectsite;
		redirect = false;
	}
}

//-----------------------------------------------------------------------------
// initialization													   [mod 16]
//-----------------------------------------------------------------------------
init();
makeTree();
aMain = bMain;
if (redirect)
{
	waitSec = window.setTimeout("refreshTree()", 1000);
} else
{
	waitSec = window.setTimeout("refreshTree()", 9000);
}
