<!--

function MM_swapImgRestore() { 
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { 
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { 
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { 

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}

//	label	The label of the menu -- defaults to "menuLabel" + index
// 	mw		Menu width in pixels
// 	mh		Menu item height in pixels
// 	fnt		Font family used in the menu -- defaults to "arial,helvetica,verdana,sans-serif"
// 	fs		Font size used in the menu -- defaults to 12 point
//	fclr	Font color -- defaults to black
//  fhclr	Font highlight color -- defaults to white
//  bg		Menu item's background color -- defaults to light gray (#cccccc)
//	bgh		Menu's background hilight color -- defaults to blue (#000084)
// mlbg     menulite bgcolor
// mbbg     menuHiliteBgColor
// mcbg     menuHiliteBgColor   

function Menu(label, mw, mh, fnt, fs, fclr, fhclr, bg, bgh) {

	this.version = "990702 [Menu; menu.js]";
	this.type = "Menu";
	this.menuWidth = mw;
	this.menuItemHeight = mh;
	this.fontSize = fs;
	this.fontWeight = "plain"; 
	this.fontFamily = fnt;
	this.fontColor = fclr;
	this.fontColorHilite = fhclr;
	this.bgColor = "#FFFFFF";
    this.menuBorder = 1;
	this.menuItemBorder = 0;
	this.menuItemBgColor = bg; 
	this.menuHiliteBgColor = bgh; 

	this.items = new Array();
	this.actions = new Array();
	this.childMenus = new Array();
	this.hideOnMouseOut = true;
	this.addMenuItem = addMenuItem;
	this.writeMenus = writeMenus;
	this.FW_showMenu = FW_showMenu;
	this.onMenuItemOver = onMenuItemOver;
	this.onMenuItemAction = onMenuItemAction;
	this.hideMenu = hideMenu;
	this.hideChildMenu = hideChildMenu;

	if (!window.menus) window.menus = new Array();
	this.label = label || "menuLabel" + window.menus.length;

	window.menus[this.label] = this;
	window.menus[window.menus.length] = this;

	if (!window.activeMenus) window.activeMenus = new Array();

}

function addMenuItem(label, action) {
	this.items[this.items.length] = label;
	this.actions[this.actions.length] = action;
}

function FIND(item) {
	if (document.all) return(document.all[item]);
	if (document.getElementById) return(document.getElementById(item));
	return(false);
}

function writeMenus(container) {
	if (window.triedToWriteMenus) return;
	if (!container && document.layers) {
		window.delayWriteMenus = this.writeMenus;
		var timer = setTimeout('delayWriteMenus()', 250);
		container = new Layer(100);
		clearTimeout(timer);

	} else if (document.all || document.hasChildNodes) {
		document.writeln('<SPAN ID="menuContainer"></SPAN>');
		container = FIND("menuContainer");
	}
	window.fwHideMenuTimer = null;

	if (!container) return;	
	window.triedToWriteMenus = true; 
	container.isContainer = true;
	container.menus = new Array();

	for (var i=0; i<window.menus.length; i++) 
		container.menus[i] = window.menus[i];
	window.menus.length = 0;
	var countMenus = 0;
	var countItems = 0;
	var top = 0;
	var content = '';
	var lrs = false;
	var theStat = "";
	var tsc = 0;

	if (document.layers) lrs = true; 

	for (var i=0; i<container.menus.length; i++, countMenus++) {
		var menu = container.menus[i];

		if (lrs) {
			var menuLayer = new Layer(100, container);
			
			var lite = new Layer(100, menuLayer);
			lite.top = menu.menuBorder;
			lite.left = menu.menuBorder;

			var body = new Layer(100, lite);
			body.top = menu.menuBorder;
			body.left = menu.menuBorder;

		} else {

			content += ''+
			
//hintergrundlayer			
			'<DIV ID="menuLayer'+ countMenus +'" STYLE="position:absolute;z-index:1;left:1;top:'+ (i * 100) +';visibility:hidden;" onMouseOut="mouseoutMenu();">\n'+

//menulayer
			'	 <DIV ID="menuFg'+ countMenus +'" STYLE="position:absolute;left:'+ menu.menuBorder +';top:'+ menu.menuBorder +';visibility:hide;">\n'+

			'';

		}

		var x=i;

		for (var i=0; i<menu.items.length; i++) {
			var item = menu.items[i];
			var childMenu = false;	
			var defaultHeight = menu.fontSize+6;
			var defaultIndent = menu.fontSize;

			if (item.label) {
				item = item.label;
				childMenu = true;
			}

			menu.menuItemHeight = menu.menuItemHeight || defaultHeight;
			menu.menuItemIndent = menu.menuItemIndent || defaultIndent;

			var itemProps = 'font-family:' + menu.fontFamily +';font-weight:' + menu.fontWeight + ';fontSize:' + menu.fontSize + ';';

			if (menu.fontStyle) itemProps += 'font-style:' + menu.fontStyle + ';';
			if (document.all) 

				itemProps += 'font-size:' + menu.fontSize + ';" onMouseOver="onMenuItemOver(null,this);" onClick="onMenuItemAction(null,this);';

			else if (!document.layers) {
				itemProps += 'font-size:' + menu.fontSize + 'px;';
			}

			var l;
			if (lrs) {
				l = new Layer(800,body);
			}

			var dTag	= '<DIV ID="menuItem'+ countItems +'" STYLE="position:absolute;left:0;top:'+ (i * menu.menuItemHeight) +';'+ itemProps +'">';
			var dClose = '</DIV>'
			var textProps = 'position:absolute;left:' + menu.menuItemIndent + ';top:1;';

			if (lrs) {
				textProps +=itemProps;
				dTag = "";
				dClose = "";
			}

			var dText	= '<DIV ID="menuItemText'+ countItems +'" STYLE="' + textProps + 'color:'+ menu.fontColor +';">'+ item +'&nbsp</DIV>\n<DIV ID="menuItemHilite'+ countItems +'" STYLE="' + textProps + 'top:1;color:'+ menu.fontColorHilite +';visibility:hidden;">'+ item +'&nbsp</DIV>';

				content += ( dTag + dText + dClose);

			if (lrs) {
				l.document.open("text/html");
				l.document.writeln(content);
				l.document.close();	
				content = '';
				theStat += "-";
				tsc++;
				if (tsc > 50) {
					tsc = 0;
					theStat = "";
				}
				status = theStat;
			}
			countItems++;  
		}

		if (lrs) {
			var focusItem = new Layer(100, body);
			focusItem.visiblity="hidden";
			focusItem.document.open("text/html");
			focusItem.document.writeln("&nbsp;");
			focusItem.document.close();	

		} else {
		  content += '	  <DIV ID="focusItem'+ countMenus +'" STYLE="position:absolute;left:0;top:0;visibility:hide;" onClick="onMenuItemAction(null,this);">&nbsp;</DIV>\n';
		  content += '   </DIV>\n  </DIV>\n</DIV>\n';

		}

		i=x;

	}

	if (document.layers) {		
		container.clip.width = window.innerWidth;
		container.clip.height = window.innerHeight;
		container.onmouseout = mouseoutMenu;
		container.menuHiliteBgColor = this.menuHiliteBgColor;

		for (var i=0; i<container.document.layers.length; i++) {
			proto = container.menus[i];
			var menu = container.document.layers[i];
			container.menus[i].menuLayer = menu;
			container.menus[i].menuLayer.Menu = container.menus[i];
			container.menus[i].menuLayer.Menu.container = container;
			var body = menu.document.layers[0].document.layers[0];
			body.clip.width = proto.menuWidth || body.clip.width;
			body.clip.height = proto.menuHeight || body.clip.height;

			for (var n=0; n<body.document.layers.length-1; n++) {
				var l = body.document.layers[n];
				l.Menu = container.menus[i];
				l.menuHiliteBgColor = proto.menuHiliteBgColor;
				l.document.bgColor = proto.menuItemBgColor;
				l.saveColor = proto.menuItemBgColor;
				l.onmouseover = proto.onMenuItemOver;
				l.onclick = proto.onMenuItemAction;
				l.action = container.menus[i].actions[n];
				l.focusItem = body.document.layers[body.document.layers.length-1];
				l.clip.width = proto.menuWidth || body.clip.width + proto.menuItemIndent;
				l.clip.height = proto.menuItemHeight || l.clip.height;

				if (n>0) l.top = body.document.layers[n-1].top + body.document.layers[n-1].clip.height + proto.menuItemBorder;
				l.hilite = l.document.layers[1];

			}

			body.document.bgColor = proto.bgColor;
			body.clip.width  = l.clip.width +proto.menuBorder;
			body.clip.height = l.top + l.clip.height +proto.menuBorder;

			var focusItem = body.document.layers[n];
			focusItem.clip.width = body.clip.width; 
			focusItem.Menu = l.Menu; 
			focusItem.top = -30; 
            focusItem.captureEvents(Event.MOUSEDOWN);
            focusItem.onmousedown = onMenuItemDown;

			menu.document.bgColor = proto.menuHiliteBgColor;
			menu.clip.width = body.clip.width  ;
			menu.clip.height = body.clip.height ;

		}

	} else {

		if ((!document.all) && (container.hasChildNodes)) {
			container.innerHTML=content;
		} else {
			container.document.open("text/html");
			container.document.writeln(content);
			container.document.close();	
		}

		if (!FIND("menuLayer0")) return;
		var menuCount = 0;
		for (var x=0; x<container.menus.length; x++) {

			var menuLayer = FIND("menuLayer" + x);
			container.menus[x].menuLayer = "menuLayer" + x;
			menuLayer.Menu = container.menus[x];
			menuLayer.Menu.container = "menuLayer" + x;
			menuLayer.style.zIndex = 1;
		    var s = menuLayer.style;
			s.top = s.pixelTop = -300;
			s.left = s.pixelLeft = -300;
			var menu = container.menus[x];
			menu.menuItemWidth = menu.menuWidth || menu.menuIEWidth || 140;
			menuLayer.style.backgroundColor = menu.menuHiliteBgColor;
			var top = 0;

			for (var i=0; i<container.menus[x].items.length; i++) {
				var l = FIND("menuItem" + menuCount);
				l.Menu = container.menus[x];

				if (l.addEventListener) {
					l.style.width = menu.menuItemWidth;	
					l.style.height = menu.menuItemHeight;
					l.style.top = top; 
					l.addEventListener("mouseover", onMenuItemOver, false);
					l.addEventListener("click", onMenuItemAction, false);
					l.addEventListener("mouseout", mouseoutMenu, false);

				} else { 
					l.style.pixelWidth = menu.menuItemWidth;	
					l.style.pixelHeight = menu.menuItemHeight;
					l.style.pixelTop = top;
				}

				top = top + menu.menuItemHeight+menu.menuItemBorder;
				l.style.fontSize = menu.fontSize;
				l.style.backgroundColor = menu.menuItemBgColor;
				l.style.visibility = "inherit";
				l.saveColor = menu.menuItemBgColor; 
				l.menuHiliteBgColor = menu.menuHiliteBgColor;
				l.action = container.menus[x].actions[i];
				l.hilite = FIND("menuItemHilite" + menuCount);
				l.focusItem = FIND("focusItem" + x);
				l.focusItem.style.pixelTop = l.focusItem.style.top = -30;
				l.style.cursor = "hand"
				menuCount++;

			}

			menu.menuHeight = top;
			var body = FIND("menuFg" + x);
			s = body.style;
			s.height = 0;
			s.width = 0;
			s.backgroundColor = menu.bgColor;
//det
			s = menuLayer.style; 
			s.width = s.pixelWidth  = menu.menuItemWidth + (menu.menuBorder * 2);
			s.height = s.pixelHeight  = menu.menuHeight+(menu.menuBorder*2);
			s.backgroundColor = menu.menuHiliteBgColor;
		}

	}

	if (document.captureEvents) {	
		document.captureEvents(Event.MOUSEUP);
	}

	if (document.addEventListener) {	
		document.addEventListener("mouseup", onMenuItemOver, false);
	}

	if (document.layers && window.innerWidth) {
		window.onresize = NS4resize;
		window.NS4sIW = window.innerWidth;
		window.NS4sIH = window.innerHeight;
	}

	document.onmouseup = mouseupMenu;
	window.fwWroteMenu = true;
	status = ""; 
}

function NS4resize() {

	if (NS4sIW < window.innerWidth || 
		NS4sIW > window.innerWidth || 
		NS4sIH > window.innerHeight || 
		NS4sIH < window.innerHeight ) 

	{
		window.location.reload();
	}
}

function onMenuItemOver(e, l) {

	FW_clearTimeout();
	l = l || this;
	a = window.ActiveMenuItem;

	if (document.layers) {
		if (a) {
			a.document.bgColor = a.saveColor;
			if (a.hilite) a.hilite.visibility = "hidden"; 
			a.focusItem.top = -100;
			a.clicked = false; 
		}

		if (l.hilite) {
			l.document.bgColor = l.menuHiliteBgColor;
			l.zIndex = 1; 
			l.hilite.visibility = "inherit"; 
			l.hilite.zIndex = 2; 
			l.document.layers[1].zIndex = 1;
			l.focusItem.zIndex = this.zIndex +2;
		}

		l.focusItem.top = this.top;

	} else if (l.style && l.Menu) {

		if (a) {
			a.style.backgroundColor = a.saveColor;
			if (a.hilite) a.hilite.style.visibility = "hidden"; 
		} 

		if (l.isSeparator) return;
		l.style.backgroundColor = l.menuHiliteBgColor;
		l.zIndex = 1; 
		
		if (l.hilite) {
			l.style.backgroundColor = l.menuHiliteBgColor;
			l.hilite.style.visibility = "inherit";
		}

		l.focusItem.style.top = l.focusItem.style.pixelTop = l.style.pixelTop;
		l.focusItem.style.zIndex = l.zIndex +1;
		l.Menu.hideChildMenu(l); 
	} else {
		return;
	}
	window.ActiveMenuItem = l;
}

function onMenuItemAction(e, l) {
	l = window.ActiveMenuItem; 
	if (!l) return;
	hideActiveMenus();
	if (l.action) {
		eval("" + l.action);
	}
	window.ActiveMenuItem = 0;
}

function FW_clearTimeout()
{
	if (fwHideMenuTimer) clearTimeout(fwHideMenuTimer);
	fwHideMenuTimer = null;
	fwDHFlag = false;
}

function FW_startTimeout()
{
	fwStart = new Date();
	fwDHFlag = true;
	fwHideMenuTimer = setTimeout("fwDoHide()", 1000);
}

function fwDoHide()
{
	if (!fwDHFlag) return;
	var elapsed = new Date() - fwStart;
	if (elapsed < 1000) {
		fwHideMenuTimer = setTimeout("fwDoHide()", 1100-elapsed);
		return;
	}

	fwDHFlag = false;
	hideActiveMenus();
	MM_swapImgRestore()
	window.ActiveMenuItem = 0;
}

function FW_showMenu(menu, x, y, name, bild, child) {
	if (!window.fwWroteMenu) return;
	FW_clearTimeout();
	MM_swapImgRestore();
    MM_swapImage(name,'',bild,1);

	if (document.layers) {
		if (menu) {
			var l = menu.menuLayer || menu;
			l.left = 1;
			l.top = 1;
			hideActiveMenus();

			if (this.visibility) l = this;
			window.ActiveMenu = l;

		} else {
			var l = child;

		}
		if (!l) return;
		for (var i=0; i<l.layers.length; i++) { 			   
			if (!l.layers[i].isHilite)
				l.layers[i].visibility = "inherit";

			if (l.layers[i].document.layers.length > 0) 
				FW_showMenu(null, "relative", "relative", l.layers[i]);
		}

		if (l.parentLayer) {
			if (x != "relative") 

				l.parentLayer.left = x || window.pageX || 0;
			if (l.parentLayer.left + l.clip.width > window.innerWidth) 
				l.parentLayer.left -= (l.parentLayer.left + l.clip.width - window.innerWidth);

			if (y != "relative") 
				l.parentLayer.top = y || window.pageY || 0;
			if (l.parentLayer.isContainer) {

				l.Menu.xOffset = window.pageXOffset;
				l.Menu.yOffset = window.pageYOffset;
				l.parentLayer.clip.width = window.ActiveMenu.clip.width +2;
				l.parentLayer.clip.height = window.ActiveMenu.clip.height +2;

				if (l.parentLayer.menuHiliteBgColor) l.parentLayer.document.bgColor = l.parentLayer.menuHiliteBgColor;

			}
		}
		l.visibility = "inherit"; 

		if (l.Menu) l.Menu.container.visibility = "inherit";

	} else if (FIND("menuItem0")) {
		var l = menu.menuLayer || menu;	

		hideActiveMenus(); 
		if (typeof(l) == "string") {
			l = FIND(l);
		}
		window.ActiveMenu = l;
		var s = l.style;
		s.visibility = "inherit";
		if (x != "relative") 
			s.left = s.pixelLeft = x || (window.pageX + document.body.scrollLeft) || 0;
		if (y != "relative") 
			s.top = s.pixelTop = y || (window.pageY + document.body.scrollTop) || 0;
		l.Menu.xOffset = document.body.scrollLeft;
		l.Menu.yOffset = document.body.scrollTop;

	}
	if (menu) {
		window.activeMenus[window.activeMenus.length] = l;
	}
}

function onMenuItemDown(e, l) {
	var a = window.ActiveMenuItem;
	if (document.layers) {
		if (a) {
			a.eX = e.pageX;
			a.eY = e.pageY;
			a.clicked = true;

		}
    }
}

function mouseupMenu(e)
{
	hideMenu(true, e); 
	hideActiveMenus();
	return true;

}

function getExplorerVersion()

{
	var ieVers = parseFloat(navigator.appVersion);
	if( navigator.appName != 'Microsoft Internet Explorer' )
		return ieVers;
	var tempVers = navigator.appVersion;
	var i = tempVers.indexOf( 'MSIE ' );
	if( i >= 0 ) {
		tempVers = tempVers.substring( i+5 );
		ieVers = parseFloat( tempVers ); 
	}
	return ieVers;
}

function mouseoutMenu()
{
	if ((navigator.appName == "Microsoft Internet Explorer")
		&& (getExplorerVersion() < 4.5))
		return true;
	hideMenu(false, false);
	return true;
}

function hideMenu(mouseup, e) {

	var a = window.ActiveMenuItem;
	if (a && document.layers) {

		a.document.bgColor = a.saveColor;
		a.focusItem.top = -30;

		if (a.hilite) a.hilite.visibility = "hidden";
		if (mouseup && a.action && a.clicked && window.ActiveMenu) {
 			if (a.eX <= e.pageX+15 && a.eX >= e.pageX-15 && a.eY <= e.pageY+10 && a.eY >= e.pageY-10) {
				setTimeout('window.ActiveMenu.Menu.onMenuItemAction();', 2);
			}
		}
		a.clicked = false;

	} else if (window.ActiveMenu && FIND("menuItem0")) {

		if (a) { 
			a.style.backgroundColor = a.saveColor;
			if (a.hilite) a.hilite.style.visibility = "hidden"; 
		}
	}

	if (!mouseup && window.ActiveMenu) {

		if (window.ActiveMenu.Menu) {
			if (window.ActiveMenu.Menu.hideOnMouseOut) {
				FW_startTimeout();
			}
			return(true);
		}
	}
	return(true);
}

function PxToNum(pxStr)
{ 
	if (pxStr.length > 2) {
		n = Number(pxStr.substr(0, pxStr.length-2));
		return(n);
	}
	return(0);
}

function hideChildMenu(hcmLayer) {

	FW_clearTimeout(); 
	var l = hcmLayer; 

	for (var i=0; i < l.Menu.childMenus.length; i++) {
		var theLayer = l.Menu.childMenus[i]; 
		if (document.layers) { 
			theLayer.visibility = "hidden";

		} else { 
			theLayer = FIND(theLayer); 
			theLayer.style.visibility = "hidden";
		}
		theLayer.Menu.hideChildMenu(theLayer);
	}
}

function hideActiveMenus() {
	if (!window.activeMenus) return;

	for (var i=0; i < window.activeMenus.length; i++) {
		if (!activeMenus[i]) continue; 
		if (activeMenus[i].visibility && activeMenus[i].Menu) { 
			activeMenus[i].visibility = "hidden"; 
			activeMenus[i].Menu.container.visibility = "hidden"; 
			activeMenus[i].Menu.container.clip.left = 0;  
		} else if (activeMenus[i].style) { 
			var s = activeMenus[i].style;
			s.visibility = "hidden"; 
			s.left = -200; 
			s.top = -200;
		}
	}
	if (window.ActiveMenuItem) {
		hideMenu(false, false); 
	}
	window.activeMenus.length = 0;
}
//-->
