MenuVarNameGlb     = "FuMenu";
MenuAryNameGlb     = "arMenu";
MenuArrowGifGlb    = "IMGLIB/NT-MenuArrow.gif";
MenuDefaultWidthGlb= 120;
MenuArrowWidthGlb  = 6;
MenuArrowHeightGlb = 11;
SpacerGifGlb       = "IMGLIB/dot_clear.gif";
SeparatorGlb=1;
SeparatorColorGlb  = "#3C3C3C";
FontOverColorGlb   = "#000000";
BorderWidthGlb     = 3;
BorderStyleGlb     = "solid";
MenuPaddingLeftGlb = 8;
ImgSizeGlb         = 10;
ChildOffsetGlb     = 5;
ChildOverlapGlb    = 5;
ClickKillGlb       = false; 
KeepHiliteGlb      = true;  // 宣告整體變數
MenuXPosGlb        = 0;
MenuYPosGlb        = 0;
MenuTimerGlb       =null;
LinkElementGlb     =null;
EventClientXGlb    =0;
EventClientYGlb    =0;

ToggleImageGlb=null;

function ToggleItem(ImageName,ItemName)
{
   var oHideableItems=document.all.item(ItemName);
   var oToggleImages =document.all.item(ImageName);
   if ( (oHideableItems!=null) && (oToggleImages!=null))
   {
      ToggleImageGlb=oToggleImages;
      if (oHideableItems.style.display!="none")
      {
         oHideableItems.style.display="none";
         setTimeout("ToggleImageGlb.src='IMGLIB/menu_hidden.gif'", 10); 
      }
      else
      {
         oHideableItems.style.display="";
         setTimeout("ToggleImageGlb.src='IMGLIB/menu_unhid.gif'", 10); 
      }
   }
}
///////////////////////////////////////////////////////////////////////////////
//	Menu 使用的 Member Function
//
//function ShowItProc(on) 
//function KeepInWindowProc() 
//function MenuMouseOverProc(e) 
//function MenuMouseOutProc() 
//function MenuSetupProc(hasParent,openCont,openItem) 
//function SetMenuTreeProc(isChild,parMenu) 
//function HideSelfProc()
//function HideTopProc()
//function HideTreeProc()
//function HideParentsProc()
//function HideChildrenProc()
//function HideElementProc(elmID)
///////////////////////////////////////////////////////////////////////////////
//	Item 使用的 Member Function
//
//function ItemSetupProc(whichItem,whichArray) 
//function ItemOverProc()
//function OnClickProc()

///////////////////////////////////////////////////////////////////////////////
//	其他 Member Function
//
//function makeSpacerLine(nMenuWidth)

///////////////////////////////////////////////////////////////////////////////
// 整體變數
MenuOwnerWndGlb=null;   // 這是一個 window Object
isMac = (navigator.appVersion.indexOf("Mac") != -1);

//current_menu=-1;
window.onload = startIt;
TopCountGlb=1;
IsLoadedGlb=false;   // 在 startIt 時會設為 true, 在 NSunloaded 或 IEunloaded 時設為 false
AreCreatedGlb=false; // 在 InitMenuVars() 設為 false, makeTop()	設為 true

//if (!window.menuVersion) 
//{
//	ClickKillGlb = KeepHiliteGlb = false;
//}

if (!window.imgHspace) imgHspace=0;

isWin = (navigator.appVersion.indexOf("Win") != -1)

VisibleElapseGlb = 500;

ArrowImgStrGlb="<IMG SRC='"+MenuArrowGifGlb+"' WIDTH="+MenuArrowWidthGlb+" HEIGHT="+MenuArrowHeightGlb
              +" VSPACE=2 HSPACE="+imgHspace+" BORDER=0 ALIGN=RIGHT>";

fullImgSize = (ImgSizeGlb+(imgHspace*2));

function HideElementProc(elmID)
{
	for (i = 0; i < document.all.tags(elmID).length; i++)
	{
		obj = document.all.tags(elmID)[i];
		if (! obj || ! obj.offsetParent)	continue;
		// Find the element's offsetTop and offsetLeft relative to the BODY tag.
		objLeft   = obj.offsetLeft;
		objTop    = obj.offsetTop;
		objParent = obj.offsetParent;
		while (objParent.tagName.toUpperCase() != "BODY")
		{
			objLeft  += objParent.offsetLeft;
			objTop   += objParent.offsetTop;
			objParent = objParent.offsetParent;
		}
		// Adjust the element's offsetTop relative to the dropdown menu
      var x=this.style.pixelLeft;
      var y=this.style.pixelTop;
      var w=this.menuWidth;
      var h=this.fullHeight;
		objTop=objTop-y;

		if (x > (objLeft + obj.offsetWidth) || objLeft > (x + w))
			;
		else if (objTop > h)
			;
		else if ((y+h)<=80)
			;
		else
			obj.style.visibility = "hidden";
	}
}

function showElement(elmID)
{
	
	for (i = 0; i < document.all.tags(elmID).length; i++)
	{
		obj = document.all.tags(elmID)[i];
		if (! obj || ! obj.offsetParent)	continue;
		obj.style.visibility = "";
	}
}

///////////////////////////////////////////////////////////////////////////////
//	啟始整體變數,及還原 Menu 的預設值
function InitMenuVars() 
{ 
	if (AreCreatedGlb) 
	{
		var i;
		for (i=1;i<TopCountGlb;i++)
		{
			cur = eval(MenuVarNameGlb+i);
			clearTimeout(cur.hideTimer);
			cur.hideTimer=null;
		}
		clearTimeout(allTimer);
	}
	TopCountGlb=1;
	AreCreatedGlb=false;
	beingCreated = false;
	isOverMenu = false;
	CurrentMenuGlb=null;
	allTimer = null;
}

InitMenuVars(); // 啟始整體變數

/*function keepTrack()  07-04-2001 03:07
{
	if (MenuOwnerWndGlb.document.readyState == "complete") 
	{
		InitMenuVars();
		startIt();
	}
	else 
	{
		setTimeout("keepTrack()",50);
	}
}*/

///////////////////////////////////////////////////////////////////////////////
// 說明   : 宣告 MenuVarNameGlb? 的變數; 在NS中,此變數為Layer, 在IE中,此變數為<DIV>
//	Call : makeMenuIE()
//
function makeElement(whichEl,whichWidth,whichParent,whichContainer) 
{
	//elStr = "<DIV ID="+whichEl+" CLASS="+MenuFontClass+" STYLE='position:absolute; background-color:#C0C0C0;'></DIV>"; // 在此宣告了 Global 變數 MenuVarNameGlb?
   elStr = "<DIV ID="+whichEl+" STYLE='position:absolute; background-color:#C0C0C0;'></DIV>"; // 在此宣告了 Global 變數 MenuVarNameGlb?
	MenuOwnerWndGlb.document.body.insertAdjacentHTML("BeforeEnd",elStr);
	return eval(whichEl);
}

function OnClickProc() 
{
	if (this.linkText.indexOf("javascript:")!=-1) eval(this.linkText) // 執行 JavaScript
	else 
   {
      if (this.newBrowser)
      {
      	
         MenuOwnerWndGlb.open(this.linkText);   // 開啟新視窗用這一個
      }
      else
      {
 
         MenuOwnerWndGlb.location.href=this.linkText;
      }
   }
}

///////////////////////////////////////////////////////////////////////////////
//	說明   : 啟始 Item 的 Subrutine 及 Member
// 在 IE 中, Item 就是 <SPAN>
//	Call : makeMenuIE()
function ItemSetupProc(whichItem,whichArray) 
{
	this.onmouseover= ItemOverProc;
	this.onmouseout = itemOut;
	this.container  = this.offsetParent;

	//arrayPointer = (this.container.hasParent) ? ((whichItem-1)*3)+9 : ((whichItem-1)*3)+9;
   arrayPointer  =((whichItem-1)*5)+9;

	this.dispText  = whichArray[arrayPointer];
	this.linkText  = whichArray[arrayPointer+1];
   //this.fontClass = whichArray[arrayPointer+2];
   	this.newBrowser= whichArray[arrayPointer+3];
	this.hasMore   = whichArray[arrayPointer+4]; // 是否有 Child Menu

	if (this.hasMore) // 是否有 Child Menu
   {
		this.child = eval(MenuVarNameGlb + this.id.substr(4));
		this.child.parentMenu = this.container;
		this.child.parentItem = this;
	}

	if (this.linkText) // linkText 不為空白 
   {
		this.onclick = OnClickProc;
		this.style.cursor = "hand";
	}
   this.style.paddingLeft=MenuPaddingLeftGlb;
   this.style.color=this.container.menuFontColor;
   this.style.fontFamily="Verdana, Arial, Helvetica, sans-serif";
   this.style.fontSize="13";
   
   this.style.borderBottomWidth = SeparatorGlb + "px";
   this.style.borderBottomColor = this.container.menuSeparatorCol;
   this.style.borderBottomStyle = "solid";
   this.style.backgroundColor = this.container.menuBGColor;
}

///////////////////////////////////////////////////////////////////////////////
// determine if menu is in menu tree
//	Call   : makeMenuIE()
//function findTree(men)
//{
//	foundTree = false;
//	for(i=11;i<men.array.length;i+=3)
//	{
//		if(men.array[i]) 
//		{
//			foundTree = true;
//			break;
//		}
//	}
//	return foundTree;
//}

function ShowItProc(on) 
{
	this.style.visibility = (on) ? "visible" : "hidden";
	if (KeepHiliteGlb && this.currentItem) 
	{
		with (this.currentItem.style) 
		{
			
			backgroundColor = this.menuBGColor;
			color = this.menuFontColor;
		}
	}
	this.currentItem=null;
}

///////////////////////////////////////////////////////////////////////////////
//	KeepInWindowProc 將 Menu 調整至視窗的範圍之內
//
function KeepInWindowProc() 
{

	scrBars = 20;
	botScrBar= scrBars;
	rtScrBar = scrBars;
	
   winRight = (MenuOwnerWndGlb.document.body.scrollLeft + MenuOwnerWndGlb.document.body.clientWidth) - rtScrBar;
	rightPos = this.style.pixelLeft + this.menuWidth;

	if (rightPos > winRight) 
	{
		if (this.hasParent) 
		{
			parentLeft = this.parentMenu.style.pixelLeft;
			newLeft = ((parentLeft - this.menuWidth) + ChildOverlapGlb);
			this.style.pixelLeft = newLeft;
		}
		else 
		{
			dif = rightPos - winRight;
			this.style.pixelLeft -= dif;
		}
	}

	winBot = (MenuOwnerWndGlb.document.body.scrollTop + MenuOwnerWndGlb.document.body.clientHeight) - botScrBar;
	botPos = this.style.pixelTop + this.fullHeight;

	if (botPos > winBot) 
	{
		dif = botPos - winBot;
		this.style.pixelTop -= dif;
	}
	
	winLeft = MenuOwnerWndGlb.document.body.scrollLeft;
	leftPos = this.style.pixelLeft;

	if (leftPos < winLeft) 
	{
		if (this.hasParent) 
		{
			parentLeft = this.parentMenu.style.pixelLeft;
			newLeft = ((parentLeft+this.menuWidth) - ChildOverlapGlb);
			this.style.pixelLeft = newLeft;
		}
		else 
		{
			this.style.pixelLeft = 5;
		}
	}
}

///////////////////////////////////////////////////////////////////////////////
//	Call : popMenu()
//
function hideAll() 
{
	var i; // 宣告成 Local 變數
	for (i=1;i<TopCountGlb;i++) 
	{
		temp = eval(MenuVarNameGlb+i+ ".startChild");
		temp.isOn = false;
		if (temp.hasChildVisible) temp.hideChildren();
		temp.showIt(false);
	}	
}

function HideTreeProc() 
{ 
	allTimer = null;
	if (isOverMenu) return;
	if (this.hasChildVisible) 
   {
		this.hideChildren();
	}
	this.hideParents();
   if (!CurrentMenuGlb.isOn)
   {
	showElement("SELECT");
	showElement("OBJECT");
	showElement("IFRAME");	
   }
}

function HideTopProc() 
{

	whichTop = this;
	if (ClickKillGlb)
	{
		whichTop.hideSelf();
	}
	else
	{
		this.hideTimer = setTimeout("if (whichTop.hideSelf) whichTop.hideSelf();",VisibleElapseGlb);
	}
}

function HideSelfProc() 
{

	this.hideTimer = null;
	if (!this.isOn && !isOverMenu) 
   { 
      if (CurrentMenuGlb!=null)
      {
         if (!CurrentMenuGlb.isOn)
         {
            showElement("SELECT");
            showElement("OBJECT");
            showElement("IFRAME");	
         }
      }
      this.showIt(false);
	}
}

function HideParentsProc() 
{	
	tempMenu = this;
	while (tempMenu.hasParent) 
   {
		tempMenu.showIt(false);
		tempMenu.parentMenu.isOn = false;		
		tempMenu = tempMenu.parentMenu;
	}
	tempMenu.hideTop();
}

function HideChildrenProc(item) 
{
	
	tempMenu = this.visibleChild;
	while (tempMenu.hasChildVisible) 
   {
		tempMenu.visibleChild.showIt(false);
		tempMenu.hasChildVisible = false;
		tempMenu = tempMenu.visibleChild;
	}

	if (!this.isOn || !item.hasMore || this.visibleChild != this.child) 
   {
		this.visibleChild.showIt(false);
		this.hasChildVisible = false;
	}
}

///////////////////////////////////////////////////////////////////////////////
//	ItemOverProc
function ItemOverProc()
{

	if (KeepHiliteGlb) 
	{
		if (this.container.currentItem && this.container.currentItem != this) 
		{
			with (this.container.currentItem.style) 
			{
				backgroundColor = this.container.menuBGColor;
				color = this.container.menuFontColor;
			}
		}
	}
	var theEvent=MenuOwnerWndGlb.event;
	if (theEvent.srcElement.tagName == "IMG") return;
	this.style.backgroundColor = this.container.menuBGOver;
	this.style.color = this.container.menuFontOver;

	MenuOwnerWndGlb.status = this.linkText;

	this.container.currentItem=this;

	if (this.container.hasChildVisible) 
	{
		this.container.hideChildren(this);
	}

	if (this.hasMore) 
	{
		horOffset=this.container.menuWidth-ChildOverlapGlb;
		this.childX = this.container.style.pixelLeft + horOffset;
		this.childY = this.offsetTop + this.container.style.pixelTop + ChildOffsetGlb + BorderWidthGlb;
		this.child.moveTo(this.childX,this.childY);
		this.child.keepInWindow();
		this.child.hideElement("SELECT");
		this.child.hideElement("OBJECT");
		this.child.hideElement("IFRAME");
		this.container.hasChildVisible = true;
		this.container.visibleChild = this.child;
		this.child.showIt(true);
	}
}

function itemOut() 
{

	var theEvent=MenuOwnerWndGlb.event;
  	if (theEvent.srcElement.contains(theEvent.toElement)|| (theEvent.fromElement.tagName=="IMG" && theEvent.toElement.contains(theEvent.fromElement)))
        return;
	if (!KeepHiliteGlb) 
   {
		this.style.backgroundColor = this.container.menuBGColor;
		this.style.color = this.container.menuFontColor;
	}
}

function MenuMouseOverProc(e) 
{

	this.isOn = true;
	isOverMenu = true;
	CurrentMenuGlb=this;
	if (this.hideTimer) clearTimeout(this.hideTimer);
}

function MenuMouseOutProc() 
{
	var theEvent=MenuOwnerWndGlb.event;
	if (theEvent.srcElement.contains(theEvent.toElement)) return;
	this.isOn = false;
	isOverMenu = false;
	MenuOwnerWndGlb.status = "";
	if (!ClickKillGlb) allTimer = setTimeout("CurrentMenuGlb.hideTree()",10);  
}

///////////////////////////////////////////////////////////////////////////////
//
function moveTo(xPos,yPos) 
{
	this.style.pixelLeft = xPos;
	this.style.pixelTop = yPos;
}

function cancelSelect(){return false}

///////////////////////////////////////////////////////////////////////////////
//	Call   : setMenuTree()
function MenuSetupProc(hasParent,openCont,openItem) 
{
	
	this.onmouseover = MenuMouseOverProc;
	this.onmouseout  = MenuMouseOutProc;
	this.showIt      = ShowItProc;
	this.keepInWindow= KeepInWindowProc;
   	this.hideElement = HideElementProc;
	this.hideTree    = HideTreeProc;
	this.hideParents = HideParentsProc;
	this.hideChildren= HideChildrenProc;
	this.hideTop     = HideTopProc;
	this.hasChildVisible = false;          // 目前是否有 Children 是 Visible 的狀態
	this.isOn = false;
	this.hideTimer = null;

	this.currentItem=null;		            // 宣告 Member currentItem, 在 ItemOverProc 時會設定此值
	this.hideSelf = HideSelfProc;
		
	if (hasParent) 
	{
		this.hasParent = true;
		this.parentMenu = openCont;
	}
	else 
	{
		this.hasParent = false;
	}

	with (this.style) 
	{
		width = this.menuWidth;
		borderWidth = BorderWidthGlb;
		borderColor = this.menuBorCol;
		borderStyle = BorderStyleGlb;
		zIndex = TopMost_Z_Glb;
	}

	this.lastItem.style.border="";
	this.fullHeight = this.scrollHeight;
	this.showIt(false);
	this.onselectstart = cancelSelect;
	this.moveTo = moveTo;
	this.moveTo(0,0);
}

///////////////////////////////////////////////////////////////////////////////
// sets the colors for menu
//	Call   : makeMenuIE()
function SetMenuTreeProc(isChild,parMenu) 
{
	this.menuWidth = this.array[0] ? this.array[0] : MenuDefaultWidthGlb;
	this.menuLeft = this.array[1];
	this.menuTop = this.array[2];
	this.menuFontColor = this.array[3];// ? this.array[3] : MenuFontColorGlb;
	this.menuFontOver = this.array[4];// ? this.array[4] : FontOverColorGlb;
	this.menuBGColor = this.array[5];// ? this.array[5] : BackColorGlb;
	this.menuBGOver = this.array[6];// ? this.array[6] : OverColorGlb;
	this.menuBorCol = this.array[7];// ? this.array[7] : BorderColorGlb;
	this.menuSeparatorCol = this.array[7] ? this.array[7] : SeparatorColorGlb; // 分隔線的顏色,對 IE 才有效,01-12-2001 改為讀取第七個參數,原來是第八個
	this.treeParent = this;
	this.startChild = this;

	//this.isTree = findTree(this);

	//this.maxItems = (isChild) ? (this.array.length-9)/3 : (this.array.length-9)/3;
   this.maxItems  = (this.array.length-9)/5;
	this.hasParent = isChild;
   this.setup=MenuSetupProc;
	this.itemCount = 0;
}

//////////////////////////////////////////////////////////////////////////////
//	Call   : makeMenuIE()
function makeSpacerLine(nMenuWidth,Color)
{
   if (Color)
   {
      return "<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0><TR><TD bgcolor="+Color+"><IMG src='"+SpacerGifGlb+"' height=1 width="+nMenuWidth+"></TD></TR></TABLE>";
   }
   else
   {
      return "<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0><TR><TD><IMG src='"+SpacerGifGlb+"' height=1 width="+nMenuWidth+"></TD></TR></TABLE>";
   }
}

///////////////////////////////////////////////////////////////////////////////
//	Call   : makeTop(),makeMenuIE()
function makeMenuIE(isChild,menuCount,parMenu) 
{
	menu=makeElement(MenuVarNameGlb + menuCount); // 宣告變數 menu , menu=MenuVarNameGlb?
	menu.array = eval(MenuAryNameGlb + menuCount);

	menu.setMenuTree=SetMenuTreeProc;
	menu.setMenuTree(isChild,parMenu);

	menu.itemStr = "";

// 先在 Menu 的上方畫出一條白色陰影線
//   menu.itemStr+=makeSpacerLine(menu.menuWidth-(BorderWidthGlb*2),"#ffffff");

	while (menu.itemCount < menu.maxItems) 
   {
		menu.itemCount++;

		itemName = "item" + menuCount + "_" + menu.itemCount;

		//arrayPointer = (isChild) ? ((menu.itemCount-1)*3)+9 :((menu.itemCount-1)*3)+9;
      arrayPointer = ((menu.itemCount-1)*5)+9;
		dispText = menu.array[arrayPointer];   // 在 Menu 的前方加一個空白  
		//hasMore = menu.array[arrayPointer + 2];         // 是否有 Child Menu
      hasMore = menu.array[arrayPointer + 4];         // 是否有 Child Menu
		htmStr = (hasMore) ? ArrowImgStrGlb + dispText : dispText;
		menu.itemStr += "<SPAN ID=" + itemName 
                   + " CLASS=" + menu.array[arrayPointer + 2]
                   + " STYLE=\"position:relative, left:50; width:" 
                   + (menu.menuWidth-(BorderWidthGlb*2)) + "\">" + htmStr + "</SPAN>";
      if (menu.itemCount < menu.maxItems) 
      {// 加上分隔線
//         menu.itemStr+=makeSpacerLine(menu.menuWidth-(BorderWidthGlb*2),"#ffffff");
      }
      else 
      {
//         menu.itemStr+=makeSpacerLine(menu.menuWidth-(BorderWidthGlb*2),menu.menuBorCol);
      }
		if (hasMore) 
      {
			makeMenuIE(true,menuCount + "_" + menu.itemCount,menu);
			menu = menu.parentMenu;
		}	
	}

	menu.innerHTML = menu.itemStr;
	itemColl = menu.children.tags("SPAN");
	var i;
	for (i=0; i<itemColl.length; i++) 
   {
		it = itemColl(i);
		it.setup = ItemSetupProc;
		it.setup(i+1,menu.array); // 呼叫 ItemSetupProc
	}
	menu.lastItem = itemColl(itemColl.length-1);
	menu.setup(isChild,parMenu);
}

///////////////////////////////////////////////////////////////////////////////
//	Call   : startIt() 
//
function makeTop()
{
	beingCreated = true;

	TopMost_Z_Glb = 0;   // 這是整體變數
	for (z=0;z<MenuOwnerWndGlb.document.all.length;z++)
	{
		var tmpObject = MenuOwnerWndGlb.document.all(z);
		TopMost_Z_Glb = Math.max(tmpObject.style.zIndex,TopMost_Z_Glb)
	}
	while (eval("window."+MenuAryNameGlb+TopCountGlb)) 
	{
		makeMenuIE(false,TopCountGlb);
		TopCountGlb++
	}

	AreCreatedGlb=true;
	beingCreated = false;
}

function clicked() 
{
	if (!isOverMenu && CurrentMenuGlb!=null && !CurrentMenuGlb.isOn) 
   {
		//whichEl = currentMenu;
		//whichEl.hideTree();
      CurrentMenuGlb.hideTree();
	}
}

///////////////////////////////////////////////////////////////////////////////
//	Call   : DoMenuPopUp()
//
function startIt() 
{
	IsLoadedGlb=true;
	MenuOwnerWndGlb = window;
//	MenuOwnerWndGlb.nav = nav = window;
	if (ClickKillGlb) 
	{
		MenuOwnerWndGlb.document.onmousedown = clicked;
	}
	makeTop();	
}

///////////////////////////////////////////////////////////////////////////////
//	Call   : DoMenuPopUp()
//
function popMenu()
{
	if (!IsLoadedGlb || !AreCreatedGlb) return true;

   //var theEvent=MenuOwnerWndGlb.event;
//	eType=event.type;
//	if (ClickStartGlb && eType != "click") return true;
	hideAll();

	//var linkEl=event.srcElement;
	
	CurrentMenuGlb=eval(LinkElementGlb.menuName);
	CurrentMenuGlb.hasParent = false;
	CurrentMenuGlb.treeParent.startChild=CurrentMenuGlb;
	MenuOwnerWndGlbBod = MenuOwnerWndGlb.document.body;
	//MenuXPosGlb=(CurrentMenuGlb.menuLeft) ? CurrentMenuGlb.menuLeft : (event.clientX + MenuOwnerWndGlbBod.scrollLeft);
	//MenuYPosGlb=(CurrentMenuGlb.menuTop) ? CurrentMenuGlb.menuTop : (event.clientY + MenuOwnerWndGlbBod.scrollTop);

   //MenuXPosGlb=window.event.srcElement.offsetLeft+window.event.srcElement.offsetParent.offsetLeft;
   //MenuXPosGlb=event.srcElement.offsetLeft+event.srcElement.offsetParent.offsetLeft;
   
   MenuXPosGlb=(CurrentMenuGlb.menuLeft) ? CurrentMenuGlb.menuLeft : (EventClientXGlb + MenuOwnerWndGlbBod.scrollLeft);
   MenuXPosGlb=(CurrentMenuGlb.menuLeft) ? xxx : (EventClientXGlb + MenuOwnerWndGlbBod.scrollLeft);	//^^^
   MenuYPosGlb=(CurrentMenuGlb.menuTop) ? CurrentMenuGlb.menuTop : (EventClientYGlb + MenuOwnerWndGlbBod.scrollTop);

	//kk.innerText=arMenu1[1]+"?"+LinkElementGlb.menuName; //^^

	CurrentMenuGlb.moveTo(MenuXPosGlb,MenuYPosGlb);
	CurrentMenuGlb.keepInWindow()
	//CurrentMenuGlb.hideElement("SELECT");
	//CurrentMenuGlb.hideElement("OBJECT");
	//CurrentMenuGlb.hideElement("IFRAME");
	CurrentMenuGlb.isOn = true;
	CurrentMenuGlb.showIt(true);
	return false;
}

///////////////////////////////////////////////////////////////////////////////
//	Call   : HTML
//	menuName : Menu 的名稱
//	e			: event
//	See Also : DoMenuPopDown()
function DoMenuPopUp(menuName,e)
{
   if (document.readyState=="complete") // 08-20-2002 加上此檢查
   {
      if (!beingCreated && !AreCreatedGlb) startIt();
      LinkElementGlb=event.srcElement;
	   //if (ClickStartGlb) // 是整體變數
	   //{
	   //	linkEl.onclick = popMenu();
	   //}
	   LinkElementGlb.menuName=menuName;
      EventClientXGlb=event.clientX;
      EventClientYGlb=event.clientY;
   
      if ((CurrentMenuGlb!=null) && (CurrentMenuGlb.hideTimer!=null))
      {
         popMenu();
      }
      else
      {
         if (MenuTimerGlb!=null)
         {
            clearTimeout(MenuTimerGlb);
            MenuTimerGlb=null;
         }
         MenuTimerGlb=setTimeout("popMenu();",128);
      }
   }
}

///////////////////////////////////////////////////////////////////////////////
//	Call   : HTML
//	menuName : Menu 的名稱
//	See Also : DoMenuPopUp()
function DoMenuPopDown(menuName)
{
   if (document.readyState=="complete") // 08-20-2002 加上此檢查
   {
	   if (!IsLoadedGlb || !AreCreatedGlb) return;
      if (MenuTimerGlb!=null)
      {
         clearTimeout(MenuTimerGlb);
         MenuTimerGlb=null;
      }
	   whichEl=eval(menuName);
	   whichEl.isOn=false;
	   if (!ClickKillGlb) 
      {
         whichEl.hideTop();
      }
   }
}
function openShim(menu,menuItem)
{
    if (menu==null) return;
    var shim = getShim(menu);
    if (shim==null) shim = createMenuShim(menu,getShimId(menu));
    
    //Change menu zIndex so shim can work with it
    menu.style.zIndex = 100;
    
    var width = (menu.offsetWidth == 0 ? menuItem.renderedWidth : menu.offsetWidth);
    var height;
    
    if (menu.offsetHeight == 0)
    {
        var menus = getMenuItemCount(menu);
        height = menuItem.renderedHeight * menus;
    }
    else
    {
        var height = menu.offsetHeight;
    }
    
    shim.style.width = width;
    shim.style.height = height;
    shim.style.top = menu.style.top;
    shim.style.left = menu.style.left;
    shim.style.zIndex = menu.style.zIndex - 1;
    shim.style.position = "absolute";
    shim.style.display = "block";
}

//Closes the shim associated with the menu
function closeShim(menu)
{
    if (menu==null) return;
    var shim = getShim(menu);
    if (shim!=null) shim.style.display = "none";
}

//Creates a new shim for the menu
function createMenuShim(menu)
{
    if (menu==null) return null;

    var shim = document.createElement("<iframe scrolling='no' frameborder='0'"+
                                      "style='position:absolute; top:0px;"+
                                      "left:0px; display:none'></iframe>"); 
    shim.name = getShimId(menu);
    shim.id = getShimId(menu);
    //Unremark this line if you need your menus to be transparent for some reason
    //shim.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)";

    if (menu.offsetParent==null || menu.offsetParent.id=="") 
    {
        window.document.body.appendChild(shim);
    }
    else 
    {
        menu.offsetParent.appendChild(shim); 
    }

    return shim;
}

//Creates an id for the shim based on the menu id
function getShimId(menu)
{
    if (menu.id==null) return "__shim";
    return "__shim"+menu.id;
}

//Returns the shim for a specific menu
function getShim(menu)
{
    return document.getElementById(getShimId(menu));
}

function getMenuItemCount(menu)
{
    var count = 0;
    var child = menu.firstChild;

    while (child)
    {
        if (child.nodeName=="DIV") count = count + 1;
        child = child.nextSibling;
    }
    return count;    
}
