
		//	Global Constants (begin)
		moHorizontal = "H";
		moVertical = "V";
		//	Global Constants (end)
		
		//	Global Methods (begin)
		function GetBrowserType()
		{
			return (document.all == null) ? 1 : 2;
		}
		
		function BiNavigate(document, target)
		{
			this.BrowserType = GetBrowserType();
			
			switch (this.BrowserType)
			{
				case 1:
					//	Firefox & Mozilla code
					window.location = document;
					break;
				default:
					//	IE Code
					window.navigate(document);
					break;
			}
		}
		
		function GetAbsoluteTopPositionOfElement(oHtmlElement)
		{
			if (oHtmlElement == null)
				return 0;
				
			var returnValue = oHtmlElement.offsetTop;
			
			if (oHtmlElement.offsetParent != null)
				returnValue += GetAbsoluteTopPositionOfElement(oHtmlElement.offsetParent);
			return returnValue;
		}
		
		function GetAbsoluteLeftPositionOfElement(oHtmlElement)
		{
			if (oHtmlElement == null)
				return 0;
				
			var returnValue = oHtmlElement.offsetLeft;
			
			if (oHtmlElement.offsetParent != null)
				returnValue += GetAbsoluteLeftPositionOfElement(oHtmlElement.offsetParent);
			return returnValue;
		}
		
		function String_PadLeft(str, ch, length)
		{
			str = new String(str);
			while (str.length < length)
			{
				str = ch + str;
			}
			
			return str;
		}
		//	Global Methods (end)
		
		//	Class Uid (begin)
		function Uid()
		{
			this.lastuid = 0;
			
			this.New = Uid_New;
		}
		
		function Uid_New()
		{
			return "uidx" + String_PadLeft(this.lastuid++, "0", 4);
		}		
		//	Class Uid (end)
		
		//	Class RevealTransition (begin)
		function RevealTransition(duration, type)
		{
			this.Duration = (duration == null) ? 0.5 : duration;
			this.vType = (type == null) ? -1 : type;
			this.hType = (this.vType == 5) ? 6 : type;
		}
		//	Class RevealTransition (end)
		
		//	Class BiEventObject (begin)
		function BiEventObject(e)
		{
			this.BrowserType = GetBrowserType();
			switch (this.BrowserType)
			{
				case 1:
					//	Firefox & Mozilla code
					this.EventObject = e;
					this.srcElement = e.target;
					this.toElement = e.relatedTarget;
					break;
				default:
					//	IE Code
					this.EventObject = window.event;
					this.srcElement = window.event.srcElement;
					this.toElement = window.event.toElement;
					break;
			}
		}
		//	Class BiEventObject (end)
		
		//	Class BiHtmlElementObject (begin)
		function BiHtmlElementObject(o)
		{
			this.BrowserType = GetBrowserType();
			this.HtmlElement = o;
			
			switch (this.BrowserType)
			{
				case 1:
					//	Firefox & Mozilla code
					this.ParentElement = o.offsetParent;
					break;
				default:
					//	IE Code
					this.ParentElement = o.parentElement;
					break;
			}
		}
		
		function GetBiHtmlElementObjectById(id)
		{
			var object = document.getElementById(id);
				
			return (object != null) ?
				new BiHtmlElementObject(object) : null;
		}
		//	Class BiHtmlElementObject (end)
		
		//	Global Property (begin)
		var uid = new Uid();
		//	Global Property (end)
		
		//	Class Menu (begin)
		function Menu(orientation, transition, items)
		{
			this.Id = uid.New();
			this.Orientation = (orientation == null) ? moVertical : orientation;
			this.Transition = transition;
			this.Items = new Array();
			this.Visible = false;
			this.Parent = null;
			
			if (items != null)
			{
				for(var dx = 0; dx < items.length; dx++)
				{
					items[dx].Parent = this;
					if (items[dx].Submenu != null)
						items[dx].Submenu.Parent = this;
				}
				this.Items = this.Items.concat(items);
			}
			
			this.AddItem = Menu_AddItem;
			this.Hide = Menu_Hide;
			this.HideSubmenus = Menu_HideSubmenus;
			this.Show = Menu_Show;
			this.ShowAt = Menu_ShowAt;
			this.GetItemById = Menu_GetItemById;
			this.GetItemByHtmlElementId = Menu_GetItemByHtmlElementId;
		}
				
		function Menu_AddItem(items)
		{
			for(var dx = 0; dx < items.length; dx++)
			{
				items[dx].Parent = this;
				if (items[dx].Submenu != null)
						items[dx].Submenu.Parent = this;
			}
			this.Items = this.Items.concat(items);
		}
	
		function Menu_Hide()
		{	
			this.HideSubmenus();
			
			var oBiHtmlElementObject = GetBiHtmlElementObjectById(this.Id);
			if ((oBiHtmlElementObject != null) && (oBiHtmlElementObject.ParentElement != null))
			{
			/*
				if (GetBrowserType() == 2)
				{
					var collection = document.getElementsByTagName("SELECT");
					for(var dx = 0; dx < collection.length; dx++)
					{
						collection[dx].style.visibility = "visible";
					}
				}
			*/
				oBiHtmlElementObject.ParentElement.removeChild(oBiHtmlElementObject.HtmlElement);
				this.Visible = false;
			}
		}
		
		function Menu_HideSubmenus()
		{
			if (this.Items != null)
				for(var dx = 0; dx < this.Items.length; dx++)
					this.Items[dx].Unselect();
		}
		
		function Menu_Show(parentElement, x, y)
		{			
			if (this.Visible)
				return;
				
			var oTable = null;
			var oTd = null;
			var oTr = null;			
			
			if (parentElement == null)
				parentElement = document.body;
			
			oTable = document.createElement("TABLE");
			oTable.id = this.Id;
			oTable.className = "Nab" + this.Orientation;
			oTable.style.visibility = "hidden";
			oTable.style.zIndex = 1000;
			oTable.cellPadding = 0;
			oTable.cellSpacing = 0;
			oTable.border = 0;
			
			if ((x != null) && (y != null))
			{
				oTable.style.position = "absolute";
				oTable.style.left = x + "px";
				oTable.style.top = y + "px";
			}
			
			if (this.Orientation == moHorizontal)
				oTr = oTable.insertRow(-1);
							
			for(var dx = 0; dx < this.Items.length; dx++)
			{					
				oTd = (this.Orientation == moHorizontal) ? 
					oTr.insertCell(-1) : oTable.insertRow(-1).insertCell(-1);				
				oTd.id = this.Items[dx].Id;
				
				oTd.className = "Nab" + this.Orientation + "PolStNe";
				oTd.innerHTML = this.Items[dx].Title;
				if (this.Items[dx].Description.length > 0)
					oTd.title = this.Items[dx].Description;
								
				oTd.onclick = Menu_OnMouseClick;
				oTd.onmouseover = Menu_OnMouseOver;
				oTd.onmouseout = Menu_OnMouseOut;
			}
			
			parentElement.appendChild(oTable);
			
			if ((this.Transition != null) && (oTable.filters != null) && (oTable.filters.revealTrans != null))
			{
				oTable.filters.revealTrans.duration = this.Transition.Duration;
				if ((this.Parent != null) && (this.Parent.Orientation == moHorizontal))
					oTable.filters.revealTrans.transition = this.Transition.vType;
				else
					oTable.filters.revealTrans.transition = this.Transition.hType;
			
			/*	
				if (GetBrowserType() == 2)
				{
					var collection = document.getElementsByTagName("SELECT");
					for(var dx = 0; dx < collection.length; dx++)
					{
						collection[dx].style.visibility = "hidden";
					}
				}
			*/
				
				oTable.filters.revealTrans.Apply();
				oTable.style.visibility = "visible";
				oTable.filters.revealTrans.Play();
			}
			else
			{
				oTable.style.visibility = "visible";
			}
			
			this.Visible = true;
		}
		
		function Menu_ShowAt(x, y)
		{
			this.Show(null, x, y);
		}
		
		function Menu_GetItemById(menuItemId, withSubs)
		{	
			if (withSubs == null)
				withSubs = false;
				
			var returnValue = null;
			for(var dx = 0; dx < this.Items.length; dx++)
			{
				if (new String(this.Items[dx].Id) == menuItemId)
					return this.Items[dx];
			}
			
			if (withSubs)
			{
				for(var dx = 0; dx < this.Items.length; dx++)
				{
					if (this.Items[dx].Submenu != null)
					{
						returnValue = this.Items[dx].Submenu.GetItemById(menuItemId, true);
						if (returnValue != null)
							break;
					}	
				}
			}

			return returnValue;
		}
		
		function Menu_GetItemByHtmlElementId(elementId, withSubs)
		{
			if (elementId.length < 8)
				return null;
			else return this.GetItemById(elementId.substr(0, 8), withSubs);
		}
					
		function Menu_OnMouseOver(e)
		{
			var oEvent = new BiEventObject(e);
						
			var oMenuItem = mMenu.GetItemByHtmlElementId(oEvent.srcElement.id, true);
			if (oMenuItem != null)
				oMenuItem.Select();
		}
		
		function Menu_OnMouseOut(e)
		{
			var oEvent = new BiEventObject(e);			
			
			var oFromMenuItem = mMenu.GetItemByHtmlElementId(oEvent.srcElement.id, true);
			if (oFromMenuItem != null)
			{
				if ((e != null) && (oEvent.toElement == null))
					return;
					
				var oToMenuItem = ((oEvent.toElement == null) || (oEvent.toElement.id.length == 0)) ?
					null : mMenu.GetItemByHtmlElementId(oEvent.toElement.id, true);
				if (oToMenuItem == null)
					mMenu.HideSubmenus();
				else
					if ((oFromMenuItem.Submenu == null) ||
						(oFromMenuItem.Submenu.GetItemByHtmlElementId(oEvent.toElement.id, false) == null))
							oFromMenuItem.Unselect();
			}
		}
		
		function Menu_OnMouseClick(e)
		{
			var oEvent = new BiEventObject(e);
			
			var oMenuItem = mMenu.GetItemByHtmlElementId(oEvent.srcElement.id, true);
			if (oMenuItem != null)
				BiNavigate(oMenuItem.Hyperlink, oMenuItem.Target)
		}
		//	Class Menu (end)
		
		//	Class MenuItem (begin)
		function MenuItem(title, description, hyperlink, target, submenu)
		{
			this.Id = uid.New();
			this.Title = (title == null) ? 
				"" : title.replace(new RegExp(" ", "ig"), "&nbsp;").replace(new RegExp("-", "ig"), "&#45;").replace(new RegExp(",", "ig"), "&#44;");
			this.Description = (description == null) ? "" : description;
			this.Hyperlink = (hyperlink == null) ? "" : hyperlink;
			this.Target = (target == null) ? "_self" : target;
			this.Parent = null;
			
			this.Submenu = (submenu != null) ? submenu : null;
			
			this.Select = MenuItem_Select;
			this.Unselect = MenuItem_Unselect;
		}
		
		function MenuItem_Select()
		{
			if (this.Parent != null)
				this.Parent.HideSubmenus();
				
			var oHtmlElement = document.getElementById(this.Id);
			if (oHtmlElement != null) oHtmlElement.className = 
				new String(oHtmlElement.className).replace("StNe", "StAno");
				
			if (this.Submenu != null)
			{
				var x = GetAbsoluteLeftPositionOfElement(oHtmlElement);
				var y = GetAbsoluteTopPositionOfElement(oHtmlElement);
				
				if (this.Parent.Orientation == moVertical)
					x += oHtmlElement.offsetWidth;
				else
					y += oHtmlElement.offsetHeight;
					
				this.Submenu.ShowAt(x, y);
			}
		}
		
		function MenuItem_Unselect()
		{
			if (this.Submenu != null)
				this.Submenu.Hide();
				
			var oHtmlElement = document.getElementById(this.Id);
			
			if (oHtmlElement != null) oHtmlElement.className = 
				new String(oHtmlElement.className).replace("StAno", "StNe");
				
		}		
		//	Class MenuItem (end)
