var all_layers = Array();

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


// Hauptmen¸s ////////////////////
//////////////////////////////////
//////////////////////////////////
function makemenu(layerdirection, layers, layername, cellwidth, cellheight, layerleft, layertop, layerwidth, layerheight, zindex, visible)
{
if (layername != "topmenu" && layername != "hauptmenu") all_layers[all_layers.length] = layername;
// layerhead
	// style
	

	document.writeln("<style type=text/css>");
	document.writeln(".layerstyle"+zindex+" {");
	document.writeln("position:absolute;");
	document.writeln("left:"+layerleft+"px;");
	document.writeln("top:"+layertop+"px;");
	//document.writeln("width:"+layerwidth+"px;");
	//document.writeln("height:"+layerheight+"px;");
	document.writeln("z-index:"+zindex+";");
	document.writeln(" visibility:"+visible+";");
	document.writeln("}</style>");

	document.writeln('<div id='+layername+' class="layerstyle'+zindex+'">\n\r');

// Horizontales Men¸
if (layerdirection == 'hor') 
	{
		//tablehead
		document.writeln('<table height="20" border="0" cellpadding="0" cellspacing="0"><tr>\n\r');
			
			// Tabellenzellen
			for (cell=0; cell<layers.length; cell++)
			{
			 document.writeln('<td width="'+cellwidth+'" height="'+cellheight+'" align="left" bgcolor="#FFCC00" nowrap>'); //navi hintergrund
			 document.writeln('<a href="'+layers[cell][1]+'" class="menutext"');
			 document.writeln(" onmouseOver=\"showlayer('"+layers[cell][2]+"');\"");
			 document.writeln('>&nbsp;'+layers[cell][0]+'</a></td>\n\r');
				if (cell<layers.length-1)
					 {document.writeln('<td width="2" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="2" height="15"></td>\n\r');}
			}

		// tablebottom
		document.writeln('</tr></table>\n\r');
}


// Vertikales Men¸
if (layerdirection == 'ver')
	{
		//tablehead
		document.writeln('<table border="0" cellpadding="0" cellspacing="0">\n\r');
			
			// Tabellenzellen
			for (cell=0; cell<layers.length; cell++)
			{
			 document.writeln('<tr><td width="'+cellwidth+'" height="'+cellheight+'" align="left" bgcolor="#FF9933" nowrap>');  //navi oben klappe hintergrund
			 document.writeln('<a onmouseOver="setCloseTime();"');
			 document.writeln(' href="'+layers[cell][1]+'" class="menutext">&nbsp;'+layers[cell][0]+'</a></td></tr>\n\r');
			if (cell<layers.length-1)
			 {document.writeln('<tr><td height="2" bgcolor="#FFFFFF" align=center><img src="images/blind.gif" height="1" width="129"></td></tr>\n\r');}  //navi oben klappe linie 
			}

		// tablebottom
		document.writeln('</table>\n\r');
}


//layerbottom
document.writeln('</div>\n\r');
}

//////////////////////////////////////////
//////////////////////////////////////////
//////////////////////////////////////////




// Contentmen¸s /////////////////////////
//////////////////////////////////////////
//////////////////////////////////////////

function makemenu2(layers,layername, menutext, visible, zindex)
{
// layerhead style
	var cellwidth = 124;
	var cellheight = 20;
	var cellheight2 = cellheight + 2;
	var rahmenlinks = 2;
	document.writeln("<style type=text/css>");
	document.writeln(".layer2style"+zindex+" {");
	document.writeln("position:absolute;");
	document.writeln("left:0px;");
	document.writeln("top:180px;");
	document.writeln("width:"+cellwidth+"px;");
	document.writeln("height:300px;");
	document.writeln("z-index:"+zindex+";");
	document.writeln(" visibility:"+visible+";");
	document.writeln("}</style>");

document.writeln('<div id='+layername+' class="layer2style'+zindex+'">\n\r');

		//tablehead
		document.writeln('<table border="0" width="'+cellwidth+'" cellpadding="0" cellspacing="0">\n\r');
		document.writeln('<tr><td bgcolor="#FFCC00" height="'+cellheight+'">');
		document.writeln('<img src="images/spacer.gif" width='+rahmenlinks+' height="'+cellheight+'">');
		document.writeln('</td><td bgcolor="#FFCC00" nowrap class="menutext" align="left" colspan="2">'+menutext+'</td></tr>\n\r');
		document.writeln('<tr><td height="3" colspan="3"><img src="images/spacer.gif" height="15" width="14"></td></tr>\n\r')
		
			// Tabellenzellen
			for (cell=0; cell<layers.length; cell++)
			{
				document.writeln('<tr><td><img src="images/blind.gif" width='+rahmenlinks+'></td>');
				if (menupunkt_nr == (cell+1))
				{
				document.writeln('<td valign="top" bgcolor="#FFCC00"><img src="images/blind.gif" hspace=1 vspace=1></td>');
				document.writeln('<td width="'+cellwidth+'" height="'+cellheight2+'" align="left" valign="middle" nowrap bgcolor="#FFCC00">');  //navi hintergrund
			 	document.writeln('<a href="'+layers[cell][1]+'" class="menuContentTextRot">'+layers[cell][0]+'</a></td></tr>\n\r');
				}
				else
				{
				document.writeln('<td valign="top" bgcolor="#FF9933"><img src="images/spacer.gif" hspace=1 vspace=1></td>');
				document.writeln('<td width="'+cellwidth+'" height="'+cellheight2+'" align="left" valign="middle" nowrap bgcolor="#FF9933">');
			 	document.writeln('<a href="'+layers[cell][1]+'" class="menuContentText">'+layers[cell][0]+'</a></td></tr>\n\r');
				}
			 	if (cell<layers.length-1)
			 		{document.writeln('<tr><td height="5" colspan="3"><img src="images/blind.gif" height="5" width="14"></td></tr>\n\r');}
			}

		// tablebottom
		document.writeln('</table>\n\r');

//layerbottom
document.writeln('</div>\n\r');
}

//////////////////////////////////////////
//////////////////////////////////////////
//////////////////////////////////////////


function showlayer(layerid)
{
  for (layer_i=0;layer_i<all_layers.length;layer_i++)
  {
   MM_showHideLayers(all_layers[layer_i],'','hide');
  }
  MM_showHideLayers(layerid,'','show');
  setCloseTime();
}

function hideAll()
{
  for (layer_i=0;layer_i<all_layers.length;layer_i++)
  {
   MM_showHideLayers(all_layers[layer_i],'','hide');
  }
}

var aktiv = "nothing"; 
function setCloseTime()
{
	if (aktiv!="nothing") window.clearTimeout(aktiv);
	aktiv = window.setTimeout("hideAll()",10000);
}
