/* ---------------------------------------
 *	function called when onmouseover on left nav is fired.
 * 	sets the global variable of currently rolled
 *	calls function to actually do the change
 */
function rollNavOn( i )
{
	gNavOver = i;
	changeNavColor( i, gColorOver)
}

/* ---------------------------------------
 *	function called when onmouseout on left nav is fired.
 * 	sets the global variable of currently rolled to null
 *	calls function to actually do the change
 */
function rollNavOff()
{
	changeNavColor( gNavOver, "")
	gNavOver = null;
}

/* ---------------------------------------
 *	function called by onmouseover and onmouseout functions
 * 	checks if browser can handle it.
 *	changes the background color of a couple different cells
 *  to an appropriate color ( set in the leftnav.asp file of
 *  a particular extra net )
 */
function changeNavColor( iNav, sColor)
{
	if ( document.getElementById && iNav != null )
	{
		// sets color of cell to left of the text.
		var eTempCell = document.getElementById("nav" + iNav )
		if ( eTempCell != null )
		{
			eTempCell.style.backgroundColor = sColor;
		}
		// sets color of cell with text.
		var eTempCell = document.getElementById("navText" + iNav )
		if ( eTempCell != null )
		{
			eTempCell.style.backgroundColor = sColor;
		}
	}
}


function changeTrColor( objRow )
{
	if ( objRow != null )
	{
		if ( typeof objRow.style != "undefined" )
		{
			if ( typeof objRow.style.backgroundColor != "undefined" )
			{
				if ( gColorOver.length == 7 )
				{
					objRow.style.backgroundColor = gColorOver;
				}
				trColorRevert();
				gNavOver = objRow;
				underlineRow( objRow );
			}
		}
	}
}

function trColorRevert()
{
	if (gNavOver != null)
	{
		if ( typeof gNavOver.style != "undefined" )
		{
			if ( typeof gNavOver.style.backgroundColor != "undefined" )
			{
				ununderlineRow( gNavOver );
				gNavOver.style.backgroundColor = ""
				gNavOver = null;
			}
		}
	}
}

function ununderlineRow( objRow )
{
	setUnderline( objRow, "none" )
}

function underlineRow( objRow )
{
	setUnderline( objRow, "2px solid red" )
}

function setUnderline( objRow, strUnderline )
{
	if ( objRow != null && typeof objRow.children != "undefined" )
	{
		var id = objRow.id.substring( objRow.id.indexOf("lvl")+3 )
		var objImg = document.getElementsByName("img" + id)
		if (objImg.length > 0)
		{
			objRow.style.borderBottom = strUnderline;
			objImg[0].style.border = strUnderline;			
		}
	}
}



function  fireLink( objRow )
{
	if ( typeof objRow.children != "undefined" && objRow.children.length > 0 )
	{
		for ( child in objRow.children )
		{
			if ( typeof objRow.children[child].tagName != "undefined" &&  objRow.children[child].tagName == "A" && objRow.children[child].href.indexOf("#") == -1 )
			{
				if (!isSubLevelClicked)
				{
					location.href = objRow.children[child].href;
					break;
				}
			}
		}
	}
	isSubLevelClicked = false;
}

function sublevel( strLvlName )
{
	isSubLevelClicked = true;
	var isOpen = false;
	if ( document.getElementById && strDivName != "" )
	{
		var strDivName = "sub" + strLvlName
		var objDiv = document.getElementById( strDivName );
		if ( objDiv != null )
		{
			if ( objDiv.style.display == "none" || objDiv.style.display == "" )
			{
				objDiv.style.display = "block";
				isOpen = true;
			}
			else
			{
				objDiv.style.display = "none";
			}
		}	
		var strImgName = "img" + strLvlName
		var objImages = document.getElementsByName( strImgName );
		if (objImages != null && objImages.length > 0 )
		{
			if (isOpen)
			{
				objImages[0].src = imgMinus.src;
			}
			else
			{
				objImages[0].src = imgPlus.src;
			}
		}
	}
	return false;
}

isSubLevelClicked = false;
