var menuControl = 1;
function switchMenu() {
	menuControl = (!menuControl) ? 1 : 0;
	if (hasInclude && !is.ns4 && !menuControl) {
		hideContent();
	}
	if (hasFlash && menuControl) {
		showFlash();
	} else if (hasFlash && !menuControl) {
		hideFlash();
	}
	togglemainContainer();
}

var subContainerCounter = 0;
var ParentCounter = 0;
var subContainer_array = new Array();

var Hauptmenu = "";
var hideSubTimer = null;
var hideMainTimer=null;
var hiliteTimer = null;
var sleepTime = 1;
var menu1 = null; 
var initmenu = false;
var HTML_Code = "";
var HTML = "";
var nstext = "";

var mainPosY = startmainPosY;
var subPosX;
var subPosY = 0;
var offsetX = -1;
var itemPosY;
var itemcounter;
var currentItem = null;

var AbstandX = menu_Width + offsetX - (menu_Width - submenu_Width);
if (is.ns6) AbstandX += 12;
if (submenu_side=="left") AbstandX = -AbstandX;

var AbstandY = menu_Height;
var subAbstandY = submenu_Height;
if (is.ns6) menu_Height -= 4;

var linebreak=menu_linebreak;

var layer_Inhalt;
var	tabelle_start = '<table border=0 bgcolor="" cellpadding=0 cellspacing=0><tr><td align=left valign=middle width="1" style="font-size:' + fntsize + ';">';
var	tabelle_image_pfeil_blau = '<img src="' + pfeil_off.src + '" width=1 height=9 border=0>';
var	tabelle_image_pfeil_weiss = '<img src="' + pfeil_on.src + '" width=1 height=9 border=0>';
var	tabelle_image_trans = '<img src="/img/main/tr.gif" width=1 height=9 border=0>';
var	tabelle_mitte = '</td><td valign=middle>';
var	tabelle_ende = '</td></tr></table>';

if (document.layers){
	var sichtbar = "show", unsichtbar = "hidden";
	sleepTime = 1;
	menu_Height -= 2;
	AbstandY = menu_Height;
	subAbstandY = submenu_Height;
	mainPosX -= 2;
	submenu_Width += 1;
	//subpaddingLeft -= 3;
	subPosY += 1;
	AbstandX = menu_Width + offsetX - (menu_Width - submenu_Width);
	AbstandY += 1;
	subAbstandY += 5;
	if (submenu_side=="left")  var AbstandX = -AbstandX;
	fntsize = parseInt(fntsize) - 9;
	var startWidth = innerWidth;
	var startHeight = innerHeight;
} else {
	var sichtbar = "visible", unsichtbar = "hidden";
	var zaehler = 0;
	with(document){
	clear();
	write('<STYLE TYPE="text/css">');
	write('.Container{position:absolute; width:0;text-align:left}');

	write('.out{');
	write('position:absolute;');
	write('width:' + menu_Width + ';');
	write('height:' + menu_Height + ';');
	write('padding-top:' + paddingTop + 'px;');
	write('padding-left:' + paddingLeft + 'px;');
	write('Background-color:' + outcolor + ';');
	write('border-style:solid hidden;');
	write('border-width:1px;');
	write('border-color:' + bordercolor + ';');
	write('font-family:' + fntfamily + ';');
	write('font-size:' + fntsize + ';');
	write('font-weight:' + fntweight + ';');
	write('letter-spacing:' + letterspacing + ';');
	write('color:' + fntout + ';');
	write('text-decoration:none;');
	write('cursor:default;}');

	write('.over{');
	write('position:absolute;');
	write('width:' + menu_Width + ';');
	write('height:' + menu_Height + ';');
	write('Background-color:' + overcolor + ';');
	write('border-style:solid hidden;');
	write('border-width:1px;');
	write('border-color:' + bordercolor + ';');
	write('padding-top:' + paddingTop + 'px;');
	write('padding-left:' + paddingLeft + 'px;');
	write('font-family:' + fntfamily + ';');
	write('font-size:' + fntsize + ';');
	write('font-weight:' + fntweight + ';');
	write('letter-spacing:' + letterspacing + ';');
	write('color:' + fntover + ';');
	write('text-decoration:none;');
	write('cursor:hand;}');

	write('.subout{');
	write('position:absolute;');
	write('width:' + menu_Width + ';');
	write('height:' + submenu_Height + ';');
	write('padding-top:' + paddingTop + 'px;');
	write('padding-left:' + subpaddingLeft + 'px;');
	write('Background-color:' + suboutcolor + ';');
	write('border-style:solid hidden;');
	write('border-width:1px;');
	write('border-color:' + bordercolor + ';');
	write('font-family:' + subfntfamily + ';');
	write('font-size:' + subfntsize + ';');
	write('font-weight:' + subfntweight + ';');
	write('letter-spacing:' + subletterspacing + ';');
	write('color:' + fntout + ';');
	write('text-decoration:none;');
	write('cursor:default;}');

	write('.subover{');
	write('position:absolute;');
	write('width:' + menu_Width + ';');
	write('height:' + submenu_Height + ';');
	write('Background-color:' + overcolor + ';');
	write('border-style:solid hidden;');
	write('border-width:1px;');
	write('border-color:' + bordercolor + ';');
	write('padding-top:' + paddingTop + 'px;');
	write('padding-left:' + subpaddingLeft + 'px;');
	write('font-family:' + subfntfamily + ';');
	write('font-size:' + subfntsize + ';');
	write('font-weight:' + subfntweight + ';');
	write('letter-spacing:' + subletterspacing + ';');
	write('color:' + fntover + ';');
	write('text-decoration:none;');
	write('cursor:hand;}');
	write('</STYLE>');

	close();
	}
}

function changeLayer(id_bgLyr,id_txtLyr,text,bgcolor,fntcolor,image_pfeil){
	id_bgLyr.document.bgColor = bgcolor;
	ref_layer = id_txtLyr.document;

	if (image_pfeil=="sub") {
		layer_Inhalt = '<font face=' + subfntfamily + ' size=' + fntsize + ' color=' + fntcolor + '>' + text + '</font>';
	} else {
		if (image_pfeil==false) layer_Inhalt = tabelle_start + tabelle_image_trans + tabelle_mitte + '<font face=' + fntfamily + ' size=' + fntsize + ' color=' + fntcolor + '>' + text + '</font>' + tabelle_ende;
		else if (fntcolor == fntover) layer_Inhalt = tabelle_start + tabelle_image_pfeil_weiss + tabelle_mitte + '<font face=' + fntfamily + ' size=' + fntsize + ' color=' + fntcolor + '>' + text + '</font>' + tabelle_ende;
		else layer_Inhalt = tabelle_start + tabelle_image_pfeil_blau + tabelle_mitte + '<font face=' + fntfamily + ' size=' + fntsize + ' color=' + fntcolor + '>' + text + '</font>' + tabelle_ende;
	}

	ref_layer.open();
	ref_layer.write (layer_Inhalt);
	ref_layer.close();
}

function initMenu(){
	var AnzmainMenu = 0;
	var AnzLineBreaks = 0;
	var subContainer_Height = new Array();
	var child_menu = new Array();

	for (var i=0; i<menu.length; i++){
		subContainer_Height[i] = 0;
		subPosX = mainPosX;
		menuIndex = menu[i][0];
		if (menu[i][2].length>linebreak) AnzLineBreaks++;
		if (menuIndex.indexOf("_")==-1) AnzmainMenu++;
	}	

	for (var i=0; i<menu.length; i++){
		var itemcounter = 1;
		var SubAnzLineBreaks = 0;
		for (var k=i+1; k<menu.length; k++){
			if (menu[i][0].indexOf("_")!=-1 && menu[i][0].substring(0,menu[i][0].indexOf("_")) == menu[k][0].substring(0,menu[k][0].indexOf("_"))) {
				itemcounter++;
				if (menu[k][2].length>submenu_linebreak) SubAnzLineBreaks++;
				subContainer_Height[i] = ((itemcounter - SubAnzLineBreaks)* submenu_Height) + (SubAnzLineBreaks * submenu_Height*2.2) + itemcounter + 1;
				//subContainer_Height[i] = (itemcounter * submenu_Height*1.24) + itemcounter + 1;
			} else {
				if (itemcounter==1) subContainer_Height[i] = menu_Height + 2;
				itemcounter = 1;
				break;
			}
		}
		//alert('subcontainerheight von menu ' + menu[i][2] + ': '+ subContainer_Height[i]);
	}

	menu_id = "mainContainer";
	var mainContainer_Height = (is.ie4) ? parseInt((AnzmainMenu - 1) * menu_Height + AnzmainMenu + 1) : parseInt((AnzmainMenu - AnzLineBreaks)* menu_Height + AnzLineBreaks * menu_Height*1.24 + AnzmainMenu + 1); 
	nstext = "";

	if (!document.layers){
		if (document.all) {
			HTML_Code = "<DIV ID=" + menu_id + " CLASS='Container'></DIV>";
			window.document.body.insertAdjacentHTML("BeforeEnd",HTML_Code);
		} else {
			var newElem = document.createElement("DIV");
			newElem.id = 'mainContainer';
			newElem.className = 'Container';
			document.body.appendChild(newElem);
		}
		mainPosY = 0;
	}

	menu_id.make_Obj = make_Obj(null,menu_id,null,null,mainPosX,startmainPosY,menu_Width,mainContainer_Height,null,bordercolor,unsichtbar,10,false);

	for (i=0; i<menu.length; i++){
		menuIndex = menu[i][0];
		for (var j=0; j<menuIndex.length; j++){

			if (menuIndex.indexOf("_") == -1){ // mainMenus
				menu_id = "menu" + menuIndex + "Parent";
				menu_link = menu[i][1];
				active = false;
				menu_pfeil = (menu[i].length > 3) ? menu[i][3] : false;
				nstext = menu[i][2];
				
				if (!document.layers) {
					if (document.all){
						if (!menu_pfeil) {
							if (active) {
								//HTML_Code = "<DIV ID=" + menu_id + " CLASS='over'><img src='/img/main/tr.gif' width=5 height=9 border=0 STYLE='margin-right:10px;'>" + menu[i][2] + "</DIV>";
								HTML_Code = "<DIV ID=" + menu_id + " CLASS='over' STYLE='padding-left:10px;'><img src='/img/main/tr.gif' width=0 height=0 border=0>" + menu[i][2] + "</DIV>";
							} else {
								//HTML_Code = "<DIV ID=" + menu_id + " CLASS='out'><img src='/img/main/tr.gif' width=5 height=9 border=0 STYLE='margin-right:10px;'>" + menu[i][2] + "</DIV>";
								HTML_Code = "<DIV ID=" + menu_id + " CLASS='out' STYLE='padding-left:10px;'><img src='/img/main/tr.gif' width=0 height=0 border=0>" + menu[i][2] + "</DIV>";
							}
						} else {
							zaehler+=1;
							if (active) {
								//HTML_Code = "<DIV ID=" + menu_id + " CLASS='over'><img name='img_pfeil" + zaehler + "' src='" + pfeil_on.src + "' width=5 height=9 border=0 STYLE='margin-right:10px;'>" + menu[i][2]+ "</DIV>";
								HTML_Code = "<DIV ID=" + menu_id + " CLASS='over' style='padding-left:10px'><img name='img_pfeil" + zaehler + "' src='" + pfeil_on.src + "' width=0 height=0 border=0>" + menu[i][2]+ "</DIV>";
							} else {
								//HTML_Code = "<DIV ID=" + menu_id + " CLASS='out'><img name='img_pfeil" + zaehler + "' src='" + pfeil_off.src + "' width=5 height=9 border=0 STYLE='margin-right:10px;'>" + menu[i][2]+ "</DIV>";
								HTML_Code = "<DIV ID=" + menu_id + " CLASS='out' style='padding-left:10px'><img name='img_pfeil" + zaehler + "' src='" + pfeil_off.src + "' width=0 height=0 border=0>" + menu[i][2]+ "</DIV>";
							}
						}	
						document.all["mainContainer"].insertAdjacentHTML("BeforeEnd", HTML_Code);
						if (menu[i][2].length>linebreak) {
							menu_id.make_Obj = make_Obj(i,menu_id,'mainContainer',menu_link,0,mainPosY,menu_Width,menu_Height*1.6,null,outcolor,"inherit",10,menu_pfeil,active);
							this.subPosY = startmainPosY;
							startmainPosY = startmainPosY + AbstandY*1.6 - 1;
							mainPosY = mainPosY + AbstandY*1.6 - 1;	
						} else { 
							menu_id.make_Obj = make_Obj(i,menu_id,'mainContainer',menu_link,0,mainPosY,menu_Width,menu_Height,null,outcolor,"inherit",10,menu_pfeil,active);
							this.subPosY = startmainPosY;
							startmainPosY = startmainPosY + AbstandY - 1;
							mainPosY = mainPosY + AbstandY - 1;	
						}
					} else {
						if (!menu_pfeil) {
							//HTML_Code = "<img src='/img/main/tr.gif' width=5 height=9 border=0 STYLE='margin-right:10px;'>" + menu[i][2];
							HTML_Code = "<img src='/img/main/tr.gif' width=0 height=0 border=0>" + menu[i][2];
						} else {
							zaehler+=1;
							if (active) {
								//HTML_Code = "<img name='img_pfeil" + zaehler + "' src='" + pfeil_on.src + "' width=5 height=9 border=0 STYLE='margin-right:10px;'>" + menu[i][2];
								HTML_Code = "<img name='img_pfeil" + zaehler + "' src='" + pfeil_on.src + "' width=0 height=0 border=0>" + menu[i][2];
							} else {
								//HTML_Code = "<img name='img_pfeil" + zaehler + "' src='" + pfeil_off.src + "' width=5 height=9 border=0 STYLE='margin-right:10px;'>" + menu[i][2];
								HTML_Code = "<img name='img_pfeil" + zaehler + "' src='" + pfeil_off.src + "' width=0 height=0 border=0>" + menu[i][2];
							}
						}	
						newElem = document.createElement("DIV");
						newElem.id = menu_id;
						newElem.className = (active) ? 'over' : 'out';
						newElem.innerHTML = HTML_Code;
						document.getElementById("mainContainer").appendChild(newElem);
						if (menu[i][2].length>linebreak) {
							menu_id.make_Obj = make_Obj(i,menu_id,'mainContainer',menu_link,0,mainPosY,menu_Width,menu_Height*1.8,null,outcolor,"inherit",10,menu_pfeil,active);
							this.subPosY = startmainPosY;
							startmainPosY = startmainPosY + AbstandY * 1.8 - 4;
							mainPosY = mainPosY + AbstandY *1.8 - 4;	
						} else { 
							menu_id.make_Obj = make_Obj(i,menu_id,'mainContainer',menu_link,0,mainPosY,menu_Width,menu_Height,null,outcolor,"inherit",10,menu_pfeil,active);
							this.subPosY = startmainPosY;
							startmainPosY = startmainPosY + AbstandY - 1;
							mainPosY = mainPosY + AbstandY - 1;	
						}
					}
				} else {
					if (menu[i][2].length>linebreak) {
						menu_id.make_Obj = make_Obj(i,menu_id,'mainContainer',menu_link,mainPosX,mainPosY-startmainPosY+1,menu_Width-2,menu_Height*1.9,nstext,outcolor,"inherit",10,menu_pfeil,active);
						mainPosY = mainPosY + AbstandY*1.9;
						this.subPosY = mainPosY;
					} else {
						menu_id.make_Obj = make_Obj(i,menu_id,'mainContainer',menu_link,mainPosX,mainPosY-startmainPosY+1,menu_Width-2,menu_Height,nstext,outcolor,"inherit",10,menu_pfeil,active);
						mainPosY = mainPosY + AbstandY;
						this.subPosY = mainPosY;
					}
				}
				break;
			} else { //submenus
				if (document.layers) {
					subPosX = mainPosX;
				} else {
					subPosX = mainPosX;
					this.subPosY = startmainPosY;
				}

				for(var j=0; j < menuIndex.length; j++)
					if (menuIndex.charAt(j) == '_'){
						subPosX = subPosX + AbstandX;
					}

				for(var k=i; k>=0; k--){
					counter=1;
					if (menu[k][0].indexOf("_")!=-1 && (menu[k][0].lastIndexOf("1") == (menu[k][0].indexOf("_") + 1)) && (menu[k][0].lastIndexOf("1") == (menu[k][0].length - 1))){
						subContainer_id = "subContainer" + menu[k][0];
						k=0;
					}
				}
				if (document.layers){
					if (subContainer_id != null && !document.layers[subContainer_id]){
						itemPosY = 1;
						menu_id.make_Obj = make_Obj(i,subContainer_id,null,null,subPosX,this.subPosY,submenu_Width,subContainer_Height[i],nstext,bordercolor,unsichtbar,10,false);
					}
					menu_id = "menu" + menuIndex + "Child";
					menu_link = menu[i][1];
					nstext = menu[i][2];
					if (menu[i][2].length > submenu_linebreak) {
						//alert(nstext+' hat länge '+ nstext.length);
						menu_id.make_Obj = make_Obj(i,menu_id,subContainer_id,menu_link,subPosX,itemPosY,submenu_Width-2,menu_Height*1.9,nstext,outcolor,"inherit",100,false)
						itemPosY = itemPosY + AbstandY*1.9;
					} else {
						menu_id.make_Obj = make_Obj(i,menu_id,subContainer_id,menu_link,subPosX,itemPosY,submenu_Width-2,menu_Height,nstext,outcolor,"inherit",100,false)
						itemPosY = itemPosY + AbstandY;
					}
				} else {
					if (document.all){
						if (!document.all[subContainer_id]){
							itemPosY = 0;
							HTML_Code = '<DIV ID=' + subContainer_id + ' CLASS="Container"></DIV>';
							window.document.body.insertAdjacentHTML("BeforeEnd", HTML_Code);
							menu_id.make_Obj = make_Obj(i,subContainer_id,null,null,subPosX,this.subPosY,submenu_Width,0,null,null,unsichtbar,10,false);
						}
					
						menu_id = "menu" + menuIndex + "Child";
						menu_link = menu[i][1];
						HTML_Code = "<DIV ID=" + menu_id + " CLASS='subout'>" + menu[i][2] + "</DIV>";
						document.all[subContainer_id].insertAdjacentHTML("BeforeEnd", HTML_Code);
						if (menu[i][2].length>submenu_linebreak) {
							menu_id.make_Obj = make_Obj(i,menu_id,subContainer_id,menu_link,0,itemPosY,submenu_Width,submenu_Height*1.6,null,outcolor,"inherit",100,false);
							itemPosY = itemPosY + subAbstandY*1.6 - 1;
						} else {
							menu_id.make_Obj = make_Obj(i,menu_id,subContainer_id,menu_link,0,itemPosY,submenu_Width,submenu_Height,null,outcolor,"inherit",100,false);
							itemPosY = itemPosY + subAbstandY - 1;
						}
					} else {
						if (!document.getElementById(subContainer_id)){
							itemPosY = 0;
							newElem = document.createElement("DIV");
							newElem.id = subContainer_id;
							newElem.className = 'Container';
							document.body.appendChild(newElem);
							menu_id.make_Obj = make_Obj(i,subContainer_id,null,null,subPosX,this.subPosY,submenu_Width,0,null,null,unsichtbar,10,false);
						}
					
						menu_id = "menu" + menuIndex + "Child";
						menu_link = menu[i][1];
						newElem = document.createElement("DIV");
						newElem.id = menu_id;
						newElem.className = 'subout';
						newElem.innerHTML = menu[i][2];
						document.getElementById(subContainer_id).appendChild(newElem);
						if (menu[i][2].length>submenu_linebreak) {
							menu_id.make_Obj = make_Obj(i,menu_id,subContainer_id,menu_link,0,itemPosY,submenu_Width,submenu_Height*1.8,null,outcolor,"inherit",100,false);
							itemPosY = itemPosY + subAbstandY*1.8 - 1;
						} else {
							menu_id.make_Obj = make_Obj(i,menu_id,subContainer_id,menu_link,0,itemPosY,submenu_Width,submenu_Height,null,outcolor,"inherit",100,false);
							itemPosY = itemPosY + subAbstandY - 1;
						}
					}
				}
			}
		}
	}
	if (menuOpen) switchMenu();
}

function make_Obj(arraycounter,id,nestref,link,left,top,width,height,content,bgColor,visibility,zIndex,menu_pfeil,active){
	if (document.layers){
		if (nestref){
			this.ref_layer = eval("document."+nestref+".document."+id+" = new Layer(width, document."+nestref+")");
		} else {
			this.ref_layer = document.layers[id] = new Layer(width);
			eval("document."+id+" = this.ref_layer");
		}
		this.ref_layer.name = id;

		if (!nestref) this.ref_layer.left = left;
		if ( nestref) this.ref_layer.left = 1;

		this.ref_layer.top = top;

		this.ref_layer.clip.top = 0;
		this.ref_layer.clip.right = width;
		this.ref_layer.clip.bottom = height;
		this.ref_layer.clip.left = 0;

		if (id=="mainContainer"){
			Hauptmenu=this.ref_layer;
			Hauptmenu.Height = height;
			Hauptmenu.zIndex = zIndex;
		}

		this.ref_layer.bgColor = (active) ? overcolor : bgColor;
		this.ref_layer.visibility = visibility;

		if (nestref){
			if (id.indexOf("Parent")!=-1){
			for (var p=arraycounter-1; p >= 0; p--){
				if (menu[p][0].length - parseInt(id.length - 10)==2){
					if (id.substring(4,id.lastIndexOf("Parent"))-1 == menu[p][0].substring(0,menu[p][0].lastIndexOf("_"))-1 && (menu[p][0].lastIndexOf("1") == menu[p][0].length-1)){						
						this.ref_layer.child = subContainer_array[ParentCounter];
						ParentCounter++;
						p=0;
					}	
				}
			}			

			this.ref_layer.parent = document.layers[nestref];

			this.txtLyr = new Layer(width,ref_layer);

			this.txtLyr.top = paddingTop;
			this.txtLyr.left = paddingLeft;

			this.txtLyr.clip.top = this.ref_layer.clip.top;
			this.txtLyr.clip.right = this.ref_layer.clip.right;
			this.txtLyr.clip.bottom = this.ref_layer.clip.bottom;
			this.txtLyr.clip.left = this.ref_layer.clip.left;

			this.txtLyr.disptext = nstext;
			this.txtLyr.visibility = "inherit";

			this.layer_Inhalt = tabelle_start;
			this.layer_Inhalt += (!menu_pfeil) ? tabelle_image_trans : (active) ? tabelle_image_pfeil_weiss : tabelle_image_pfeil_blau;
			this.layer_Inhalt += tabelle_mitte + '<font face=' + fntfamily + ' size=' + fntsize + ' color=';
			this.layer_Inhalt += (active) ? fntover : fntout;
			this.layer_Inhalt += '>' + content + '</font>' + tabelle_ende;

			this.txtLyr.document.open();
			this.txtLyr.document.write (layer_Inhalt);
			this.txtLyr.document.close();

			this.dummyLyr = new Layer(width,ref_layer);

			this.dummyLyr.clip.top = this.ref_layer.clip.top;
			this.dummyLyr.clip.right = this.ref_layer.clip.right;
			this.dummyLyr.clip.bottom = this.ref_layer.clip.bottom;
			this.dummyLyr.clip.left = this.ref_layer.clip.left;
			this.dummyLyr.visibility = sichtbar;

			this.dummyLyr.item = this.txtLyr;
			this.dummyLyr.bgLyr = this.ref_layer;

			this.dummyLyr.child = this.ref_layer.child;
			this.dummyLyr.link = link;
			this.dummyLyr.active = active;

			if (!menu_pfeil) this.dummyLyr.pfeil = false;
			else this.dummyLyr.pfeil = true;

			this.dummyLyr.captureEvents(Event.MOUSEUP | Event.MOUSEDOWN | Event.MOUSEOVER |Event.MOUSEOUT);
			this.dummyLyr.onmouseover = overMainmenu;
			this.dummyLyr.onmouseout = outMainmenu;
			this.dummyLyr.onmouseup = downmenuItem;
			}
			else if (id.indexOf("Child")!=-1){
				for(var c=arraycounter-1; c >= 0; c--){
					var id_str=id.substring(4,id.length);
					id_str=id_str.substring(0,id_str.lastIndexOf("Child"));

					if (parseInt(menu[c][0].length - id_str.length)==2 && menu[c][0].substring(0,menu[c][0].length-2) == id_str){		
						if (menu[c][0].lastIndexOf("1") == parseInt(menu[c][0].length-1)){
							this.ref_layer.child = subContainer_array[c];
							this.ref_layer.child.top = parseInt(document.layers[nestref].top) + parseInt(ref_layer.top) - 1;
							c=0;
						}	
					}			
				}
				this.ref_layer.parent = document.layers[nestref];

				this.txtLyr = new Layer(width,ref_layer);

				this.txtLyr.top = paddingTop;
				this.txtLyr.left = paddingLeft;

				this.txtLyr.clip.top = this.ref_layer.clip.top;
				this.txtLyr.clip.right = this.ref_layer.clip.right;
				this.txtLyr.clip.bottom = this.ref_layer.clip.bottom;
				this.txtLyr.clip.left = this.ref_layer.clip.left;

				this.txtLyr.disptext = nstext;

				this.txtLyr.visibility = "inherit";

				this.txtLyr.document.open();
				this.txtLyr.document.write('<font face=' + subfntfamily + ' size=' + fntsize + ' color=' + fntout + '>' + content + '</font>');
				this.txtLyr.document.close();

				this.dummyLyr = new Layer(width,ref_layer);

				this.dummyLyr.clip.top = this.ref_layer.clip.top;
				this.dummyLyr.clip.right = this.ref_layer.clip.right;
				this.dummyLyr.clip.bottom = this.ref_layer.clip.bottom;
				this.dummyLyr.clip.left = this.ref_layer.clip.left;

				this.dummyLyr.visibility = "inherit";

				this.dummyLyr.item = this.txtLyr;
				this.dummyLyr.bgLyr = this.ref_layer;
				this.dummyLyr.parent = this.ref_layer.parent;
				this.dummyLyr.child = this.ref_layer.child;
				this.dummyLyr.link = link;

				this.dummyLyr.captureEvents(Event.MOUSEUP | Event.MOUSEDOWN | Event.MOUSEOVER | Event.MOUSEOUT);
				this.dummyLyr.onmouseover = overSubItem;
				this.dummyLyr.onmouseout = outSubItem;
				this.dummyLyr.onmouseup = downmenuItem;
				}
			}
			if (id.indexOf("subContainer")!=-1){
				this.ref_layer.top = mainPosY;
				subContainer_array[subContainerCounter] = this.ref_layer;
				subContainerCounter++;
			}
	} else {
		this.ref_layer = (document.all) ? this.document.all[id] : this.document.getElementById(id);
		this.ref_layer.style.left = left;
		this.ref_layer.style.top  = top;
		this.ref_layer.style.width  = width;
		this.ref_layer.style.height = height;
		this.ref_layer.style.zIndex = zIndex;
		this.ref_layer.style.visibility = visibility;

		if (id=="mainContainer"){
			Hauptmenu = this.ref_layer;
			Hauptmenu.Height = height;
		}
		this.ref_layer.link = link;
		this.ref_layer.active = active;
		
		if (id.lastIndexOf("Parent")!=-1){
			for (var p=arraycounter-1; p >= 0; p--){
				if (menu[p][0].length - parseInt(id.length - 10)==2){
					if (id.substring(4,id.lastIndexOf("Parent"))-1 == menu[p][0].substring(0,menu[p][0].lastIndexOf("_"))-1 && (menu[p][0].lastIndexOf("1") == menu[p][0].length-1)){
						this.ref_layer.child = subContainer_array[ParentCounter];
						ParentCounter++;
						p=0;
						ref_layer.img_name = "img_pfeil" + ParentCounter;
					}	
				}
			}			
			this.ref_layer.parent = (document.all) ? document.all[nestref] : document.getElementById(nestref);
			this.ref_layer.onmouseover = overMainmenu;
			this.ref_layer.onmouseout = outMainmenu;
			this.ref_layer.onmouseup = downmenuItem;
		} else if (id.lastIndexOf("Child")!=-1){
			for(var c=arraycounter-1; c >= 0; c--){
				var id_str=id.substring(4,id.length);
				id_str=id_str.substring(0,id_str.lastIndexOf("Child"));

				if (parseInt(menu[c][0].length - id_str.length)==2 && menu[c][0].substring(0,menu[c][0].length-2) == id_str){
					if (menu[c][0].lastIndexOf("1") == parseInt(menu[c][0].length-1)){
						this.ref_layer.child = subContainer_array[c];
						this.ref_layer.child.style.top = parseInt((document.all) ? document.all[nestref].style.top : document.getElementById(nestref).style.top) + parseInt(ref_layer.style.top);
						c=0;
					}	
				}			
			}
			this.ref_layer.parent = (document.all) ? document.all[nestref] : document.getElementById(nestref);
			this.ref_layer.onmouseover = overSubItem;
			this.ref_layer.onmouseout = outSubItem;
			this.ref_layer.onmouseup = downmenuItem;
		} else if (id.lastIndexOf("subContainer")!=-1){
			subContainer_array[subContainerCounter] = this.ref_layer;
			subContainerCounter++;
		}
	}
}

//////////////////////////
function hideallsubmenu(){
	clearTimeout(hideSubTimer);
	for(var i=0; i < subContainer_array.length; i++){
		if (is.ns4) subContainer_array[i].visibility = unsichtbar;
		if (!is.ns4) subContainer_array[i].style.visibility = unsichtbar;
	}
}	
function overMainmenu(){
	//alert('overMainmenu');
	if (hideMainTimer) clearTimeout(hideMainTimer);
	hideallsubmenu();
	if (document.layers) {
		if (hiliteTimer) clearTimeout(hiliteTimer);
		clearMainItem();
	}
	currentItem = this;
	if (document.layers){
		if (!this.active) {
			changeLayer(this.bgLyr,this.item,this.item.disptext,overcolor,fntover,this.pfeil);
		} else {
			currentItem.active = true;
		}
		if (this.child) this.child.visibility = sichtbar;
	} else {
		if (!this.active) {
			if (this.img_name) document.images[this.img_name].src = pfeil_on.src;
			this.className = "over";
		} else {
			currentItem.active = true;
		}
		if (this.child) this.child.style.visibility = sichtbar;
	}
}
function outMainmenu(){
	//alert('outMainmenu');
	if (hideMainTimer) clearTimeout(hideMainTimer);
	if (document.layers) {
		if (hiliteTimer) clearTimeout(hiliteTimer);
	} else {
		if (!this.active) {
			if (this.img_name) document.images[this.img_name].src = pfeil_off.src;
			this.className = "out";
		}
	}
	hideSubTimer = setTimeout("hideallsubmenu()",sleepTime);
	if (document.layers) hiliteTimer = setTimeout("clearMainItem()",sleepTime);
}
//////////////////////
function overSubItem(){
	clearTimeout(hideMainTimer);
	clearTimeout(hideSubTimer);
	if (document.layers){
		clearTimeout(hiliteTimer);
		if (!currentItem.active && (currentItem.bgLyr.document.bgColor != overcolor)) changeLayer(currentItem.bgLyr,currentItem.item,currentItem.item.disptext,overcolor,fntover,currentItem.pfeil);
		changeLayer(this.bgLyr,this.item,this.item.disptext,overcolor,fntover,"sub");
		this.parent.visibility = sichtbar;
	} else {
		this.className = "subover";
		this.parent.style.visibility = sichtbar;
		if (!currentItem.active) {
			if (currentItem.img_name) document.images[currentItem.img_name].src = pfeil_on.src;
			currentItem.className = "over";
			currentItem.parent.style.visibility = sichtbar;
		}
	}
	if (this.child){
		if (document.layers){
			this.child.visibility = sichtbar;
		} else {
			this.child.style.visibility = sichtbar;
		}
	}
}
function outSubItem(){
	clearTimeout(hideSubTimer);
	if (document.layers) {
		clearTimeout(hiliteTimer);
		changeLayer(this.bgLyr,this.item,this.item.disptext,outcolor,fntout,"sub");
	} else {
		this.className = "subout";
		if (!currentItem.active) {
			if (currentItem.img_name) document.images[currentItem.img_name].src = pfeil_off.src;
			currentItem.className = "out";
		}
	}
	hideSubTimer = setTimeout("hideallsubmenu()",sleepTime);
	if (document.layers) hiliteTimer = setTimeout("clearMainItem()",sleepTime);
}
function clearMainItem() {
	if (currentItem) {
		if (!currentItem.active) changeLayer(currentItem.bgLyr,currentItem.item,currentItem.item.disptext,outcolor,fntout,currentItem.pfeil);
	}
}
function downmenuItem(){
	if (this.link && ((this.link.indexOf('javascript:') != -1) || (this.link.indexOf('.htm') != -1) || (this.link.indexOf('.php') != -1) || (this.link.indexOf('.asp') != -1))) window.location.href = this.link;
}
function togglemainContainer(){
	if (document.layers){
		if (Hauptmenu.visibility == sichtbar){
			Hauptmenu.visibility = unsichtbar;
			menuOpen = false;
		}else{
			Hauptmenu.visibility = sichtbar;
			menuOpen = true;
			if (zoomOpen != false) {
				eval(zoomOpen + '.ClipAni.Close()');
			}
		}
	} else {
		if (Hauptmenu.style.visibility == sichtbar){
			Hauptmenu.style.visibility = unsichtbar;
			menuOpen = false;
		}else{
			Hauptmenu.style.visibility = sichtbar;
			menuOpen = true;
			if (zoomOpen != false) {
				eval(zoomOpen + '.ClipAni.Close()');
			}
		}
	}
	return;
}