var ToolBar_Supported = false;

// *************************************************************
//  CLIENT_SIDE SNIFFER CODE
// *************************************************************
// convert all characters to lowercase to simplify testing 
var agt = navigator.userAgent.toLowerCase(); 

// *** BROWSER VERSION *** 
// Note: On IE5, these return 4, so use is_ie5up to detect IE5. 
var is_major = parseInt(navigator.appVersion); 
var is_minor = parseFloat(navigator.appVersion); 

// *** BROWSER TYPE *** 
var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) 
			&& (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) 
			&& (agt.indexOf('webtv')==-1));
var is_nav4up = (is_nav && (is_major >= 4));  
var is_nav5up = (is_nav && (is_major >= 5));

var is_opera = (agt.indexOf('opera') != -1);

var is_opera_major = agt.indexOf('opera');
is_opera_major = parseInt(agt.substring(is_opera_major + 6, is_opera_major + 7));

var is_opera6 = (is_opera_major == 6);
var is_opera6up = (is_opera_major >= 6);
var is_opera7 = (is_opera_major == 7);
var is_opera7up = (is_opera_major >= 7);

var is_ie   = ((agt.indexOf("msie") != -1) && (agt.indexOf('spoofer') == -1) 
			&& (agt.indexOf('opera') == -1) && (agt.indexOf('webtv') == -1));

var is_ie3  = (is_ie && (is_major < 4));
var is_ie4  = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
var is_ie4up  = (is_ie  && (is_major >= 4));
var is_ie5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5")!=-1) );
var is_ie5up  = (is_ie  && !is_ie3 && !is_ie4);
var is_ie6  = (is_ie && (is_major == 4) && (agt.indexOf("msie 6")!=-1) );
var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5);

// *** PLATFORM ***
var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
var is_mac   = (agt.indexOf("mac")!=-1);
var is_sun   = (agt.indexOf("sunos")!=-1);
var is_irix  = (agt.indexOf("irix") !=-1);	// SGI
var is_hpux  = (agt.indexOf("hp-ux")!=-1);
var is_aix   = (agt.indexOf("aix") !=-1);	  // IBM
var is_linux = (agt.indexOf("inux")!=-1);
var is_sco   = (agt.indexOf("sco")!=-1) || (agt.indexOf("unix_sv")!=-1);
var is_unixware = (agt.indexOf("unix_system_v")!=-1); 
var is_mpras	= (agt.indexOf("ncr")!=-1); 
var is_reliant  = (agt.indexOf("reliantunix")!=-1);
var is_dec   = ((agt.indexOf("dec")!=-1) || (agt.indexOf("osf1")!=-1) || 
	   (agt.indexOf("dec_alpha")!=-1) || (agt.indexOf("alphaserver")!=-1) || 
	   (agt.indexOf("ultrix")!=-1) || (agt.indexOf("alphastation")!=-1)); 
var is_sinix = (agt.indexOf("sinix")!=-1);
var is_freebsd = (agt.indexOf("freebsd")!=-1);
var is_bsd = (agt.indexOf("bsd")!=-1);
var is_unix  = ((agt.indexOf("x11")!=-1) || is_sun || is_irix || is_hpux || 
			 is_sco ||is_unixware || is_mpras || is_reliant || 
			 is_dec || is_sinix || is_aix || is_linux || is_bsd || is_freebsd);

//The toolbar is only supported in IE4+, Opera 6+, Mozilla 5+
if (is_ie4up || is_opera6up || is_nav5up)
	ToolBar_Supported = true;   

//Settings used by the game scripts (and therefore even when the toolbar is not shown)
var imagePath;

if (ToolBar_Supported)
{
	var newLineChar = String.fromCharCode(10);
	var char34 = String.fromCharCode(34);
	var CurMenu = "";
	
	var sMenu = 0;
	var sSubMenu = 0;
	var sSubMenuItem = 0;
	
	var aMainMenu = new Array(30);
	var aSubMenu = new Array(30);
	
	var MainMenu;
	var MainMenuContain;
	var SubMenu;
	
	var FadeIn;
	var FadeOut;
	var opacIn;
	var opacOut;
	var FadeInID;
	var FadeOutID;
	
	//moused sub menu item and styles
	var MenuItem;	
	var backImage, color, backColor, padding, border;
		
	var IsMenuDropDown = true;
	var HTMLStr;
	var TBLStr;
	var x = 0;
	var y = 0;
	var x2 = 0;
	var y2 = 0;
	var x3 = 0;
	var ToolbarMinWidth;
	
	var ToolbarBGColor;
	var ToolbarLoaded = false;
	var aTBColor = new Array(5);
	var aTBImage = new Array(9);
	var aImages;
	var MaxMenu = 30;
	var TotalMenu = 0;
	
	//kludge to make IE4 comply to DOM2
	if (is_ie4)
	{
		document.getElementById = document.all;
	}

	setMenuColor("#FFB709", "#FFD673", "#000000", "#DC0000", "#EEB436");
	
	setImagePath("http://www.getskinned.org/forums/toolbar/images/");
}

function drawToolbar()
{
	
	if (ToolBar_Supported) 
	{
		//Load the images
		loadImages();
		
		HTMLStr += "</DIV>";
		
		//Hide the toolbar for down-level browsers if there is one
		// kludge due to Opera 6 and Netscape 6
		document.write("<STYLE>.TBDownLevel{display:none;visibility:hidden}</STYLE>");
		
		/*var TBDownLevel = document.getElementById("TBDownLevel")
		if (TBDownLevel != null)  //We reference this through document.all so that if it does not exist we don't get an error (just null)
		{
			TBDownLevel.style.visibility = "hidden";
			TBDownLevel.style.display = "none";
		}*/
		
		//Debug output
		//document.write("<textarea rows=100 cols=250>" + HTMLStr + "</textarea>");
		
		document.write(HTMLStr);
		ToolbarLoaded = true;

		//Delay 2 milliseconds to allow the newly written elements to be processed
		window.setTimeout("registerEvents()", 2);
		
	}
}

function registerEvents()
{
		//Register the main menu event handlers
		for (i = 0; i < 30; i++) 
			if (aMainMenu[i] != null)
			{
				document.getElementById(aMainMenu[i]).onmouseover = doMenu;
				document.getElementById(aMainMenu[i]).onmouseout = hideMenu;
			}
		
		//Register the sub menu event handlers
		for (i = 0; i < 30; i++)
		{
			if (aSubMenu[i] != null)
			{
				document.getElementById(aSubMenu[i]).onmouseout = hideMenu;
			}
		}
		
}

function setMenuColor(bgColor, overColor, fontColor, mouseoverColor, mouseoverBorderColor)
{
	if (bgColor   != "")      aTBColor[0] = bgColor;
	if (overColor   != "")    aTBColor[4] = overColor;
	if (fontColor != "")      aTBColor[1] = fontColor;
	if (mouseoverColor != "") aTBColor[2] = mouseoverColor;
	if (mouseoverBorderColor != "") aTBColor[3] = mouseoverBorderColor;
}

function setImagePath(path)
{
	imagePath = path;
	
	//Initialize global variables
	aTBImage[0] = path + "normback.gif";   // normal
	aTBImage[1] = path + "overback.gif";   // highlight
	//aTBImage[2] = path + "menuend.gif";    // end of menu curve
	aTBImage[3] = path + "subtr.gif";      // top right sub menu curve
	aTBImage[4] = path + "subbl.gif";      // bottom left sub menu curve
	aTBImage[5] = path + "subbr.gif";      // bottom right sub menu curve
	aTBImage[6] = path + "subt.gif";       // bottom right sub menu curve
	aTBImage[7] = path + "divide.gif";     // menu divider
	aTBImage[8] = path + "spacer.gif";     // spacer
	
}

function loadImages()
{   
	//Preload the images
	aImages = new imagePreload( aTBImage[0], aTBImage[1], aTBImage[3], aTBImage[4], aTBImage[5], aTBImage[6], aTBImage[7], aTBImage[8]);
}

function imagePreload() {
	this.length = imagePreload.arguments.length;

	for (var i = 0; i < this.length; i++) {
		this[i] = new Image();
		this[i].src = imagePreload.arguments[i];
	}
}


function addMenu(MenuIDStr, MenuDisplayStr, MenuHelpStr, MenuURLStr, TargetStr, Right)
{

	var tempStr, DivideStr, tagStr, tagStrRight;
	
	//Replacement text
	tagStr = "<!--MENU_TITLES-->";
	tagStrRight = "<!--MENU_TITLES_RIGHT-->";
		
	//Divider
	DivideStr = "<TD STYLE='background-color:" + aTBColor[0] + ";background-repeat:repeat-y;background-image:url(" + aTBImage[7] + ");' NOWRAP>" +
		"<IMG SRC='" + aTBImage[8] + "' alt='' width='2' height='2' border='0'></TD>";
		
	//Table construct HTML (if  first menu added)
	if (sMenu <= 0) 
	{
		// Build toolbar template
		HTMLStr = "<DIV ID='idMenuPane' STYLE='position:relative;border-top:#FFD673 1px solid;border-bottom:#E79C00 1px solid;" +
			"LINE-HEIGHT: 1.5em;color:" + aTBColor[1] + ";background-color:" + aTBColor[0] + ";width:100%;" +
			"background-image:url(" + aTBImage[0] + ");background-repeat:repeat-x;" +
			"' NOWRAP><!--MENU_TITLES--></DIV>" +
			"<DIV WIDTH='100%'>";
		
		//Containing table
		TBLStr = "<TABLE border='0' cellpadding='0' cellspacing='0' width='100%'><TR STYLE='height:17;vertical-align:middle;'><TD align='left'>" + tagStr + "</TD><TD align='right'>" + tagStrRight + "</TD></TR></TABLE>";
		
		//Menu Items Tables
		tempStr = "<TABLE border='0' cellpadding='0' cellspacing='0'><TR STYLE='height:17;vertical-align:middle;'><TD><!--MENU_TITLES--></TD></TR></TABLE>";
		TBLStr = TBLStr.replace(tagStr, tempStr);
		tempStr = tempStr.replace(tagStr, tagStrRight);
		TBLStr = TBLStr.replace(tagStrRight, tempStr);
		
		HTMLStr = HTMLStr.replace(tagStr, TBLStr);
	}

	if (Right == true)
		tagStr = tagStrRight;
		
	//Target (_top if we didn't recieve one)
	if (addMenu.arguments.length > 4)
		TargetStr = addMenu.arguments[4];
	else
		TargetStr = "_top";

	if (MenuHelpStr == "") MenuHelpStr = MenuDisplayStr;
	
	MenuStr = newLineChar;
	
	if (Right==true)
		MenuStr += DivideStr;
	
	MenuStr += "<TD STYLE='color:" + aTBColor[1] + ";background-repeat:repeat-x;background-image:url(" + aTBImage[0] + ");' ID='M_" + MenuIDStr + "' NOWRAP>" +
			   "<A ID='" + MenuIDStr + "' STYLE='text-decoration:none;cursor:hand;color:" + aTBColor[1] + ";padding-right:4px;";
	
	if (sMenu<=0)
		MenuStr += "padding-left:8px";	//Line up first menu
	else
		MenuStr += "padding-left:4px";
		
	MenuStr += ";'" +
		" TARGET='" + TargetStr + "'" +
		" TITLE='" + MenuHelpStr + "'" +
		" HREF='" + MenuURLStr + "'>" + MenuDisplayStr + "</a></TD>";
	
	if (Right!=true)
		MenuStr += DivideStr;
	
	MenuStr += tagStr;
	
	HTMLStr = HTMLStr.replace(tagStr, MenuStr);
	
	//Add the manu to the array and increment the count
	aMainMenu[sMenu] = MenuIDStr;
	sMenu ++;
}

function addSubMenu(MenuIDStr, SubMenuStr, SubMenuURLStr, TargetStr)
{
	cColBack = aTBColor[0];
	cColText = aTBColor[1];
	cColOverText = aTBColor[2];
	cImgSubTR = aTBImage[3];
	cImgSubBL = aTBImage[4];
	cImgSubBR = aTBImage[5];
	
	cStyle  = "background-color:" + cColBack + ";color:" + cColText + ";LINE-HEIGHT: 1.5em;";
	if (addSubMenu.arguments.length > 4)
		TargetStr = addMenu.arguments[4];
	else
		TargetStr = "_top";
		
	//var MenuPos = MenuIDStr.toUpperCase().indexOf("MENU");
	//if (MenuPos == -1) { MenuPos = MenuIDStr.length; }
	//InstrumentStr = MenuIDStr.substring(0 , MenuPos) + "|" + SubMenuStr;;
	URLStr		= SubMenuURLStr;

	var LookUpTag  = "<!--S_" + MenuIDStr + "-->";
	var sPos = HTMLStr.indexOf(LookUpTag);
	if (sPos <= 0)
	{
		//Reset items count
		sSubMenuItem = 0;
		
		HTMLStr += newLineChar + newLineChar +
				"<SPAN ID='S_" + MenuIDStr + "'" +
				" STYLE='display:block;visibility:hidden;position:absolute;width:160;padding-top:0;z-index:9;";
				
		//For IE 4 add the filter
		if (is_ie4)
			HTMLStr += "filter:blendTrans(duration=0.25)blendTrans(duration=0.25);";
			
		//For IE 5.5 and above use the DirectX version
		if ((is_ie5 && (is_minor >= 5)) || is_ie6up)
		{
			//HTMLStr += "filter:progid:DXImageTransform.Microsoft.Fade(duration=0.3);";
			HTMLStr += "filter:progid:DXImageTransform.Microsoft.GradientWipe(duration=0.25,GradientSize=0.2,wipestyle=1,motion=forward)"; 
			HTMLStr += "progid:DXImageTransform.Microsoft.Fade(duration=0.4);"; 
		}
		
		HTMLStr += "'><TABLE STYLE='width:100%' border='0' cellpadding='0' cellspacing='0' width='100%'>" +
				   "<TR><TD colspan='3' style='" + cStyle + "padding-top:1px;padding-left:1px;padding-right:1px;background-image:url(" + aTBImage[6] + ");background-repeat:repeat-x;'>";
	}
	
	var SubMenuItemIDStr = "S_" + MenuIDStr + "_" + sSubMenuItem;
	
	TempStr = newLineChar + "<A ID='" + SubMenuItemIDStr + "'" +
				"   STYLE='text-decoration:none;cursor:hand;display:block;background-repeat:repeat-x;width:100%;padding:1px;color:" + cColText + "'" +
				"   HREF='" + URLStr + "' TARGET='" + TargetStr + "'" +
				" onmouseout="  + char34 + "mouseMenu('out' ,'" + SubMenuItemIDStr + "');" + char34 + 
				" onmouseover=" + char34 + "mouseMenu('over','" + SubMenuItemIDStr + "');" + char34 + ">" +
				"&nbsp;" + SubMenuStr + "</A>";
	
	TempStr += LookUpTag;
	
	if (sPos <= 0) {
		HTMLStr += TempStr + "</TD>" +
			"<TD rowspan='2' valign='top' align='left' height='4' width='4'><IMG SRC='" + cImgSubTR + "' alt='' width='4' height='4' border='0'></TD>" +
			"</TR><TR>" +
			"<TD align='left' width='3'><IMG SRC='" + cImgSubBL + "' alt='' width='3' height='3' border='0'></TD><TD width='1000' style='" + cStyle + "'><IMG SRC='" + cImgSubBR + "' alt='' width='1' height='1' border='0'></TD><TD align='right' width='3'><IMG SRC='" + cImgSubBR + "' alt='' width='3' height='3' border='0'></TD>" +
			"</TR></TABLE></SPAN>";
			
			//Add the menu to the array and increment the count
			aSubMenu[sSubMenu] = "S_" + MenuIDStr;
			sSubMenu++;
	
	} else {
		HTMLStr = HTMLStr.replace(LookUpTag, TempStr);  
	}
	
	//Increment the items count
	sSubMenuItem++;
	
}

function addSubMenuLine(MenuIDStr)
{   
	var LookUpTag = "<!--" + MenuIDStr + "-->";
	var sPos = HTMLStr.indexOf(LookUpTag);
	if (sPos > 0)
	{
		cColor  = aTBColor[1];
		TempStr = newLineChar + "<HR STYLE='color:" + cColor + ";width:98%;' SIZE=1>" + LookUpTag;
		HTMLStr = HTMLStr.replace(LookUpTag, TempStr);
	}
}

function mouseMenu(action, ID) 
{

	MenuItem = document.getElementById(ID);
	
	if (action == "over")
	{
		backImage = "url(" + aTBImage[1] + ")";
		padding = "0px";
		border = aTBColor[3] + " 1px solid";
		color = aTBColor[2];
		backColor = aTBColor[4];
	}
	else
	{
		backImage = "url(none)";
		padding = "1px";
		border = "none";
		color = aTBColor[1];
		backColor = aTBColor[0];
	}
	
	if (agt.indexOf("netscape6") != -1)	//Netscape 6 - Delay 2 milliseconds to allow style color change to take place first
	{
		window.setTimeout("MenuItem.style.backgroundImage = backImage;" +
			"MenuItem.style.backgroundColor = backColor;" +
			"MenuItem.style.padding = padding;" +
			"MenuItem.style.border = border;" +
			"MenuItem.style.color = color;", 2);
	}
	else
	{
		MenuItem.style.backgroundImage = backImage;
		MenuItem.style.backgroundColor = backColor;
		MenuItem.style.padding = padding;
		MenuItem.style.border = border;
		MenuItem.style.color = color;
	}
	
}

function doMenu(e) 
{
	//kludge to make IE comply to DOM2
	if (is_ie)
	{
		e = event;
		e.currentTarget = event.srcElement;
	}
	
	var MenuPane = document.getElementById("idMenuPane");
	MainMenu = e.currentTarget;
	MainMenuContain = document.getElementById("M_" + e.currentTarget.id);  //Netscape 6 - Don't use offsetParent
	var NewSubMenu = document.getElementById("S_" + e.currentTarget.id);
	
	//Set Color/Background Image
	if (agt.indexOf("netscape6") != -1)	//Netscape 6 - Delay 2 milliseconds to allow style color change to take place first
		window.setTimeout("MainMenu.style.color = aTBColor[2];", 2);
	else
		MainMenu.style.color = aTBColor[2];
	MainMenuContain.style.backgroundImage = "url(" + aTBImage[1] + ")";
	MainMenuContain.style.backgroundColor = aTBColor[4];
	
	//No sub menu to show or the sub menu to be shown already is
	if (NewSubMenu == null || NewSubMenu == SubMenu) 
	{
		if (is_ie) window.event.cancelBubble = true;
		return false;
	}
	
	if (is_ie) window.event.cancelBubble = true;
	if (SubMenu != null)
		SubMenu.style.visibility= "hidden";
	
	SubMenu = NewSubMenu;

	// Set dropdown menu display position (+15 for margin, +2 for start divider)
	x  = MainMenuContain.offsetLeft + 15 + 1;
	y  = (MenuPane.offsetTop + MenuPane.offsetHeight);
	
	if (is_ie4)
		y += MenuPane.offsetParent.offsetTop; 
	
	if (is_opera6)
		y += MenuPane.offsetParent.offsetParent.offsetParent.offsetTop + MenuPane.offsetParent.offsetParent.offsetTop;
	
	// Get main menu width
	x2 = x + MainMenu.offsetWidth;
	// Get dropdown menu width
	x3 = x + 160;
	/*for (i = 0; i < TotalMenu; i++)
		if (arrMenuInfo[i].IDStr == MenuIDStr)
		{
			x3 = x+ arrMenuInfo[i].unit;
			break;
		}*/
	
	SubMenu.style.top  = y;
	SubMenu.style.left = x;
	
	//Show sub-menu
	if (is_ie4up)
	{
		SubMenu.filters[0].Apply();
	}
	else if (is_nav5up && !is_opera)
	{
		FadeIn = SubMenu;
		
		//if we're currently fading out this menu cancel it
		if (FadeOut == FadeIn)
			window.clearInterval(FadeOutID);
			
		opacIn = 0;
		SubMenu.style.MozOpacity = 0;
		FadeInID = window.setInterval("mozFadeIn();", 15)
	}
	SubMenu.style.visibility = "visible";
	if (is_ie4up) SubMenu.filters[0].Play();
	
	// delay 2 millsecond to allow the value of SubMenu.offsetHeight be set
	window.setTimeout("showMenu()", 2);
	return true;
}

function mozFadeIn()
{	
	if (opacIn < 0.9)
	{
		opacIn += 0.05;
		FadeIn.style.MozOpacity = opacIn;
	}
	else
	{
		window.clearInterval(FadeInID);
		FadeIn = null;
	}
}

function mozFadeOut()
{
	if (opacOut > 0)
	{
		opacOut -= 0.05;
		FadeOut.style.MozOpacity = opacOut;
	}
	else
	{
		window.clearInterval(FadeOutID);
		FadeOut.style.visibility= "hidden";
		FadeOut = null;
	}
}

function showMenu() 
{
	if (SubMenu != null) 
	{ 
		if (IsMenuDropDown == false)
		{
			y = (y - SubMenu.offsetHeight - idMenuPane.offsetHeight);
			if (y < 0) y = 0;
			SubMenu.style.top = y;
		}
		// Get dropdown menu height
		y2 = y + SubMenu.offsetHeight;

		//ToolbarMenu.style.clip = "rect(auto auto auto auto)";
		hideElement("SELECT");
		hideElement("OBJECT");
		
		if (is_opera || (agt.indexOf("netscape6") != -1))
		{
			hideElement("IFRAME");
			if (is_opera6)
				hideElement("INPUT");
		}
			
	}
}

function hideMenu(e)
{

	if (is_ie)
	{
		e = event;
	}
	
	//Set Color
	if (MainMenu!=null)
	{
		if (agt.indexOf("netscape6") != -1)	//Netscape 6 - Delay 2 milliseconds to allow style color change to take place first
			window.setTimeout("MainMenu.style.color = aTBColor[1];", 2);
		else
			MainMenu.style.color = aTBColor[1];
	}
	
	if (SubMenu != null && SubMenu != null) 
	{
		// Don't hide the menu if the mouse move between the menu and submenus
		cY = e.clientY;
		cX = e.clientX;
		
		if (document.body.scrollTop != null)
			cY += document.body.scrollTop;
		
		if ( (cX >= (x+5) && 
			 ((IsMenuDropDown == true && cY > (y+10) && cX <= (x3-8)) ||
			  ((IsMenuDropDown == false || (IsMenuDropDown == true && cY < (y+10))) && cX <= x2))) &&
			 ((IsMenuDropDown == true  && cY > (y-10) && cY < y2) ||
			  (IsMenuDropDown == false && cY >= y && cY <= (y2+10)) )
			)
		{
			if (is_ie) window.event.cancelBubble = true;
			return; 
		}
		
		//ToolbarMenu.style.display = "none";
		
		if (is_ie4up)
		{
			SubMenu.filters[1].Apply();
		}
		else if (is_nav5up && !is_opera)
		{
			//Complete any current fade-outs
			if (FadeOut != null)
			{
				window.clearInterval(FadeOutID);
				FadeOut.style.visibility = "hidden";
			}

			FadeOut = SubMenu;
			
			//If we're currently fading in this menu cancel it
			if (FadeIn == FadeOut)
				window.clearInterval(FadeInID);
			
			opacOut = parseFloat(FadeOut.style.MozOpacity);
			FadeOutID = window.setInterval("mozFadeOut();", 25)
		}
		if (!is_nav5up) SubMenu.style.visibility = "hidden";
		if (is_ie4up) SubMenu.filters[1].Play()
		
		SubMenu = null;
		//window.event.cancelBubble = true;

		showElement("SELECT");
		showElement("OBJECT");

		if (is_opera || (agt.indexOf("netscape6") != -1))
		{
			showElement("IFRAME");
			if (is_opera6)
				showElement("INPUT");
		}
		
	}
	
	//Set Background Image
	if (MainMenuContain != null) {
		MainMenuContain.style.backgroundImage = "url(" + aTBImage[0] + ")";
		MainMenuContain.style.backgroundColor = aTBColor[0];
	}
}


function hideElement(elmID)
{
	for (i = 0; i < document.getElementsByTagName(elmID).length; i++)
	{
		obj = document.getElementsByTagName(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
		objTop = objTop - y;

		if (x > (objLeft + obj.offsetWidth) || objLeft > (x + SubMenu.offsetWidth))
			;
		else if (objTop > SubMenu.offsetHeight)
			;
		else
			obj.style.visibility = "hidden";
	}
}

function showElement(elmID)
{
	for (i = 0; i < document.getElementsByTagName(elmID).length; i++)
	{
		obj = document.getElementsByTagName(elmID)[i];
		if (! obj || ! obj.offsetParent)
			continue;
		obj.style.visibility = "visible";
	}
}
