hauptMenuPunkte = 5;
menuY = 20;
menuX = 20;

function init() {
   hauptMenu = new Array();
   subMenu = new Array();
   for (i=1;i<=hauptMenuPunkte;i++) {
      hauptMenu[i] = new XElement("menu"+i);
      subMenu[i] = new XElement("menu"+i+"sub");
      subMenu[i].verstecke();
   }
   ordnen();
}
/*---------------------------------*/
function XElement(id) 
{
   //W3C-konform, Netscape 6
   if (document.getElementById) 
   {
      this.el = document.getElementById(id);
      this.css = this.el.style;
   }
   //Internet Explorer 
   else if (document.all) 
   {
      this.el = document.all[id];
      this.css = this.el.style;
   }
   //Netscape Navigator 4
   else if (document.layers) 
   {
      this.el = document.layers[id];
      this.css = this.el;
   }
   this.x = parseInt(this.css.left);
   this.y = parseInt(this.css.top);
   this.zIndex = this.css.zIndex;
   this.sichtbar = true;
   
   if (document.layers) 
   {
      this.breite = this.el.document.width;
      this.hoehe = this.el.document.height;
   }
   else 
   {
      this.breite = this.el.offsetWidth;
      this.hoehe = this.el.offsetHeight;
   }
   this.gehNach = XElement_gehNach;
   this.zeige = XElement_zeige;
   this.verstecke = XElement_verstecke;
}
/*---------------------------------*/
function klapp(nr) 
{
	/*Falls das Untermenu bereits sichtbar, wieder verstecken*/
   if (subMenu[nr].sichtbar) subMenu[nr].verstecke();
   /*Das Untermenu sichtbar machen*/
   else subMenu[nr].zeige();
   ordnen();
}
/*---------------------------------*/
function schliess(nr) 
{
	/*Falls das Untermenu bereits sichtbar, wieder verstecken*/
   if (subMenu[nr].sichtbar) subMenu[nr].verstecke();
   ordnen();
}
/*---------------------------------*/
function XElement_verstecke() 
{
   this.css.visibility = "hidden";
   this.sichtbar = false;
}
/*---------------------------------*/
function XElement_zeige() 
{
   this.css.visibility = "visible";
   this.sichtbar = true;
}
/*---------------------------------*/
function ordnen() 
{
   var posY = menuY;
   for (i=1;i<=hauptMenuPunkte;i++) 
   {
      hauptMenu[i].gehNach(menuX,posY);
      posY+=hauptMenu[i].hoehe;
      if (subMenu[i].sichtbar) 
	  {
         subMenu[i].gehNach(menuX+20,posY);
         posY+=subMenu[i].hoehe;
      }
   }   
}
/*---------------------------------*/
function XElement_gehNach(x,y) {
   this.css.left = x;
   this.css.top = y;
   this.x = x;
   this.y = y;
}
/*---------------------------------*/

function zeige(url){
	//location.href=url;
   alert("zeige  URL :\n"+url);
}


//Funktion die den Hauptlayer immer in der MItte des Bildschirms ausrichtet
function pos()
{
	le=0
	ob=0
	if(document.layers) //ns4
	{
		ob=parseInt(document.main.document.width)
		le=(parseInt(window.innerWidth)-ob)/2
		document.main.left=le
		document.main.visibility="show"
	}
	
	if(document.getElementById&&!document.all) //NS6
	{
		ob=parseInt(document.getElementById('main').offsetWidth)
		le=(parseInt(window.innerWidth)-ob)/2
		document.getElementById('main').style.left=le
		document.getElementById('main').style.visibility="visible"
	}
	else if(document.all) //IE
	{
		ob=parseInt(document.all.main.offsetWidth)
		le=(parseInt(window.document.body.clientWidth)-ob)/2
		document.all.main.style.left=le
		document.all.main.style.visibility="visible"
	}
}

var win = "";
function fenster(Grafik,b,h,n,titel)
 	{
 		/*Dafür sorgen, dass immer nur ein Fenster geöffnet ist*/
		if (win != ""&&win.closed==false)
 	{ 
 		/*Falls ein Fenster geöffnet ist, dieses erst schliessen*/
		win.close();
	}
   win=window.open("",n,"width="+b+",height="+(h+40)+",left=50,top=20"); 
   
   win.document.open("text/html");
   win.document.write("<BODY leftmargin='0' topmargin='0' marginheight='0' marginwidth='0'>");
   win.document.bgColor="#cccccc";
   		
		/*Stylesheets für das neue Fenster*/
   		win.document.write("<style type= text/css>" +
		"a{color:#409546;font-family:Verdana,Arial,sans-serif;text-decoration:none;font-size:12px; }" +
		"a:link { color:#409546;font-family:Verdana,Arial,sans-serif;text-decoration:none;font-size:12px; }" +
		"a:vlink { text-decoration:none; color: #409546;font-family:Verdana,Arial,sans-serif;font-size:12px; }" +
		"a:hover { color: #F6DC6D; text-decoration:none;font-family:Verdana,Arial,sans-serif;font-size:12px; }" +
		"a:alink { color: #409546; text-decoration:none;font-family:Verdana,Arial,sans-serif;font-size:12px; }" +
		"</style>");
		
   win.document.linkColor="#409546";
   win.document.vlinkColor="#409546";
   win.document.Color="#409546";
   win.document.write("<TITLE>" +titel +"</title>");
   win.document.write("<IMG src='"+Grafik+"'>");
   win.document.write("<div align=center><a href='javascript:window.print()'>Seite drucken</a></div>");
   win.document.write("<div align=center><a href='javascript:self.close()'>Fenster schlie&szlig;en</a></div>");
   win.document.close();
   win = "";
 }
 
 
var win = "";
function fenster_mit_text(Grafik,b,h,n,titel,text,zugabe)
 	{
 		/*Dafür sorgen, dass immer nur ein Fenster geöffnet ist*/
		if (win != ""&&win.closed==false)
 	{ 
 		/*Falls ein Fenster geöffnet ist, dieses erst schliessen*/
		win.close();
	}
   win=window.open("",n,"width="+b+",height="+(h+zugabe)+",left=50,top=20"); 
   
   win.document.open("text/html");
   win.document.write("<BODY leftmargin='0' topmargin='0' marginheight='0' marginwidth='0'>");
   win.document.bgColor="#C8C8C8";
   		
		/*Stylesheets für das neue Fenster*/
   		win.document.write("<style type= text/css>" +
		"a{color:red; }" +
		"a:link { color:red; }" +
		"a:vlink { text-decoration:none; color: red; }" +
		"a:hover { color: blue; text-decoration:none; }" +
		"a:alink { color: red; text-decoration:none; }" +
		"</style>");
		
   win.document.linkColor="red";
   win.document.vlinkColor="red";
   win.document.fgColor="black";
   win.document.write("<TITLE>" +titel +"</title>");
   win.document.write("<IMG src='"+Grafik+"'>");
   win.document.write("<div align=center>" +text+ "</div>");
   win.document.write("<div align=center>&nbsp;</div>");
   win.document.write("<div align=center><a href='javascript:window.print()'>Seite drucken</a></div>");
   win.document.write("<div align=center><a href='javascript:self.close()'>Fenster schlie&szlig;en</a></div>");
   win.document.close();
   win = "";
 }