function initSiteNavMenu()
{
	var menu = document.getElementById('site_navmenu');
	
	if (menu)
	{
		for (i = 0; i < menu.childNodes.length; i++)
		{
			if (menu.childNodes[i].tagName == 'A')
			{
				if (menu.childNodes[i].childNodes.length > 0 &&
					menu.childNodes[i].childNodes[0].tagName == 'IMG')
				{
					menu.childNodes[i].onmouseover = toggleNavImage;
					menu.childNodes[i].onmouseout  = toggleNavImage;
				}
			}
		}
	}
}

function toggleNavImage()
{
	suffix = '-over';
	
	toks = this.childNodes[0].src.split('.');
	if (toks.length >= 2)
	{
		if (true)
		{
			name_part = toks[toks.length - 2]
			
			if (name_part.substr(name_part.length - suffix.length) == suffix)
			{
				toks[toks.length - 2] = name_part.substr(0, name_part.length - suffix.length);
			}
			else
			{
				toks[toks.length - 2] += suffix;
			}
			
			this.childNodes[0].src = toks.join('.');
		}
	}
}

function addOnLoad(func)
{
	var oldonload = window.onload;
	
	if (typeof window.onload != 'function')
	{
		window.onload = func;
	}
	else
	{
		window.onload = function()
		{
			if (oldonload)
			{
				oldonload();
			}
			
			func();
		}
	}
}



addOnLoad(initSiteNavMenu);
