function On(imgName) {
	if (document.images) {
		imgOn = "/arda/images/" + imgName.name + "_on.gif";
		document.images[imgName.name].src = imgOn;
		window.status=imgName.name;
	}
}

function Off(imgName) {
	if (document.images) {
		imgOff = "/arda/images/" + imgName.name + "_off.gif";
		document.images[imgName.name].src = imgOff;
	}
}


	imageUp = new Image();
	imageUp.src = "/arda/images/up.gif";
	imageDown = new Image();
	imageDown.src = "/arda/images/down.gif";
	
	var cnt;										/* for doing the loop */
	var objSpanCollection;							/* store a collecion of Menu */
	var menuHeightCollection = new Array(); 		/* store a collection of Menulists' height */
	var objMenu;									/* the menu is clicked on */
	
	function InitializeMenu(){
		/* get a collection of menus */
		objSpanCollection = document.body.all.MainMenu.getElementsByTagName("SPAN");
		for (var i = 0; i < objSpanCollection.length; i++){
			var objSpan = objSpanCollection(i);
			/* get a collection of Menus' height */
			menuHeightCollection[i] = objSpan.childNodes(1).clientHeight;
			
			/* get a collection of links inside a submenu */
			var objLinkCollection = document.body.all.MainMenu.getElementsByTagName("A");
			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 */
			objSpan.childNodes(0).onclick = ControlMenu;
		}
		
		/* to collapse a submenu at startup change the index number of the
		objSpanCollection() to collapse the submenu you want 
		objSpanCollection(0).childNodes(1).style.display = "none";
		objSpanCollection(0).childNodes(1).childNodes(0).style.display = "none";
		*/
	}
	
	function ShowDescription(){	
		x = event.clientX + document.body.scrollLeft+15; /* get the mouse left position */
		y = event.clientY + document.body.scrollTop-75; /* get the mouse top position  */
		this.parentNode.childNodes(2).style.display = "block";
		this.parentNode.childNodes(2).style.left = x;
		this.parentNode.childNodes(2).style.top = y;
	}
	
	function HideDescription(){
		this.parentNode.childNodes(2).style.display = "none";
	}
	
	function ControlMenu(){
		cnt = 1;
		objMenu = this.parentNode.childNodes(1);	/* memorize the Menulist has been clicked */
		
		/* Get the arrow that belongs to the clicked menu */
		/* starting with <div> then <table> then <tbody> then <tr> then <td> and the last one is */
		/* what we need: <img> */
		var objArrow = this.childNodes(0).childNodes(0).childNodes(0).childNodes(1).childNodes(0);
		
		if (objMenu.style.display == "none"){
			objArrow.src = imageDown.src;  /* change to the Down Arrow */
			ShowMenu();
		}else{
			objArrow.src = imageUp.src;  /* change to the Up Arrow */
			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;
			// 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";
		}
	}