var Menu = document.createElement("div");
Menu.style.position = "absolute";//absolute
Menu.style.left = "0px";
Menu.style.top = "0px";
Menu.style.zIndex = "-10";
Menu.id = "FlashLayer";
//Menu.style.backgroundColor = "#FF0000";
var ThisLoc = new String(window.location);
var SiteRoot = ThisLoc.substring(0,ThisLoc.indexOf("/Pages"));

/*
Menu.innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" name="FlashMenu" id="FlashMenu" width="110" height="205">  <param name="movie" value="' + SiteRoot + '/images/submenu.swf">  <param name="quality" value="high">  <param name="wmode" value="transparent"> <param name="scale" value="noscale"> <param name="salign" value="lt"> <embed src="' + SiteRoot + '/images/submenu.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="110" height="205" wmode="transparent" name="FlashMenu" scale="noscale" salign="lt"></embed></object>';
Menu.style.visibility = "visible";*/
setTimeout("InitMenu()",100);

var IsOverNavBar = false;
var IsOverMenu = false;
var TheFlashMenu = 0;

function InitMenu() {
	if(document.body && document.readyState=="complete") {
/*		TheFlashMenu = document.body.appendChild(Menu);
		if(TheFlashMenu) {
//		TheFlashMenu = document.getElementsByName("FlashMenu")[0];
			if(top.CommID==-1) {
				top.CommID = Math.round(Math.random()*10000);	
			}
			//document.getElementById("FlashMenu").setVariable("_root.CommID",top.CommID);
			//document.all.FlashMenu.setVariable("_root.CommID",top.CommID);
		} else {
			alert("Retry attaching menu");
			setTimeout("InitMenu()",200);
		}*/

		
		
		var tempCommID = top.GetCommID();
		Menu.innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" name="FlashMenu" id="FlashMenu" width="110" height="205">  <param name="movie" value="' + SiteRoot + '/images/submenu.swf?CommID=' + tempCommID + '">  <param name="quality" value="high">  <param name="wmode" value="transparent"> <param name="scale" value="noscale"> <param name="salign" value="lt"> <embed src="' + SiteRoot + '/images/submenu.swf?CommID=' + tempCommID + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="110" height="205" wmode="transparent" name="FlashMenu" scale="noscale" salign="lt"></embed></object>';
/*Menu.style.visibility = "visible";*/
		TheFlashMenu = document.body.appendChild(Menu);
	} else {
		setTimeout("InitMenu()",200);
	}
}
function NavBarRollOver(Direction) {
	if(Menu) {
//		TheFlashMenu.height = "100px";
//		Menu.style.height = "1px";
//		Menu.style.width = "1px";		
//		alert(TheFlashMenu.height);
//		alert(document.all['FlashLayer'].offsetHeight); //WERKT!!!!!
//		Menu.style.visibility = "hidden";
		Menu.style.visibility = "visible";
		Menu.style.zIndex = "10";
		IsOverNavBar = true;
	}
//	setTimeout("ShowMenu();",100);
}
function SetSubMenuPosition(Y) {
	YScroll = (document.all)?document.body.scrollTop:window.pageYOffset;
	var TotalY = parseInt(Y,10) + parseInt(YScroll,10);
//	alert("Y: " + parseInt(Y,10) + " Y-SCROLL: " + parseInt(YScroll,10));

	Menu.style.top = TotalY + "px";
//	alert(TotalY);
}
function ShowMenu(Y,Direction) {
	alert("SHOWMENU!");
	Menu.style.visibility = "visible";
}
function NavBarRollOut() {
//	setTimeout("CheckMenu()",500);
	IsOverNavBar = false;
}
function MenuRollOver(Y) {
	IsOverMenu = true;
}
function MenuRollOut() {
//	alert("MENUROLLOUT");
//	setTimeout("CheckMenu()",500);
	IsOverMenu = false;
}
function CheckMenu() {
	if(!IsOverNavBar && !IsOverMenu) {
		Menu.style.visibility = "hidden";
		Menu.style.zIndex = "-10";
	}
}
