	var cnt;						/* for doing the loop */
	var objSpanCollection;				/* store a collection of Menu */
	var objLinkCollection;				/* store a collection of Link items */
	var menuHeightCollection = new Array(); 	/* store a collection of Menulist heights */
	var objMenu;					/* the menu is clicked on */
	var isFF;						/* detect the browser */

	function detectBrowser() {
		var browser=navigator.userAgent;
		if (browser.indexOf("Firefox")>0) { return "ff"; }
		if (browser.indexOf("MSIE")>0)    { return "ie"; }
	}

	function InitializeMenu() 
	{
		objSpanCollection = document.getElementsByTagName("SPAN");	/* collection of menus */
		objLinkCollection = document.getElementsByTagName("A");	/* collection of links inside submenu */
		isFF = detectBrowser();

		for (var i = 0; i < objSpanCollection.length; i++)
		{
			var objSpan = objSpanCollection[i];
			/* get a collection of Menus' height */
			menuHeightCollection[i] = objSpan.childNodes[1].clientHeight;
			
			for (var j = 0; j < objLinkCollection.length; j++)
			{
				var objA = objLinkCollection[j];
				objA.onmouseover = ShowDescription;
				objA.onmousemove = ShowDescription;
				objA.onmouseout = HideDescription;
			}
			
			/* assign the click event to every Menuheader */
			if(i==4||i==5||i==7) { objSpan.childNodes[0].onclick = ControlMenu;}
			if(isFF=="ie") { objSpan.childNodes[1].style.display = "none"; }
			else   	   { objSpan.childNodes[1].childNodes[0].style.display = "none"; }
		}
	}
	
	function ShowDescription()
	{	
		if(isFF=="ie") {								/* get the mouse position */
			var x = window.event.clientX + document.body.scrollLeft+ 2;
			var y = window.event.clientY + document.body.scrollTop + 38;
		}
		else {
			var e = arguments[0]||event;
			var x = e.pageX + 3;
			var y = e.pageY + 38;
		}

		this.parentNode.childNodes[2].style.display = "block";
		this.parentNode.childNodes[2].style.left = x - 10;
		this.parentNode.childNodes[2].style.top = y - 230;

	}
	
	function HideDescription()
	{
		this.parentNode.childNodes[2].style.display = "none";
	}
	
	function ControlMenu() 
	{
		cnt = 0;

		objMenu = this.parentNode.childNodes[1];	/* memorize the Menulist has been clicked */
		if (objMenu.style.display == "none") {ShowMenu();}
		else {HideMenu();}
	}
	
	function ShowMenu()
	{
		var objList = objMenu.childNodes[0];	// get the Linkslist of the Menulist
		if (cnt < 10)
		{
			// display the Menulist
			objMenu.style.display = "block";
			// increase the tranparency of the Menulist
			objMenu.filters["alpha"].opacity = objMenu.filters["alpha"].opacity + 10;
//			objMenu.-moz-opacity = objMenu.-moz-opacity + 0.1;
			// loop through the Menu collection to find the position of the clicked Menu
			// to get the actual height of the menu list and then increase the height of the Menulist
			for (var i = 0; i < objSpanCollection.length; i++)
				if (objMenu.parentNode == objSpanCollection[i])
					   objMenu.style.height = objMenu.clientHeight + (menuHeightCollection[i]/10);
					   
			cnt++;
			// do this function again after 30 miliseconds until the actual Menulist's height is returned
			setTimeout("ShowMenu()",30)
		}
		// display the Menulist if the it's actual height is returned
		if (cnt >= 10)
		{
		  	for (var i = 0; i < objSpanCollection.length; i++)
				if (objMenu.parentNode == objSpanCollection[i])
					objMenu.style.height = menuHeightCollection[i];
			objList.style.display = "block"; 
		}
	}
	
	function HideMenu()
	{	
		var objList = objMenu.childNodes[0];	// get the Linkslist of the Menulist

		if (cnt < 10)
		{
			objMenu.filters["alpha"].opacity = objMenu.filters["alpha"].opacity - 10;
			for (var i = 0; i < objSpanCollection.length; i++)
				if (objMenu.parentNode == objSpanCollection[i])
				    if (objMenu.clientHeight > menuHeightCollection[i]/10)
					objMenu.style.height = objMenu.clientHeight - (menuHeightCollection[i]/10);
			objList.style.display = "none";
			cnt++;
			setTimeout("HideMenu()",30)
		}
		if (cnt >= 10)
		{
		    objMenu.style.height = 0;
			objMenu.style.display = "none";
		}
	}