hoverClass = 'selected';
currentClass = '';
window.onload = initMenus;

function initMenus()
{
	initMenu('menu');
	initMenu('submenu');
}

function initMenu(menuId)
{
	var menu,listPoint,listPoints,currentClass,hoverClass;
	try
	{
		menu = document.getElementById(menuId);
		
		listPoints = menu.getElementsByTagName('li');
		
		
		for (var i=0;i<listPoints.length;i++)
		{
			listPoints[i].onmouseover = aMouseOver;
			listPoints[i].onmouseout = aMouseout;
			try
			{
					if (listPoints[i].nextSibling.firstChild.src.indexOf('images/menuEnd.gif') > -1 && listPoints[i].className.indexOf('selected') > -1) 
				  {
						listPoints[i].nextSibling.firstChild.src = 'images/menuEnd_sel.gif';
				  }
			}
			catch (e)
			{
				
			}
		}
	}	
	catch (e) {
		
	}
}

function aMouseOver() 
{
	currentClass = this.className;
	if (currentClass == 'undefined') currentClass = '';
	if (currentClass.indexOf('selected') == -1) {
		this.className = currentClass + ' selected';
	}
	try 
	{
		//alert(this.nextSibling.firstChild.src);
		if (this.nextSibling.firstChild.src.indexOf('images/menuEnd.gif') > -1) 
		{
				this.nextSibling.firstChild.src = 'images/menuEnd_sel.gif';
		}
	}
	catch(e)	
	{
	}
}

function aMouseout() 
{
	this.className = currentClass;
	try 
	{
		//alert(currentClass);
		if (this.nextSibling.firstChild.src.indexOf('images/menuEnd_sel.gif') > -1 && currentClass.indexOf('selected') == -1) this.nextSibling.firstChild.src = 'images/menuEnd.gif';
	}
	catch(e)
	{
		
	}
};
