ns4 = (document.layers)? true:false;
ie4 = (document.all)? true:false;
var hideflag = 0;

var bDebug = false;

var gMenuCount = 0;
var gMenuItemCount = 0;

var gProto;

// __BEGIN__CODE_MOVED_TO_0001_DEV
// certain L&F properties of a menu are standard across all menus and menu items regardless
// of which major section of the web site the menu is in whereas, certain other properties are
// dependent on the major section of the web site the menu is in, those that are standard have
// been moved here, flexibility is reduced however, amount of code is reduced too
var fontSize = 12;
var fontWeight = "plain";
var fontFamily = "MS Sans Serif";
var fontColor = "navy";
var fontColorHilite = "navy";
var menuBorder = 1;
var menuItemBorder = 0;
var childMenuIcon = "spacer.gif";
var childMenuIconHilite = "spacer.gif";
//var childMenuIcon = "/NR/BangkokBank/images/spacer.gif";
//var childMenuIconHilite = "/NR/BangkokBank/images/spacer.gif";
var itemPropsConst = 'visibility:hide;font-Family:' + fontFamily +';font-Weight:' + fontWeight + ';fontSize:' + fontSize + ';';
// __END__CODE_MOVED_TO_0001_DEV

function show(id) {
	if (ns4) document.layers[id].visibility = "show"
}

function hide(id) {
	if (ns4) document.layers[id].visibility = "hide";
}

function Menu(label) {
	this.version = "990702 [Menu; menu.js]";
	this.type = "Menu";
	this.done = false;
	this.arrayIndex = gMenuCount++;
	this.menuItemCountBegin = gMenuItemCount;
	// __CODE_REMOVED_DEV: moved to __CODE_MOVED_TO_0001_DEV
	this.bgColor = "#ffffff";
	//this.menuItemBgColor = "#ffcb99";
	//this.menuLiteBgColor = "#ffcb99";
	this.menuBorderBgColor = "#ff0000";
	this.menuHiliteBgColor = "#ffffff";
	this.menuContainerBgColor = "#ffffff";	
	//this.menuTopImage = "/NR/BangkokBank/images/navbranchtop_PersonalBanking.gif";
	//this.menuBottomImage = "/NR/BangkokBank/images/navbranchbottom_PersonalBanking.gif";
	//this.menuTopImage = "navbranchtop_PersonalBanking.gif";
	//this.menuBottomImage = "navbranchbottom_PersonalBanking.gif";
	this.items = new Array();
	this.actions = new Array();
	this.colors = new Array();
	this.mouseovers = new Array();
	this.mouseouts = new Array();
	this.childMenus = new Array();
	this.heights = new Array();
	this.isMenu = new Array();

	this.addMenuItem = addMenuItem;
	this.writeMenus = writeMenus;
	this.showMenu = showMenu;
	this.onMenuItemOver = onMenuItemOver;
	this.onMenuItemOut = onMenuItemOut;
	this.onMenuItemDown = onMenuItemDown;
	this.onMenuItemAction = onMenuItemAction;
	this.hideMenu = hideMenu;
	this.hideChildMenu = hideChildMenu;
	this.mouseTracker = mouseTracker;
	this.setMouseTracker = setMouseTracker;
	// create MENUS array once and store all MENU objects there, 
	if (!window.menus) window.menus = new Array();
	this.label = label || "menuLabel" + window.menus.length;

	// __DEV:
	//window.menus[this.label] = this;
	// store this MENU in the MENUS array    
	window.menus[window.menus.length] = this;

	// create ACTIVEMENUS array once
	if (!window.activeMenus) window.activeMenus = new Array();

	// create MENUCONTAINERS array once
	if (!window.menuContainers) window.menuContainers = new Array();

	// __DEV: may not required since drag not required    
	if (!window.mDrag) {
		window.mDrag    = new Object();
		mDrag.startMenuDrag = startMenuDrag;
		mDrag.doMenuDrag    = doMenuDrag;
		this.setMouseTracker();
	}
	if (window.MenuAPI) MenuAPI(this);
}

function addMenuItem(label, action, isMenu, color, mouseover, mouseout) {
	if (typeof(label) == "object")
		this.isMenu[this.isMenu.length] = true;
	else
		this.isMenu[this.isMenu.length] = false;
		
		//this.isMenu[this.isMenu.length] = isMenu;
		
    this.items[this.items.length] = label;
    this.actions[this.actions.length] = action;
    this.colors[this.colors.length] = color;
    this.mouseovers[this.mouseovers.length] = mouseover;
    this.mouseouts[this.mouseouts.length] = mouseout;
    this.heights[this.mouseouts.length] = 0;
    gMenuItemCount++;
	
}

function writeMenus(container) {
	// create container for menus if not provided and not already exists
	if (!container) {
		if (!document.all["menuContainer"]) {
			document.writeln('<SPAN ID="menuContainer"></SPAN>');
		}
		container = document.all["menuContainer"];
	}
	
	container.isContainer = "menuContainer" + menuContainers.length;
	menuContainers[menuContainers.length] = container;
	
	// store each and every MENU in the container's MENUS array
	// the order in which the menus are written by the server is the
	// same as the order in which they are stored in the MENUS array
	container.menus = new Array();
	for (var i=0; i<window.menus.length; i++) {
		container.menus[i] = window.menus[i];
	}
	
	// deallocate the window's MENUS array
	window.menus.length = 0;
	
	/*
	// __DEV: some error handling code testing
	try {
		alert(window.menus[i].label);
	}
	catch(e){
		alert(e.number & 0xFFFF);
		alert(e.description);
	}
	*/
	
	var countMenus = 0;
	var countItems = 0;
	var top = 0;
	var content = '';
	var proto;
	
	var menu;
	var lNumMenus = container.menus.length;
	
	// __DEV
	if (bDebug) {
		var d = new Date();
		txtValue0.value = d.valueOf();
	}
	
	// loop over each and every menu
	for (var i=0; i<lNumMenus; i++, countMenus++) {
		menu = container.menus[i];
		if (!gProto) {
			if (!menu.protoTypeStyles) gProto = this;
		}
		
		proto = menu.prototypeStyles || this.prototypeStyles || menu;
		
		// __FIXED__DEV: fixed problem with large amount of white space at bottom of page
		//content += ''+ '<DIV ID="menuLayer'+ countMenus +'" STYLE="position:absolute;left:10;top:'+ (i * 100) +';visibility:hidden;">\n'
		content += '<iframe name="frm_menuLayer'+ menu.arrayIndex +'" id="frm_menuLayer'+ menu.arrayIndex +'" scrolling="no" frameborder="0" style="display:none; position: absolute;z-index:98;"></iframe>'		
		content += '<DIV ID="menuLayer'+ menu.arrayIndex +'" STYLE="position:absolute;left:10;top:0;visibility:hidden;z-index:98;">'
//		content += '<iframe name="frm_menuLayer'+ menu.arrayIndex +'" id="frm_menuLayer'+ menu.arrayIndex +'" scrolling="no" frameborder="0" style="display:none; position: absolute;z-index:97;"></iframe>'		
		

		if (navigator.appName == "Microsoft Internet Explorer") {
			content += '<DIV STYLE="position:absolute;left:1;top:-4;visibility:hide;"></DIV>\n'
		}
		
		// try to remove as many DIV tags as possible if not necessary
		/*
		content += ''+
			'  <DIV ID="menuLite'+ menu.arrayIndex +'" STYLE="position:absolute;left:'+ menuBorder +';top:'+ menuBorder +';visibility:hide;" onMouseOut="hideMenu(this);">\n'+
			'   <DIV ID="menuFg'+ menu.arrayIndex +'" STYLE="position:absolute;word-wrap:break-word;left:1;top:1;visibility:hide;">\n'+
			'';
		*/
		content += ''+
			'  <DIV ID="menuLite'+ menu.arrayIndex +'" STYLE="position:absolute;left:'+ menuBorder +';top:'+ menuBorder +';visibility:hide;" onMouseOut="hideMenu(this);">\n'+
			'';
		
		var x=i;
		var totalHeight=0;
		var itemTextWidth=0;
		
		var itemProps, item, bChildMenu, defaultHeight, defaultIndent;
		var dTag, dText;
		// loop over each menu item in the given menu
		for (var i=0; i<menu.items.length; i++) {
			item = menu.items[i];
			defaultHeight = 20;
			defaultIndent = 2;
			bChildMenu = false;
			
			// __CODE_REMOVED_DEV: moved to __CODE_MOVED_TO_0003_DEV
			if (navigator.appName == "Microsoft Internet Explorer") {
				if (item.length < 35) {
					defaultHeight = 20;
				}
				else if (item.length < 60) {
					defaultHeight = 28;
				} 
				else if (item.length < 80) {
					defaultHeight = 40;
				}
				else if (item.length >= 100) {
					defaultHeight = 53;
				}
			}
			
			if (item.label) {
				item = item.label;
				bChildMenu = true;
			} else if (item.indexOf(".gif") != -1 && item.indexOf("<IMG") == -1) {
				item = '<IMG SRC="' + item + '" NAME="menuItem'+ countItems +'Img">';
				defaultIndent = 0;
				if (document.layers) {
					defaultHeight = null;
				}
			}
			
			menu.heights[i] = defaultHeight;
			totalHeight += menu.heights[i];
			if (i == 0) {
				proto.menuItemHeight = 0;
			}
			
			proto.menuItemWidth = 180;
			itemTextWidth = proto.menuItemWidth - defaultIndent; 
			proto.menuItemIndent = proto.menuItemIndent || defaultIndent;
		
			// __DEV
			//var itemProps = 'visibility:hide;font-Family:' + fontFamily +';font-Weight:' + fontWeight + ';fontSize:' + fontSize + ';';
			if (document.all) 
				itemProps = itemPropsConst + 'font-size:' + fontSize + ';" onMouseOver="onMenuItemOver(' + countMenus + ',' + i + ',null,this);" onMouseOut="onMenuItemOut(null,this);" onClick="onMenuItemAction(null,this);';

			dTag  = '<DIV  ID="menuItem'+ countItems +'" STYLE="cursor:hand;position:absolute;left:0;top:'+ (i * proto.menuItemHeight) +';'+ itemProps +'">';
			
			// __DEV: trying to fix problem with word wrapping
			dText  = '<DIV ID="menuItemText'+ countItems +'" STYLE="border-width:180;';
			
			//__Kasem Add tail menu 
			if (bChildMenu) {
				dText += ( 'background-image:url(/NR/BangkokBankThai/Images/SubMenu.gif);');
			} else {
				dText += ( '');
			}
			
			dText += 'position:absolute;left:' + proto.menuItemIndent + ';top:0;color:'+ fontColor +';width:'+(itemTextWidth-3)+';height:'+menu.heights[i]+';">'+ item+'</DIV>\n<DIV ID="menuItemHilite'+ countItems +'" STYLE="position:absolute;left:' + proto.menuItemIndent + ';top:0;color:'+ fontColorHilite +';visibility:hidden;width:'+(itemTextWidth-3)+';height:'+menu.heights[i]+';">'+ item +'</DIV>';
			//dText  = '<DIV ID="menuItemText'+ countItems +'" STYLE="position:absolute;left:' + proto.menuItemIndent + ';top:0;color:'+ fontColor +';width:'+(itemTextWidth-3)+';">'+ item +'</DIV>\n<DIV ID="menuItemHilite'+ countItems +'" STYLE="position:absolute;left:' + proto.menuItemIndent + ';top:0;color:'+ fontColorHilite +';visibility:hidden;width:'+(itemTextWidth-3)+';">'+ item +'</DIV>';

			if (item == "separator") {
				content += ( dTag + '<DIV ID="menuSeparator'+ countItems +'" STYLE="position:absolute;left:1;top:2;"></DIV>\n<DIV ID="menuSeparatorLite'+ countItems +'" STYLE="position:absolute;left:1;top:2;"></DIV>\n</DIV>');
			} else if (bChildMenu) {
				content += ( dTag + dText + '<DIV ID="childMenu'+ countItems +'" STYLE="position:absolute;left:0;top:3;'+ itemProps +'"></DIV>\n</DIV>');
			} else {
				content += ( dTag + dText + '</DIV>');
			}

			countItems++;
		}
	
		content += '   <DIV ID="focusItem'+ menu.arrayIndex +'" STYLE="position:absolute;left:0;top:0;visibility:hide;" onClick="onMenuItemAction(null,this);">&nbsp;</DIV>\n';
		if (navigator.appName == "Microsoft Internet Explorer") {
			// __DEV
			//content += '  </DIV>\n</DIV>\n<DIV STYLE="position:relative;left:1;top:' + (totalHeight+2) + ';visibility:hide;"><IMG src="'+ proto.menuBottomImage +'" width="152" height="6"></DIV></DIV>\n';
			//content += '  </DIV>\n</DIV>\n<DIV STYLE="position:relative;left:1;top:' + (totalHeight+2) + ';visibility:hide;"><IMG src="'+ proto.menuBottomImage +'" width="152" height="6"></DIV></DIV>\n';
			content += '  </DIV>\n<DIV STYLE="position:absolute;left:1;top:' + (totalHeight+2) + ';visibility:hide;"></DIV></DIV>\n';
		}
		else {
			content += '  </DIV>\n</DIV>\n<DIV STYLE="position:absolute;left:1;top:' + (totalHeight+4) + ';visibility:hidden;"></DIV></DIV>\n';
		} 
		
		i=x;
	}

//	var window.newframe = createElement("<input value='sdfgdfgsd'>");

	//document.body.appendChild(newframe);
//	newframe.document.body.innerHTML = content;
	

//--end loop	
	if (bDebug) {
		d = new Date();
		txtValue1.value = d.valueOf();
	}
	
	if (!container) return;
	
	if (container.innerHTML) {
		container.innerHTML=content;
	}	else {
		//container.document.open("text/html");
		container.document.writeln(content);
		//container.document.close();
	}
//	var Dpop = popmenu.document.body;


	// __DEV
	if (bDebug) {
		txtTest.value = content;
	}
//	alert(content);
	// total execution time for Personal Banking is 3 squares in Task Manager
	// until this statement, the execution time is about 1 square
	//Dpop.innerHTML = content;
	window.wroteMenu = true;
	return;

	proto = null;
	if (container.document.layers) {
		// __CODE_REMOVED_DEV: __NETSCAPE_NOT_SUPPORTED
	} else if (container.document.all) {
		var menuCount = 0;
		var menu, l, childItem, sep;	// __DEV
		
		// __DEV
		var lCountItems = 0;
		lCountItems += lNumMenus;
		var oMenuX;
		var oMenuLayerX
		
		// loop over each and every menu
		for (var x=0; x<lNumMenus; x++) {
			// __DEV
			//var menu = container.document.all("menuLayer" + x);
			//menu = container.document.all("menuLayer" + x);
			
			oMenuX = container.menus[x];
			oMenuLayerX = container.menus[x].menuLayer;
			
			oMenuX.menuLayer = menu;
			oMenuX.menuLayer.Menu = oMenuX;
			oMenuX.menuLayer.Menu.container = menu;
			proto = oMenuX.prototypeStyles || this.prototypeStyles || oMenuX;
			proto.menuItemWidth = proto.menuItemWidth || 150;
			menu.style.backgroundColor = proto.menuBorderBgColor;
			
			// loop over each menu item in the given menu
			for (var i=0; i<oMenuX.items.length; i++, ++lCountItems) {
				// __DEV
				//var l = container.document.all["menuItem" + menuCount];
				//l = container.document.all["menuItem" + menuCount];
				
				l.Menu = oMenuX;
				proto = oMenuX.prototypeStyles || this.prototypeStyles || oMenuX;
				
				l.style.pixelWidth = proto.menuItemWidth;
				l.style.pixelHeight = oMenuX.heights[i];
				//l.style.pixelHeight = proto.menuItemHeight;
				if (i>0) l.style.pixelTop = container.document.all["menuItem" + (menuCount -1)].style.pixelTop + container.document.all["menuItem" + (menuCount -1)].style.pixelHeight + menuItemBorder;
				l.style.fontSize = fontSize;
				l.style.backgroundColor = proto.menuItemBgColor;
				l.style.visibility = "inherit";
				l.saveColor = proto.menuItemBgColor;
				l.menuHiliteBgColor = proto.menuHiliteBgColor;
				l.action = oMenuX.actions[i];
				l.hilite = container.document.all["menuItemHilite" + menuCount];
				l.focusItem = container.document.all["focusItem" + x];
				l.focusItem.style.pixelTop = -30;
				l.mouseover = l.Menu.mouseovers[x];
				l.mouseout = l.Menu.mouseouts[x];
				
				// __DEV
				//var childItem = container.document.all["childMenu" + menuCount];
				childItem = container.document.all["childMenu" + menuCount];
				//alert("childMenu" + menuCount);
				
				if (childItem) {
					l.childMenu = oMenuX.items[i].menuLayer;
					//alert(l.childMenu.id);
					childItem.style.pixelLeft = l.style.pixelWidth -11;
					childItem.style.pixelTop = (l.style.pixelHeight /2) -4;
					childItem.style.pixelWidth = 30 || 7;
					childItem.style.clip = "rect(0 7 7 3)";
					l.Menu.childMenus[l.Menu.childMenus.length] = l.childMenu;
				}
				
				menuCount++;
			}

			proto.menuHeight = (l.style.pixelTop + l.style.pixelHeight);
			
			var lite = container.document.all["menuLite" + x];
			lite.style.pixelHeight = proto.menuHeight +1;
			lite.style.pixelWidth = proto.menuItemWidth + 1;
			lite.style.backgroundColor = proto.menuLiteBgColor;
			
			oMenuX.menuLayer.style.pixelWidth  = proto.menuWidth || proto.menuItemWidth + (menuBorder * 2) +1;
			oMenuX.menuLayer.style.pixelHeight = proto.menuHeight + (menuBorder * 2) +1;
			if (menu.Menu.enableTracker) {
				menu.Menu.disableHide = true;
				setMenuTracker(menu.Menu);
			}
		}
		//alert(menuCount);
		
		container.document.all("menuContainer").style.backgroundColor = container.menus[0].menuContainerBgColor;
		container.document.saveBgColor = container.document.bgColor;
	}
	window.wroteMenu = true;
	
	if (bDebug) {
		d = new Date();
		txtValue2.value = d.valueOf();
		alert (lCountItems);
	}

}

function writeMenuLayerEx(menu) {
	var container = document.all["menuContainer"];
	var menuLayer = container.document.all["menuLayer" + menu.arrayIndex];
	menu.menuLayer = menuLayer;
	menu.menuLayer.Menu = menu;
	menu.menuLayer.Menu.container = menuLayer;
}


function writeMenuEx(menu) {
	//return;
	var container = document.all["menuContainer"];
	var proto = null;
	var menuCount = menu.menuItemCountBegin;
	var l, childItem, sep;
	var lNumMenus;
	
	var menuLayer = container.document.all["menuLayer" + menu.arrayIndex];
	menu.menuLayer = menuLayer;
	menu.menuLayer.Menu = menu;
	menu.menuLayer.Menu.container = menuLayer;
	//proto = menu.prototypeStyles || this.prototypeStyles || menu;
	proto = menu.prototypeStyles || gProto || menu;
	proto.menuItemWidth = proto.menuItemWidth || 150;
	menuLayer.style.backgroundColor = proto.menuBorderBgColor;
	//alert(proto.menuBorderBgColor);
	//alert(proto.menuItemBgColor);
	
	//alert(menuLayer.id + ': ' + menu.items.length);
	
	// create menus of all child menus for this menu
	for (var i=0; i<menu.items.length; i++) {
		if (menu.isMenu[i]) {
			//writeMenuEx(menu.items[i]);
			writeMenuLayerEx(menu.items[i]);
		}
	}
	
	// loop over each menu item in the given menu
	for (var i=0; i<menu.items.length; i++) {
		l = container.document.all["menuItem" + menuCount];
		l.Menu = menu;
		proto = menu.prototypeStyles || this.prototypeStyles || menu;
		proto = menu.prototypeStyles || gProto || menu;
		l.style.pixelWidth = proto.menuItemWidth;
		l.style.pixelHeight = menu.heights[i];
		//l.style.pixelHeight = proto.menuItemHeight;
		if (i>0) l.style.pixelTop = container.document.all["menuItem" + (menuCount -1)].style.pixelTop + container.document.all["menuItem" + (menuCount -1)].style.pixelHeight + menuItemBorder;
		l.style.fontSize = fontSize;
		l.style.backgroundColor = proto.menuItemBgColor;
		//l.style.backgroundColor = "white";
		l.style.visibility = "inherit";
		l.saveColor = proto.menuItemBgColor;
		l.menuHiliteBgColor = proto.menuHiliteBgColor;
		l.action = menu.actions[i];
		l.hilite = container.document.all["menuItemHilite" + menuCount];
		l.focusItem = container.document.all["focusItem" + menu.arrayIndex];
		l.focusItem.style.pixelTop = -30;
		l.mouseover = l.Menu.mouseovers[menu.arrayIndex];
		l.mouseout = l.Menu.mouseouts[menu.arrayIndex];

		childItem = container.document.all["childMenu" + menuCount];
		//alert("childMenu" + menuCount);
		if (childItem) {
			l.childMenu = menu.items[i].menuLayer;
			//alert(l.childMenu.id);
			childItem.style.pixelLeft = l.style.pixelWidth -11;
			childItem.style.pixelTop = (l.style.pixelHeight /2) -4;
			childItem.style.pixelWidth = 30 || 7;
			childItem.style.clip = "rect(0 7 7 3)";
			l.Menu.childMenus[l.Menu.childMenus.length] = l.childMenu;
		}
		menuCount++;
	}
	
	proto.menuHeight = (l.style.pixelTop + l.style.pixelHeight);
	
	var lite = container.document.all["menuLite" + menu.arrayIndex];
	lite.style.pixelHeight = proto.menuHeight +1;
	lite.style.pixelWidth = proto.menuItemWidth + 1;
	lite.style.backgroundColor = proto.menuLiteBgColor;
	
	menu.menuLayer.style.pixelWidth  = proto.menuWidth || proto.menuItemWidth + (menuBorder * 2) + 1;
	menu.menuLayer.style.pixelHeight = proto.menuHeight + (menuBorder * 2) +1;
	if (menuLayer.Menu.enableTracker) {
		menuLayer.Menu.disableHide = true;
		setMenuTracker(menuLayer.Menu);
	}
	
}


function onMenuItemOver(parentMenuIndex, childMenuIndex, e, l, a) {
	var container = document.all["menuContainer"];
	var parentMenu = container.menus[parentMenuIndex];
	var thisMenu = parentMenu.items[childMenuIndex];
	if (parentMenu.isMenu[childMenuIndex]) {
		if (!thisMenu.done) {
			thisMenu.done = true;
			writeMenuEx(thisMenu); 
		}
	}

	
	l = l || this;
	a = a || window.ActiveMenuItem;
	
	if (document.layers) {
		// __CODE_REMOVED_DEV: __NETSCAPE_NOT_SUPPORTED
	}
	else {
		if (l.style && l.Menu) {
			document.onmousedown=l.Menu.onMenuItemDown;
			if (a) {
				a.style.backgroundColor = a.saveColor;
				if (a.hilite) a.hilite.style.visibility = "hidden";
			} else {
				a = new Object();
			}
			if (l.mouseover && l.id != a.id) {
				if (l.mouseover.length > 4) {
					var ext = l.mouseover.substring(l.mouseover.length-4);
					if (ext == ".gif" || ext == ".jpg") {
						l.document.images[l.id + "Img"].src = l.mouseover;
					} else {
						eval("" + l.mouseover);
					}
				}
			}
			if (l.isSeparator) return;
			l.style.backgroundColor = l.menuHiliteBgColor;
			if (l.hilite) {
				l.style.backgroundColor = l.menuHiliteBgColor;
				l.hilite.style.visibility = "inherit";
			}
			l.focusItem.style.pixelTop = l.style.pixelTop;
			l.focusItem.style.zIndex = l.zIndex +10;
			l.zIndex = 9;
			l.Menu.hideChildMenu(l);

		}
	}
		
  window.ActiveMenuItem = l;
}


function onMenuItemOut(e, l, a) {
	l = l || this;
	a = a || window.ActiveMenuItem;
	if (l.id.indexOf("focusItem")) {
		if (a && l.top) {
            l.top = -30;
			if (a.mouseout && a.id != l.id) {
				if (a.mouseout.length > 4) {
					var ext = a.mouseout.substring(a.mouseout.length-4);
					if (ext == ".gif" || ext == ".jpg") {
						a.document.layers[1].document.images[0].src = a.mouseout;
					} else {
						eval("" + a.mouseout);
					}
				}
			}
        } else if (a && l.style) {
            document.onmousedown=null;
            window.event.cancelBubble=true;
	        if (l.mouseout) {
				if (l.mouseout.length > 4) {
					var ext = l.mouseout.substring(l.mouseout.length-4);
					if (ext == ".gif" || ext == ".jpg") {
						l.document.images[l.id + "Img"].src = l.mouseout;
					} else {
						eval("" + l.mouseout);
					}
				}
			}
		}
	}

}


function onMenuItemAction(e, l) {
	l = window.ActiveMenuItem;
	if (!l) return;
	if (!ActiveMenu.Menu.disableHide) hideActiveMenus(ActiveMenu.menuLayer);
	if (l.action) {
		eval("" + l.action);
	}
}

// called when mouse rolls over top level menu items
// eg: window.showMenu(window.Menu110,161,this.offsetTop+162);
function showMenu(menu, x, y, child) {
	// configure menu

	if (!menu.done) {
		menu.done = true;
		writeMenuEx(menu); 
	}
	
	if (!window.wroteMenu) return;
	if ((ns4) && (document.layers['blockDiv'])) 
		hideflag = 1
	if ((ns4) && (hideflag == 1))
		hide('blockDiv');
	
	if (document.layers) {
		// __CODE_REMOVED_DEV: __NETSCAPE_NOT_SUPPORTED
		
	} else if (document.all) {
		//var l = menu.menuLayer || menu;
		var l = menu.menuLayer || this;
		hideActiveMenus(l);
		if (typeof(menu) == "string") {
			l = document.all[menu];
			for (var n=0; n < menuContainers.length; n++) {
				l = menuContainers[n].menus[menu];
				for (var i=0; i<menuContainers[n].menus.length; i++) {
					if (menu == menuContainers[n].menus[i].label) l = menuContainers[n].menus[i].menuLayer;
					if (l) break;
				}
			}
		}
		window.ActiveMenu = l;
		l.style.visibility = "inherit";
		if (x != "relative") 
		l.style.pixelLeft = x || (window.pageX + document.body.scrollLeft) || 0;
		if (y != "relative") 
		l.style.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;

	}
//	alert("AABB");
	hide_obj1(l);
}

function hide_obj1(obj){
	var fm = document.getElementsByTagName("SELECT");
	if (fm.length > 0){
		t = 0;
		b = 0;
		r = 0;
		l = 0;
		h = 0;
		w = 0;
		show_obj();
		x2 = obj.getClientRects();
		t = x2(0).top;
		b = x2(0).bottom;
		r = x2(0).right;
		l = x2(0).left;
		h = b - t;
		w = r - l;
		var bg01 = document.all('frm_'+obj.id);
	//	window.status = document.body.scrollTop;
		bg01.style.display =''
		bg01.style.display ='';
		bg01.style.top = t - 6+document.body.scrollTop;
		bg01.style.left = l ;
		bg01.style.height = h +8 ;
		bg01.style.width = w -2;
		bg01.style.zIndex = 0;
		obj.style.zIndex = 99;
/*		document.all.clib1.style.display ='';
		document.all.clib1.style.top = t -2;
		document.all.clib1.style.left = l - 2;
		document.all.clib1.style.height = h ;
		document.all.clib1.style.width = w + 2;
*/
//		window.status = obj.innerText;
	}
}

function hide_obj2(obj){
	var fm = document.getElementsByTagName("SELECT");
	if (fm.length > 0){
		t = 0;
		b = 0;
		r = 0;
		l = 0;
		h = 0;
		w = 0;
		x2 = obj.getClientRects();
		t = x2(0).top;
		b = x2(0).bottom;
		r = x2(0).right;
		l = x2(0).left;
		h = b - t;
		w = r - l;
		var bg01 = document.all('frm_'+obj.id);
		//window.status = obj.id;
		bg01.style.display =''
		bg01.style.top = t - 6+document.body.scrollTop;
		bg01.style.left = l ;
		bg01.style.height = h +8 ;
		bg01.style.width = w -2;
		bg01.style.zIndex = 0;
		obj.style.zIndex = 99;
/*		
		background.style.display ='';
		background.style.top = t -2;
		background.style.left = l - 2;
		background.style.height = h ;
		background.style.width = w + 2;
	*/
//		window.status = obj.innerText;

//		var  i = window.open('','');
//		i.document.body.innerText = obj.innerHTML;
	}
}

function show_obj(){
		var oTop;
		var fm = document.getElementsByTagName("IFRAME");
		for (var n=0; n < fm.length; n++) {
			var substr1 = fm(n).name;
			if (substr1.substr(0,3) == "frm"){
				fm(n).style.display = 'none';
//				fm(n).style.display = '';

			}
		}
}

function show_obj2(obj){
/*		var fm = document.getElementsByTagName("IFRAME");
		for (var n=0; n < fm.length; n++) {
			fm(n).style.display = 'none';
		}
		*/
		var bg01 = document.all('frm_'+obj.id);
		bg01.style.display = 'none';
//		bg01.style.display = '';

}
 
function hideMenu(e) {
	var l = e || window.ActiveMenu;
	var aSpans = document.getElementsByTagName("SELECT");
	if (!l) return true;
	if (l.menuLayer) {
		l = l.menuLayer;
	} else if (this.visibility) {
		l = this;
	}
	if (l.menuLayer) {
		l = l.menuLayer;
	}
	
	var a = window.ActiveMenuItem;
	document.saveMousemove = document.onmousemove;
	document.onmousemove = mouseTracker;
	if (a && document.layers) {
		// __CODE_REMOVED_DEV: __NETSCAPE_NOT_SUPPORTED
	} else if (window.ActiveMenu && document.all) {
		document.onmousedown=null;
		if (a) {
			a.style.backgroundColor = a.saveColor;
			if (a.hilite) a.hilite.style.visibility = "hidden";
		}
		if (document.saveMousemove == mDrag.doMenuDrag) {
			return true;
		}
	}
	if (window.ActiveMenu) {
		if (window.ActiveMenu.Menu) {
			if (window.ActiveMenu.Menu.disableHide) return true;
			e = window.event || e;
			if (!window.ActiveMenu.Menu.enableHideOnMouseOut && e.type == "mouseout") return true;
		}
	}
	hideActiveMenus(l);
	if ((ns4) && (hideflag == 1))
	return true;
	show_obj();
}


function hideChildMenu(menuLayer) {
	var l = menuLayer || this;
	for (var i=0; i < l.Menu.childMenus.length; i++) {
		if (document.layers) {
			// __CODE_REMOVED_DEV: __NETSCAPE_NOT_SUPPORTED
		} else if (document.all) {
			if (l.Menu.childMenus[i])
				l.Menu.childMenus[i].style.visibility = "hidden";
				
		}
		if (l.Menu.childMenus[i]){
			l.Menu.childMenus[i].Menu.hideChildMenu(l.Menu.childMenus[i]);
			show_obj2(l.Menu.childMenus[i]);
		}
	}
	
	if (l.childMenu) {
		if (document.layers) {
			// __CODE_REMOVED_DEV: __NETSCAPE_NOT_SUPPORTED
		} else if (document.all) {
			l.childMenu.style.zIndex = l.Menu.menuLayer.style.zIndex +1;
			l.childMenu.style.pixelTop = l.style.pixelTop + l.Menu.menuLayer.style.pixelTop;
			if (l.childMenu.style.pixelLeft + l.childMenu.style.pixelWidth > document.width) {
				l.childMenu.style.pixelLeft = l.childMenu.style.pixelWidth + l.Menu.menuLayer.style.pixelTop + 15;
			} else if (l.Menu.childMenuDirection == "left") {
				//l.childMenu.style.pixelLeft = l.parentLayer.left - l.parentLayer.clip.width;
			} else {
				if (navigator.appName == "Microsoft Internet Explorer")
					l.childMenu.style.pixelLeft = l.Menu.menuLayer.style.pixelWidth + l.Menu.menuLayer.style.pixelLeft +1;
				else
					l.childMenu.style.pixelLeft = l.Menu.menuLayer.style.pixelWidth + l.Menu.menuLayer.style.pixelLeft +3;
			}
			l.childMenu.style.visibility = "inherit";
//			clib4.document.body.innerHTML = l.childMenu.innerHTML;
			hide_obj2(l.childMenu);
		}
		if (!l.childMenu.disableHide) 
			window.activeMenus[window.activeMenus.length] = l.childMenu;
	}

}


function hideActiveMenus(l) {
	if (!window.activeMenus) return;
	for (var i=0; i < window.activeMenus.length; i++) {
		if (!activeMenus[i]) return;
		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) {
			activeMenus[i].style.visibility = "hidden";
		}
	}
	document.onmousemove = mouseTracker;
	window.activeMenus.length = 0;

}


function mouseTracker(e) {
	e = e || window.Event || window.event;
	window.pageX = e.pageX || e.clientX;
	window.pageY = e.pageY || e.clientY;
}


function setMouseTracker() {
	if (document.captureEvents) {
		document.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
	}
	document.onmousemove = this.mouseTracker;
	document.onmouseup = this.hideMenu;
}


function setMenuTracker(menu) {
	if (!window.menuTrackers) window.menuTrackers = new Array();
	menuTrackers[menuTrackers.length] = menu;
	window.menuTrackerID = setInterval('menuTracker()',10);
}


function menuTracker() {
  for (var i=0; i < menuTrackers.length; i++) {
		if (!isNaN(menuTrackers[i].xOffset) && document.layers) {
			// __CODE_REMOVED_DEV: __NETSCAPE_NOT_SUPPORTED
		}
		if (!isNaN(menuTrackers[i].yOffset) && document.layers) {
			// __CODE_REMOVED_DEV: __NETSCAPE_NOT_SUPPORTED
		}
		if (!isNaN(menuTrackers[i].xOffset) && document.body) {
			var off = parseInt((menuTrackers[i].xOffset - document.body.scrollLeft) / 10);
			if (isNaN(off)) off = 0;
			if (off < 0) {
				menuTrackers[i].menuLayer.style.pixelLeft += -off;
				menuTrackers[i].xOffset += -off;
			} else if (off > 0) {
				menuTrackers[i].menuLayer.style.pixelLeft += -off;
				menuTrackers[i].xOffset += -off;
			}
		}
		if (!isNaN(menuTrackers[i].yOffset) && document.body) {
			var off = parseInt((menuTrackers[i].yOffset - document.body.scrollTop) / 10);
			if (isNaN(off)) off = 0;
			if (off < 0) {
				menuTrackers[i].menuLayer.style.pixelTop += -off;
				menuTrackers[i].yOffset += -off;
			} else if (off > 0) {
				menuTrackers[i].menuLayer.style.pixelTop += -off;
				menuTrackers[i].yOffset += -off;
			}
		}
  }

}

function onMenuItemDown(e, l) {
	l = l || window.ActiveMenuItem || this;
	if (!l.Menu) {
	} else {
		if (document.layers) {
			// __CODE_REMOVED_DEV: __NETSCAPE_NOT_SUPPORTED
		} else {
			mDrag.dragLayer = l.Menu.container.style;
			mDrag.startMenuDrag(e);
			window.event.cancelBubble=true;
		}
	}
	
}

function startMenuDrag(e) {
	if (document.layers) {
		// __CODE_REMOVED_DEV: __NETSCAPE_NOT_SUPPORTED
	} else {
		var x = window.event.clientX;
		var y = window.event.clientY;
	}
	mDrag.offX = x;
	mDrag.offY = y;
	mDrag.oldX = x;
	mDrag.oldY = y;
	if (!ActiveMenu.Menu.disableDrag) document.onmousemove = mDrag.doMenuDrag;
	return false;
}

function doMenuDrag(e) {
	if (document.layers) {
		// __CODE_REMOVED_DEV: __NETSCAPE_NOT_SUPPORTED
	} else {
		mDrag.dragLayer.pixelLeft = window.event.offsetX;
		mDrag.dragLayer.pixelTop  = window.event.offsetY;
		return false; //for IE
	}
}
