////////////////////////////////
//			Variablen
////////////////////////////////

var navi = 0;
var home = false;
var aktiv;
var maxPointer = 0;
var nav1Anzahl = 0;
var verzoegerung = 50;
Nav2Anzahl = 	new Array();
Haupt = 	new Array("","","","");
HauptLo = new Array("","","","","","","","","","","","");
HauptHi = new Array("","","","","","","","","","","","");
Deckel = new Array("","","","","","","","","","","","");
Deckel2 = new Array("","","","","","","","","","","","");
SubNav = 	new Array("","","","","","","","","");
SubNavHi = 	new Array("","");
Menuitem = new Array(120);

 
////////////////////////////////
//			HTML code
////////////////////////////////

// Hauptnavi

if(ie4 || dom){
	Haupt[0] += '<div id="nav';

	Haupt[1] += '" style="position:absolute; left:167px; top:100; z-index:1; visibility:';
	Haupt[2] += ';  background-color: transparent;"><table cellpadding="0" cellspacing="0" border="0">';
}
else if(ns4){
	Haupt[0] += '<layer name="nav';

	Haupt[1] += '" left="167" top="100" z-index="1" visibility="';
	Haupt[2] += '"><table cellpadding="0" cellspacing="0" border="0">';
}
Haupt[2] += '	<tr>';

Haupt[3] += '	</tr>';
if(ie4 || dom){
	Haupt[3] += '</table></div>';
}
else if(ns4){
	Haupt[3] += '</table></layer>';
}

// Aktiver Hauptnavipunkt

HauptHi[0] += '		<td onclick="';
HauptHi[1] += ';" onmouseover="show(';
HauptHi[2] += '); status=\'';
HauptHi[3] += '\'; return true;" ';
HauptHi[4] += '>';

HauptHi[6] += '		<table cellpadding="0" cellspacing="0" border="0">';
HauptHi[6] += '			<tr class="navi01">';
HauptHi[6] += '				<td rowspan="4" class="navi01"><img src="sub/1x1.gif" width="1" height="24" alt="" border="0"></td>';
HauptHi[6] += '				<td><img src="sub/1x1.gif" width="19" height="1" alt="" border="0"></td>';
HauptHi[6] += '				<td><img src="sub/1x1.gif" width="1" height="1" alt="" border="0"></td>';
HauptHi[6] += '				<td><img src="sub/1x1.gif" width="19" height="1" alt="" border="0"></td>';
HauptHi[6] += '				<td rowspan="4"><img src="sub/1x1.gif" width="1" height="1" alt="" border="0"></td>';
HauptHi[6] += '			</tr>';
HauptHi[6] += '			<tr class="navi02">';
HauptHi[6] += '				<td rowspan="3"><img src="sub/1x1.gif" width="1" height="1" alt="" border="0"></td>';
HauptHi[6] += '				<td><img src="sub/1x1.gif" width="1';	
	// Wegen NS6 bug
if(gecko){
	HauptHi[7] += '" height="6" alt="" border="0"></td>';
}
else if(ns4){
	HauptHi[7] += '" height="4" alt="" border="0"></td>';
}
else{
	HauptHi[7] += '" height="5" alt="" border="0"></td>';
}

HauptHi[7] += '				<td rowspan="3"><img src="sub/1x1.gif" width="1" height="1" alt="" border="0"></td>';
HauptHi[7] += '			</tr>';
HauptHi[7] += '			<tr class="navi02">';
HauptHi[7] += '				<td valign="middle" align="center" class="navihi" nowrap><a href="#" onClick="';
HauptHi[8] += ';return false;" onmouseover="show(';
HauptHi[9] += '); status=\'';
HauptHi[10] += '\'; return true;" onmouseout="status=\'\'; return true;" class="qlinkHrefHi">';
HauptHi[11] += '</a></td>';
HauptHi[11] += '			</tr>';
HauptHi[11] += '			<tr class="navi02">';
if(gecko){
	HauptHi[11] += '				<td><img src="sub/1x1.gif" width="1" height="6" alt="" border="0"></td>';
}
else if(ns4){
	HauptHi[11] += '				<td><img src="sub/1x1.gif" width="1" height="8" alt="" border="0"></td>';
}
else{
	HauptHi[11] += '				<td><img src="sub/1x1.gif" width="1" height="7" alt="" border="0"></td>';
}

HauptHi[11] += '			</tr>';

HauptHi[11] += '		</table></td>';

HauptHi[11] += '		<td><img src="sub/1x1.gif" width="2" height="1" alt="" border="0"></td>';

// inaktiver Hauptnavipunkt

HauptLo[0] += '		<td onclick="';
HauptLo[1] += ';" onmouseover="show(';
HauptLo[2] += '); status=\'';
HauptLo[3] += '\'; return true;" ';
HauptLo[4] += '>';

HauptLo[6] += '		<table cellpadding="0" cellspacing="0" border="0" class="navi03">';
HauptLo[6] += '			<tr class="navi04">';
HauptLo[6] += '				<td colspan="3"><img src="sub/1x1.gif" width="1" height="3" alt="" border="0"></td>';
HauptLo[6] += '			</tr>';
HauptLo[6] += '			<tr>';
HauptLo[6] += '				<td rowspan="3"><img src="sub/1x1.gif" width="20" height="18" alt="" border="0"></td>';
HauptLo[6] += '				<td><img src="sub/1x1.gif" width="1';
	
	// Wegen NS6 bug
if(gecko){
	HauptLo[7] += '" height="4" alt="" border="0"></td>';
}
else{
	HauptLo[7] += '" height="2" alt="" border="0"></td>';
}
HauptLo[7] += '				<td rowspan="3"><img src="sub/1x1.gif" width="20" height="1" alt="" border="0"></td>';
HauptLo[7] += '			</tr>';
HauptLo[7] += '			<tr>';
HauptLo[7] += '				<td valign="middle" align="center" class="navilo" nowrap><a href="#" onClick="';
HauptLo[8] += ';return false;" onmouseover="show(';
HauptLo[9] += '); status=\'';
HauptLo[10] += '\'; return true;" onmouseout="status=\'\'; return true;" class="qlinkHref">';
HauptLo[11] += '</a></td>';
HauptLo[11] += '			</tr>';
HauptLo[11] += '			<tr>';
HauptLo[11] += '				<td><img src="sub/1x1.gif" width="1" height="2" alt="" border="0"></td>';
HauptLo[11] += '			</tr>';
HauptLo[11] += '			<tr class="navi04">';
HauptLo[11] += '				<td colspan="3"><img src="sub/1x1.gif" width="1" height="3" alt="" border="0"></td>';
HauptLo[11] += '			</tr>';

HauptLo[11] += '		</table></td>';

HauptLo[11] += '		<td><img src="sub/1x1.gif" width="2" height="1" alt="" border="0"></td>';

// Unternavi

SubNavHi[0] += '<span class="navihi">';
SubNavHi[1] += '</span>';

if(ie4 || dom){
	SubNav[0] += '<div id="nav1';
	SubNav[1] += '" style="position:absolute; left:169px; top:126; z-index:1; visibility:';
	SubNav[2] += ';  background-color: transparent;"><table cellpadding="0" cellspacing="0" border="0">';
}
else if(ns4){
	SubNav[0] += '<layer name="nav1';
	SubNav[1] += '" left="171" top="126" z-index="1" visibility="';
	SubNav[2] += '"><table cellpadding="0" cellspacing="0" border="0">';
}
SubNav[2] += '	<tr>';
SubNav[2] += '		<td><img src="sub/1x1.gif" width="9" height="12" alt="" border="0"></td>';

SubNav[3] += '		<td nowrap><a href="#" onclick="';
SubNav[4] += '; return false;" onmouseover="show(';
SubNav[5] += '); status=\'';
SubNav[6] += '\'; return true;" onmouseout="status=\'\'; return true;" class="qlinkHref">';
SubNav[7] += '</a><img src="sub/1x1.gif" width="20" height="10" alt="" border="0"></td>';

SubNav[8] += '	</tr>';
if(ie4 || dom){
	SubNav[8] += '</table></div>';
}
else if(ns4){
	SubNav[8] += '</table></layer>';
}


////////////////////////////////
//			Funktionen
////////////////////////////////

function special1(welchesItem){
	var _special = '';
	if (Menuitem[welchesItem][4].length != 0){
		_special = '<img src="' + Menuitem[welchesItem][4] + '" width="16" height="11" border="0" alt="" align="top">';
	}
	return _special;
}


function special2(welchesItem2){
	var _special2 = '';
	var _special2Zaehler = 0;
	for(p=0;p<maxPointer;p++){
		
		if (welchesItem2*100 == Menuitem[p][1]){
			_special2Zaehler += 1;
		}
	}
	if (_special2Zaehler<3){
		_special2 = '<td><img src="sub/1x1.gif" width="170" height="1" alt="" border="0"></td>';
	    /*  weg damit kg */
		_special2 = ''	
	}

	return _special2;
}

function addMenuitem(menue,vater,text,href,icon){
	Menuitem[maxPointer] = new Array(menue,vater,text,href,icon);
	maxPointer += 1;
	if (menue % 100 == 0){
		nav1Anzahl += 1;
		Nav2Anzahl[nav1Anzahl-1] = 0;
	}
	else if (vater % 100 == 0 && vater != 0){
		Nav2Anzahl[nav1Anzahl-1] += 1;
	}
}

function timeoutKillen(){
	window.clearTimeout(aktiv);
}

function show(was){
	timeoutKillen();
	aktiv = window.setTimeout("_show(" + was + ")",verzoegerung);
}

function _show(was){
	if(ie4){
		for (i=1;i<=nav1Anzahl;i++){
			tmp = "nav" + i;
			tmp2 = "nav1" + i;
//			alert(tmp+ ' = ' +document.all[tmp].style.visibility+ '\n' +tmp2+ ' = ' +document.all[tmp].style.visibility)
			if(i == was){
				document.all[tmp].style.visibility = "visible";
				document.all[tmp2].style.visibility = "visible";
			}
			else{
				document.all[tmp].style.visibility = "hidden";
				document.all[tmp2].style.visibility = "hidden";
			}
		}
	}
	else if(ns4){
		for (i=1;i<=nav1Anzahl;i++){
			tmp = "nav" + i;
			tmp2 = "nav1" + i;
			if(i == was){
				document.layers[tmp].visibility = "show";
				document.layers[tmp2].visibility = "show";
			}
			else{
				document.layers[tmp].visibility = "hide";
				document.layers[tmp2].visibility = "hide";
			}
		}
	}
	else if(dom){
		for (i=1;i<=nav1Anzahl;i++){
			tmp = "nav" + i;
			tmp2 = "nav1" + i;
			if(i == was){
				document.getElementById(tmp).style.visibility = "visible";
				document.getElementById(tmp2).style.visibility = "visible";
			}
			else{
				document.getElementById(tmp).style.visibility = "hidden";
				document.getElementById(tmp2).style.visibility = "hidden";
			}
		}
	}
}

function writeNav(was){
	if (was == 0){
		home = true;
		nav1Anzahl += 1;
	}

/*  	
	var myWin = window.open()
	myWin.document.write(write1stNav(Math.floor(was/100),Math.floor(was/10)-10*Math.floor(was/100)));
	myWin.document.write(write2ndNav(Math.floor(was/100),Math.floor(was/10)-10*Math.floor(was/100)));
*/

	document.write(write1stNav(Math.floor(was/100),Math.floor(was/10)-10*Math.floor(was/100)));
	document.write(write2ndNav(Math.floor(was/100),Math.floor(was/10)-10*Math.floor(was/100)));
}

function write1stNav(was,was2){
	if (home){
		was = nav1Anzahl;
	}
	var _nav1st = '';
	for (j=1; j <= nav1Anzahl; j++){
		var _hugo = 1;
		_nav1st += Haupt[0] + j + Haupt[1];
		if(was == j){
			if(ie4 || dom){
				_nav1st += 'visible' + Haupt[2];
			}
			else if(ns4){
				_nav1st += 'show' + Haupt[2];
			}
		}
		else{
			if(ie4 || dom){
				_nav1st += 'hidden' + Haupt[2];
			}
			else if(ns4){
				_nav1st += 'hide' + Haupt[2];
			}
		}
		for (i=0; i < maxPointer; i++){
			if ((Menuitem[i][0] % 100) == 0){
				if ((Menuitem[i][0] / 100) == j){
					
					_nav1st += HauptHi[0] + Menuitem[i][3] + HauptHi[1] + eval(_hugo) + HauptHi[2] + Menuitem[i][2] + HauptHi[3] + HauptHi[4] + HauptHi[6] + HauptHi[7] + Menuitem[i][3] + HauptHi[8] + eval(_hugo) + HauptHi[9] + Menuitem[i][2] + HauptHi[10] + Menuitem[i][2] + special1(i) + HauptHi[11];
					

					_hugo += 1;
				}
				else{
					
					_nav1st += HauptLo[0] + Menuitem[i][3] + HauptLo[1] + eval(_hugo) + HauptLo[2] + Menuitem[i][2] + HauptLo[3] + HauptLo[4] + HauptLo[6] + HauptLo[7] + Menuitem[i][3] + HauptLo[8] + eval(_hugo) + HauptLo[9] + Menuitem[i][2] + HauptLo[10] + Menuitem[i][2] + special1(i) + HauptLo[11];
					
					_hugo += 1;
				}
			}
		}
		_nav1st += '<td><a href="#" onmouseover="show(' + was + ');status=\'\'; return true;" onmouseout="status=\'\'; return true;" class="navirahmen"><img src="sub/1x1.gif" alt="" width="20" height="20" border="0"></a></td>' + Haupt[3];
	}
	return _nav1st;
}

function write2ndNav(was,was2){
	if (home){
		was = nav1Anzahl;
	}
	var _nav2nd = "";
	for (j=1; j <= nav1Anzahl; j++){
		var _tmpSpezial = special2(j);
		laeufer = 1;
		_nav2nd += SubNav[0] + j + SubNav[1];
		if(was == j){
			if(ie4 || dom){
				_nav2nd += 'visible' + SubNav[2];
			}
			else if(ns4){
				_nav2nd += 'show' + SubNav[2];
			}
		}
		else{
			if(ie4 || dom){
				_nav2nd += 'hidden' + SubNav[2];
			}
			else if(ns4){
				_nav2nd += 'hide' + SubNav[2];
			}
		}
		for (i=0; i < maxPointer; i++){
			if ((Menuitem[i][1] / 100) == j){
				if ((Menuitem[i][0] / 10 - 10 * Math.floor(Menuitem[i][0]/100)) == was2 && j == was){
					_nav2nd += _tmpSpezial + SubNav[3] + Menuitem[i][3] + SubNav[4] + eval(j) + SubNav[5] + Menuitem[i][2] + SubNav[6] + SubNavHi[0] + Menuitem[i][2] + SubNavHi[1] + SubNav[7];
					laeufer += 1;
					_tmpSpezial = '';
				}
				else{
					_nav2nd += _tmpSpezial + SubNav[3] + Menuitem[i][3] + SubNav[4] + eval(j) + SubNav[5] + Menuitem[i][2] + SubNav[6] + Menuitem[i][2] + SubNav[7];
					laeufer += 1;
					_tmpSpezial = '';
				}
			}
		}
		_nav2nd += SubNav[8];
	}
	return _nav2nd;
}

