wlinks = [];
selected = -1;

menuMouseOver = function (id, h)
{
	var menu_el = document.getElementById('menu_' + id + '_' + h);
	if (menu_el != null)
	{
		menu_el.style.backgroundPosition = '0px -' + h + 'px';
	}	
}

menuMouseOut = function (id, h)
{
	var menu_el = document.getElementById('menu_' + id + '_' + h);
	if (menu_el != null)
	{
		if (id == selected)
			menu_el.style.backgroundPosition = '0px -' + h*2 + 'px';
		else
			menu_el.style.backgroundPosition = '0px 0px';
	}
}

menuMouseClick = function (id)
{
	var menu_el = document.getElementById(id);
	if (menu_el != null)
	{
		resetStyles();
		menu_el.style.backgroundPosition = '0px -' + id.split("_")[2]*2 + 'px';
		selected = id.split("_")[1];
		if (wlinks[id.split("_")[1]] != '') 
		{			
			window.location.href = wlinks[id.split("_")[1]];
		}
	}	
}

resetStyles = function ()
{
	var acc = document.getElementById('accordion');
	if (acc==null)
		return;
	
	var dts = acc.getElementsByTagName('dt');
	if (dts==null)
		return;
	
	var i;
	for (i=0; i<dts.length; i++)
		dts[i].style.backgroundPosition = '0px 0px';
		
	var divs = acc.getElementsByTagName('div');
	if (divs==null)
		return;
	
	for (i=0; i<divs.length; i++)
		divs[i].style.backgroundPosition = '0px 0px';
}
