var t;

function initNav()
{
	showSelected();
	setMainLink();
	setSelectedSubElement();
}

function setMainLink()
{
	var oCurLink = document.getElementById( "mainNav_" + selectedNav );
	if ( oCurLink )
	{
		oCurLink.className = "mainNavLinkCurrent";
	}
}

function showSubNav( x )
{
	clearTimeout(t);
	hideShowing();
	showingNav = x;
	var oShow = document.getElementById( "qwertSub_" + x );
	if ( oShow )
	{
		oShow.className = "subNav_show";
	}
}

function resetSubMenu()
{
	t = setTimeout( hideSubNav, 2000 );
}

function resetHide()
{
	clearTimeout(t);
}

function hideSubNav()
{
	hideShowing();
	showSelected();
}

function hideShowing()
{
	var oHide = document.getElementById( "qwertSub_" + showingNav );
	if ( oHide )
	{
		oHide.className = "subNav_hide";
	}
}

function showSelected()
{
	var oSelected = document.getElementById( "qwertSub_" + selectedNav );
	if ( oSelected )
	{
		oSelected.className = "subNav_show";
		showingNav = selectedNav;
	}
}

function setSelectedSubElement()
{
	var oSelected = document.getElementById( "qwertSubItem_" + selectedNav + "_" + selectedSubNav );
	if ( oSelected )
	{
		oSelected.className = "subNavLinkCurrent";
	}

	var oImg = document.getElementById( "subNavRight" );
	if ( oImg )
	{
		oImg.src = "images/subnav/subNav_" + selectedNav + "_" + selectedSubNav + ".jpg";
	}	
}
