//<SCRIPT LANGUAGE="JAVASCRIPT">
/********************************************************************************
 NAVIGATION SCRIPT - incDynamicMenus.htm
	created 2/18/04 -scott
	
	SET-UP STEPS:
	1. Edit the Styles
	2. Update the Position Settings if necessary
	3. Set up the Image Pre-Loading if necessary (Not a text based Navigation)
	4. Update the Main Nav and Sub Menu building functions for site settings
		(i.e. funWriteMainMenu and funCreateSubNavs)
	
	copyright 2004 by First MediaWorks [DO NOT USE WITHOUT PERMISSION!]
*********************************************************************************/

// ** Postion Settings **
var gnOffsetHorizontal = -5;
var gnOffsetVertical = 0;
var gbMainNavVertical = false; // Set to false for a top horizontal Main Navigation
var gsSubMenuSide = "right" // Set to left to have the Sub-Navs expand to the left.
var gsTopNavSubAlignment = "left"	// Set to left to have top Nav Sub-menus align
									//	to the left side if the Main nav Items.
var gbMainNavIsText = false; // Set to false to use images with Roll-Overs for main navigation
var gbHideOnMouseOut = true; // Set to false to show Sub-menus until mouse is clicked
var gnMaxNavItemsPerLine = 10; // The maximum number of Main Nav items per line for a Horizontal Nav

window.onresize = funWindowResize;

// ** Image Pre-Loading **
// Must Name Array items the same as the image name part
 //Un-Comment and Edit to use Images for Main Nav
var gAryNavImages = new Array();
gAryNavImages[0] = "onair";
gAryNavImages[1] = "music";
gAryNavImages[2] = "interact";
gAryNavImages[3] = "news";
gAryNavImages[4] = "sports";
gAryNavImages[5] = "events";
gAryNavImages[6] = "community";
gAryNavImages[7] = "marketplace";
gAryNavImages[8] = "aboutus";

for (var i=0; i<gAryNavImages.length; i++) {
	eval('var NavImg1_' + (i+1) + 'On = new Image();');
	eval('NavImg1_' + (i+1) + 'On.src = "/images/menu_' + gAryNavImages[i] + '.gif";');
	eval('var NavImg1_' + (i+1) + 'Off = new Image();');
	eval('NavImg1_' + (i+1) + 'Off.src = "/images/menu_' + gAryNavImages[i] + '.gif";');
}


/*****************************
 CREATING THE MENUS FUNCTIONS
******************************/

// Creates the main Nav
function funWriteMainMenu() {
	// ** FIND NUMBER OF ITEMS PER LINE FOR HORIZONTAL NAV **
	if (!gbMainNavVertical && (aryMenu1.length+1) > gnMaxNavItemsPerLine) {
		var nNumNavItems = aryMenu1.length+1;
		var nNumLines = Math.ceil(nNumNavItems / gnMaxNavItemsPerLine);
		var nNumPerLine = Math.ceil(nNumNavItems / nNumLines);
	}
	
	// ** MAIN NAVIGATION DISPLAY SETTINGS **
	//var sSeparator = '<img src="/images/trans.gif" border="0" height="1" width="1">';
	var sSeparator
	
	// ** BEGIN EDITING HERE FOR MAIN NAVIGATION CUSTOMIZATION **
	document.write('<table id="table1" cellpadding="0" cellspacing="0" border=0 class="navTopMainNavTable"><tr>\r\n');
	if (gbMainNavVertical) document.write('<td>');
	
	for (var i=0; i < aryMenu1.length; i++) {
		
		// Start the Cell/Div
		if (!gbMainNavVertical) document.write('<td id="td1_'+(i+1)+'" valign="middle">');
		document.write('<div id="div1_'+(i+1)+'" class="MainNav" onmouseover="funShowSub(\'1_'+(i+1)+'\');" onmouseout="funDelayHideSub(\'1_'+(i+1)+'\');"');
		if (aryMenu1[i].sURL.toLowerCase() != "na" && aryMenu1[i].sURL != "") {
			if (aryMenu1[i].sURL.indexOf("javascript")==-1) document.write(' onclick="document.location=\''+aryMenu1[i].sURL+'\';" style="cursor:' + ((isIE4) ? 'hand"' : 'pointer"'));
			else document.write(' onclick="'+aryMenu1[i].sURL+';"');
		}
		else document.write(' style="cursor:default;"');
		document.write('>');
		
		if (document.layers) document.write('<layer name="layer1_'+(i+1)+'" class="MainNav">');
		
		// Write HTML of Cell
		if (gbMainNavIsText) document.write(aryMenu1[i].sHTML);
		else document.write('<img name="NavImg1_'+(i+1)+'" id="NavImg1_'+(i+1)+'" src="' + eval('NavImg1_' + (i+1) + 'Off.src') + '" border="0">');

		// End the Cell/Div
		if (document.layers) document.write('</layer>');
		document.write('</div>');
		if (!gbMainNavVertical) document.write('</td>');
		document.write('\r\n');
		
		// Add the Separator if Necessary
		if (sSeparator != null && sSeparator != "" && i < aryMenu1.length-1) {
			if (gbMainNavVertical) document.write('<div class="Separator">' + sSeparator + '</div>\r\n');
			else document.write('<td class="Separator">' + sSeparator + '</td>\r\n');
		}

		// Check for End of Row on Horizontal Nav
		if (nNumNavItems > gnMaxNavItemsPerLine) {
			if ( ((i+1) % nNumPerLine) == 0 ) {
				document.write('</tr>\r\n</table>\r\n<table id="table' + i + '" cellpadding="0" cellspacing="0" class="navTopMainNavTable"><tr>\r\n');
			}
		}
		
	}
	// ** END MAIN NAVIGATION CUSTOMIZATION **
	if (gbMainNavVertical) document.write('</td>');
	document.write('</tr></table>\r\n');
}

// Creates the Sub Menus
function funCreateSubNavs(nMenuNum) {
	// ** SUB MENUS DISPLAY SETTINGS **
	var nWidth = 130; 
	var sWidthType = "exact" // use "max" to kind of fluctuate width based on the data
	var nCharacterWidth = 6.5 // width in pixels of a single text character (bump up for larger fonts)

	//var sSeparator = '<div class="SubSeparator"><img src="/images/trans.gif" border="0" height="1" width="1"></div>';
	var sSeparator

	var objSubMenu, sSubMenuNum, nItemLength, nMenuWidth;
	var objMenuArray = eval("aryMenu" + nMenuNum);
	
	for (var i=0; i<objMenuArray.length; i++) {
		objSubMenu = null;
		if (nMenuNum == "1") { // 1st Level Sub-Nav
			if (window["aryMenu" + nMenuNum + "_" + (i+1)]) { // Sub-Menu exists
				sSubMenuNum = nMenuNum + "_" + (i+1);
				objSubMenu = eval("aryMenu" + sSubMenuNum); 
			}
			nNumLayer = 1;
		}
		else { // Below 1st Level so indexing starts at 2
			if (window["aryMenu" + nMenuNum + "_" + (i+2)]) { // Sub-Menu exists
				sSubMenuNum = nMenuNum + "_" + (i+2);
				objSubMenu = eval("aryMenu" + sSubMenuNum);
			}
			nNumLayer += 1;
		}

		if (objSubMenu) {
			gAryAllMenus[gAryAllMenus.length] = new Array(sSubMenuNum, false); //Sub Level, Active
			
			if (sWidthType == "max") { // Find longest string in the Sub-Menu
				nItemLength = 0;
				for (var j=0; j < objSubMenu.length; j++) {
					if (objSubMenu[j].sHTML.length > nItemLength) nItemLength = objSubMenu[j].sHTML.length;
				}
				if ((nCharacterWidth*nItemLength) > nWidth) nMenuWidth = nWidth;
				else nMenuWidth = (nCharacterWidth*nItemLength);
			}
			else nMenuWidth = nWidth;
			nMenuWidth += 5;

			// Build the SubMenu
			document.writeln('<style TYPE="text/css"><!--');
			document.writeln('#sub'+sSubMenuNum+' {position:absolute; width:'+nMenuWidth+'; z-index:'+nNumLayer+'; visibility:hidden;}');
			document.writeln('//--></style>');
			document.write('<div id="sub'+sSubMenuNum+'" onMouseOver="gbOverMenu=true;" onMouseOut="gbOverMenu=false;funDelayHideSub(\''+sSubMenuNum+'\');"><layer name="sub'+sSubMenuNum+'" onMouseOver="gbOverMenu=true;" onMouseOut="gbOverMenu=false;funDelayHideSub(\''+sSubMenuNum+'\');">\r\n');

			// ** BEGIN EDITING HERE FOR SUB-MENU CUSTOMIZATION **
			document.write('<table id="table'+sSubMenuNum+'" class="SubMenuTable" cellpadding="0" cellspacing="0" width="'+nMenuWidth+'"><tr><td>\r\n');
			for (var j=0; j < objSubMenu.length; j++) {
				document.write('<div id="div'+sSubMenuNum+'_'+(j+2)+'" class="SubMenu" width="'+nMenuWidth+'" onmouseover="funShowSub(\''+sSubMenuNum+'_'+(j+2)+'\');" onmouseout="funDelayHideSub(\''+sSubMenuNum+'_'+(j+2)+'\');"');
				if (objSubMenu[j].sURL.toLowerCase() != "na" && objSubMenu[j].sURL != "") {
					if (objSubMenu[j].sURL.indexOf("javascript")==-1) document.write(' onclick="document.location=\''+objSubMenu[j].sURL+'\';" style="cursor:' + ((isIE4) ? 'hand"' : 'pointer"'));
					else document.write(' onclick="'+objSubMenu[j].sURL+';"');
				}
				else document.write(' style="cursor:default;"');
				document.write('>');
				
				if (document.layers) document.write('<layer name="layer'+sSubMenuNum+'_'+(j+2)+'" width="'+nMenuWidth+'" class="SubMenu">');
				document.write(objSubMenu[j].sHTML);
				if (document.layers) document.write('</layer>');
				document.write('</div>\r\n');
				
				if (sSeparator != null && sSeparator != "" && j < (objSubMenu.length-1)) document.write(sSeparator + '\r\n');
			}
			// ** END SUB-MENU CUSTOMIZATION **
			document.write('</td></tr></table></layer></div>\r\n');
			
			//Build this Menu's Sub-Menus
			funCreateSubNavs(sSubMenuNum);
		}
	}
}


/*****************
 GLOBAL VARIABLES
*****************/

// Menu Settings Variables
var gnTimeDelay = 300; // time submenu will stay visible after rollout
var gAryAllMenus = new Array();

var gbOverMenu = false;
var gbIsLoaded = false;
var nNumLayer, isNN4, isIE4, isDOM, isIE5, isNN6;
if (document.getElementById) {
  isDOM = true;
  isIE4 = false;
  isNN4 = false;
  isIE5 = (document.all) ? true : false;
  isNN6 = (document.all) ? false : true;
}
else if (document.all) {
  isIE4 = true;
  isNN4 = false;
  isDOM = false;
  isIE5 = false;
  isNN6 = false;
}
else if (document.layers) {
  isNN4 = true;
  isIE4 = false;
  isDOM = false;
  isIE5 = false;
  isNN6 = false;
}

// Function to Initiate the Menu
function funCreateNavigation() {
	// Comment out this line if you want to write out the Main Nav manually
	funWriteMainMenu();
	
	funCreateSubNavs("1");
}


/******************************
 SHOW AND HIDE MENUS FUNCTIONS
******************************/

// Show Sub Menu
function funShowSub(sMenuLevel, imgX, imgY) {

  if (gbIsLoaded) {

	var aryCurMenu, objSubMenu;

	// Hide all the non-active subs
	for (var i=0; i < gAryAllMenus.length; i++) {
		if (gAryAllMenus[i][1] && gAryAllMenus[i][0] != sMenuLevel) {
			if (sMenuLevel.indexOf(gAryAllMenus[i][0]+"_") != 0) funHideSub(gAryAllMenus[i][0]);
		}
		else if (gAryAllMenus[i][0] == sMenuLevel) {
			gAryAllMenus[i][1] = true; // Set this Menu to Active
		}
	}

	// Set Global Variable for Over Menu
	gbOverMenu = true;

	// Un-highlight all the other items in this sub
	var sCurMenuLevel = sMenuLevel.substr(0,sMenuLevel.lastIndexOf("_"));
	funUnhighlightMenu(sCurMenuLevel);

	// Highlight the Current Menu
	funHighlightItem(sMenuLevel);

	if (isNN4) {
		if (document["sub" + sMenuLevel]) {
			// Hide the Select Menus
			hideSelectMenus();
			
			objSubMenu = eval("document.sub" + sMenuLevel);
			if (!objSubMenu) setTimeout("funHideSub(" + sMenuLevel + ");", 100);
			else {
				if (imgX != null) objSubMenu.pageX = imgX;
				if (imgY != null) objSubMenu.pageY = imgY;
				objSubMenu.visibility = "visible";
			}
		}
	}
	if (isIE4) {
		if (document.all["sub" + sMenuLevel]) {
			// Hide the Select Menus
			hideSelectMenus();
			
			objSubMenu = eval("document.all.sub" + sMenuLevel); 
			if (!objSubMenu) setTimeout("funHideSub(" + sMenuLevel + ");", 100);
			else {
				if (imgX != null) objSubMenu.style.left = imgX;
				if (imgY != null) objSubMenu.style.top = imgY;
				objSubMenu.style.visibility = "visible";
			}
		}
	}
	if (isDOM) {
		if (document.getElementById("sub" + sMenuLevel)) {
			// Hide the Select Menus
			hideSelectMenus();
			
			objSubMenu = document.getElementById("sub" + sMenuLevel);
			if (!objSubMenu) setTimeout("funHideSub(" + sMenuLevel + ");", 100);
			else {
				if (imgX != null) objSubMenu.style.left = imgX;
				if (imgY != null) objSubMenu.style.top = imgY;
				objSubMenu.style.visibility = "visible";
			}
		}
	}
  }
}

// Hide Sub Menu (and it's parent subs) on a delay to give the mouse a chance to get to the sub-menu
function funDelayHideSub(sMenuLevel) {
	gbOverMenu = false;
	if (gbHideOnMouseOut && (isNN4 || isIE4 || isDOM)) {
		while (sMenuLevel.indexOf("_") > 0) {
			y = setTimeout("funHideSub('" + sMenuLevel + "')",gnTimeDelay);
			sMenuLevel = sMenuLevel.substr(0,sMenuLevel.lastIndexOf("_"));
		}
	}
}

// Hide the Sub menu if the Mouse isn't over it.
function funHideSub(sMenuLevel) {
  if (!gbOverMenu) {
  
	var objSubMenu;

	// Un-highlight the Div
	funUnhighlightItem(sMenuLevel);
	
	for (var i=0; i<gAryAllMenus.length; i++) {
		if (gAryAllMenus[i][0] == sMenuLevel) gAryAllMenus[i][1] = false; // Set to inActive
	}

	if (isNN4) {
		if (document["sub" + sMenuLevel]) {
			objSubMenu = eval("document.sub" + sMenuLevel);
			// Hide the sub Menu
			objSubMenu.visibility = "hidden";
			// Also unhighlight all the items in the menu
			funUnhighlightMenu(sMenuLevel);
			// Make the Select Menus Visisble Again
			showSelectMenus();
		}
	}
	else {
		if (isIE4) if (document.all["sub" + sMenuLevel]) objSubMenu = eval("document.all.sub" + sMenuLevel);
		if (isDOM) if (document.getElementById("sub" + sMenuLevel)) objSubMenu = document.getElementById("sub" + sMenuLevel);
		if (objSubMenu) {
			// Hide the sub Menu
			objSubMenu.style.visibility = "hidden";
			// Also unhighlight all the items in the menu
			funUnhighlightMenu(sMenuLevel);
			// Make the Select Menus Visisble Again
			showSelectMenus();
		}
	}
	
  }
}

//Hide all the visible submenus
function funHideAllSubs() {
	if (!gbOverMenu) {
		// Loop through all the sub-menus
		for (var i=0;i < gAryAllMenus.length; i++) {
			//Hide the Sub-Menu
			if (gAryAllMenus[i][1]) funHideSub(gAryAllMenus[i][0]);
		}
		
		// Make the Select Menus Visisble Again
		showSelectMenus();
	}
}

/*********************************
 HIGHLIGHT AND LOWLIGHT FUNCTIONS
*********************************/

// Highlight the Div
function funHighlightItem(sMenuLevel) {
	var objDiv, objCell, objLayer;
	if (isIE4) {
		objDiv = document.all["div" + sMenuLevel];
		if (document.all["td" + sMenuLevel]) objCell = document.all["td" + sMenuLevel];
	}
	else if (isDOM) {
		objDiv = document.getElementById("div" + sMenuLevel);
		if (document.getElementById("td" + sMenuLevel)) objCell = document.getElementById("td" + sMenuLevel);
	}
	if (document.layers) objLayer = document.layers["layer" + sMenuLevel];

	if (objDiv) {
		if (sMenuLevel.lastIndexOf("_") == 1) { // 1st level so, Main Nav
			objDiv.className = "MainNavHover";
			if (objCell) objCell.className = "MainNavBGHover";
			if (document.layers) objLayer.className = "MainNavHover";
			if (!gbMainNavIsText) { // Roll Over Image
				funOverNavImage("NavImg" + sMenuLevel);
			}
		}
		else {
			objDiv.className = "SubMenuHover";
			if (objCell) objCell.className = "SubMenuBGHover";
			if (document.layers) objLayer.className = "SubMenuHover";
		}
	}

}

// Un-Highlight the Div
function funUnhighlightItem(sMenuLevel) {
	var objDiv, objCell, objLayer;
	if (isIE4) {
		objDiv = document.all["div" + sMenuLevel];
		if (document.all["td" + sMenuLevel]) objCell = document.all["td" + sMenuLevel];
	}
	else if (isDOM) {
		objDiv = document.getElementById("div" + sMenuLevel);
		if (document.getElementById("td" + sMenuLevel)) objCell = document.getElementById("td" + sMenuLevel);
	}
	if (document.layers) objLayer = document.layers["layer" + sMenuLevel];

	if (objDiv) {
		if (sMenuLevel.lastIndexOf("_") == 1) { // 1st level so, Main Nav
			objDiv.className = "MainNav";
			if (objCell) objCell.className = "MainNavBG";
			if (document.layers) objLayer.className = "MainNav";
			if (!gbMainNavIsText) { // Roll Over Image
				funOutNavImage("NavImg" + sMenuLevel);
			}
		}
		else {
			objDiv.className = "SubMenu";
			if (objCell) objCell.className = "SubMenuBG";
			if (document.layers) objLayer.className = "SubMenu";
		}
	}
}


// Un-Highlight all the items in a Menu
function funUnhighlightMenu(sMenuLevel) {
	var aryCurMenu = eval("aryMenu" + sMenuLevel);
	for (var i=0; i < aryCurMenu.length; i++) {
		if (aryCurMenu == aryMenu1) funUnhighlightItem(sMenuLevel + "_" + (i+1)); // 1st Level Menu
		else funUnhighlightItem(sMenuLevel + "_" + (i+2));
	}
}

/****************************
 POSITION THE MENUS FUNCTION
****************************/

function funWindowResize() {
	if (gbIsLoaded) funPositionMenus();
}

function funPositionMenus() {
	if (gbMainNavVertical) { // Main Nav is Vertical
		for (var i=0;i < gAryAllMenus.length; i++) {
			//Position the Sub-Menu
			funPositionSideSubNavs(gAryAllMenus[i][0]);
		}
	}
	else { // Main Nav on the Top
		for (var i=0;i < gAryAllMenus.length; i++) {
			if (gAryAllMenus[i][0].lastIndexOf("_") == 1) { // 1st Level drops down
				//Position the Sub-Menu
				funPositionBelowSubNavs(gAryAllMenus[i][0]);
			}
			else { // All other sub-menus expand to the side
				//Position the Sub-Menu
				funPositionSideSubNavs(gAryAllMenus[i][0]);
			}
		}
	}

	gbIsLoaded = true;
	if (!gbHideOnMouseOut) document.onclick = funHideAllSubs;
}

function funPositionSideSubNavs(sSubMenuLevel) {
	var objParentItem, objParentTable, objSubMenu, nMoveWidth, nBorder;
	if (isNN4) {
		// Get the Object references
		objParentItem = eval("document.layer" + sSubMenuLevel);
		objParentItem.getRealLeft = getRealLeft;
		objParentItem.getRealTop = getRealTop;

		// Set the top and left of the sub menu
		objSubMenu = eval("document.sub" + sSubMenuLevel);
		objSubMenu.pageY = parseInt(objParentItem.getRealTop()) + gnOffsetVertical;
		if (gsSubMenuSide == "left") { // Expand to the left
			objSubMenu.pageX = parseInt(objParentItem.getRealLeft()) + parseInt(objParentItem.width) + gnOffsetHorizontal;
		}
		else { // Expand to the right
			objSubMenu.pageX = parseInt(objParentItem.getRealLeft()) - parseInt(objSubMenu.width) - gnOffsetHorizontal;
		}
	}
	else {
		if (isIE4) {
			// Get the Object references
			objSubMenu = document.all["sub" + sSubMenuLevel];
			objSubMenuTable = document.all["table" + sSubMenuLevel]
			objParentItem = document.all["div" + sSubMenuLevel]
			objParentTable = document.all["sub" + sSubMenuLevel.substr(0,sSubMenuLevel.lastIndexOf("_"))];
			objParentItem.getRealLeft = getRealLeft;
			objParentItem.getRealTop = getRealTop;

			// Set the top and left of the sub menu
			objSubMenu.style.top = parseInt(objParentItem.getRealTop()) + gnOffsetVertical;
			if (gsSubMenuSide != "right") { // Expand to the left
				objSubMenu.style.left = parseInt(objParentItem.getRealLeft()) + parseInt(objParentTable.width) + gnOffsetHorizontal;
			}
			else { // Expand to the right
				objSubMenu.style.left = parseInt(objParentItem.getRealLeft()) - parseInt(objParentTable.width) - gnOffsetHorizontal;
			}
		}
		else if (isDOM) {
			// Get the Object references
			objSubMenu = document.getElementById("sub" + sSubMenuLevel);
			objSubMenuTable = document.getElementById("table" + sSubMenuLevel);
			objParentItem = document.getElementById("div" + sSubMenuLevel);
			objParentTable = document.getElementById("table" + sSubMenuLevel.substr(0,sSubMenuLevel.lastIndexOf("_")));
			objParentItem.getRealLeft = getRealLeft;
			objParentItem.getRealTop = getRealTop;
			objSubMenu.style.top = parseInt(objParentItem.getRealTop()) + gnOffsetVertical;			

			// Set the top and left of the sub menu
			if (gsSubMenuSide == "right") { // Expand to the right
				nMoveWidth = objParentTable.width;
				if (nMoveWidth == "" || nMoveWidth == "auto") nMoveWidth = (document.all) ? objParentTable.currentStyle.width : objParentTable.style.width;
				if (nMoveWidth == "" || nMoveWidth == "auto") nMoveWidth = (document.all) ? funClassDefStyle(document.all.NavStyles.styleSheet, ".navTopMainNavTable").width : funClassDefStyle(document.getElementById("NavStyles").sheet, ".navTopMainNavTable").width;
				objSubMenu.style.left = parseInt(objParentItem.getRealLeft()) + parseInt(nMoveWidth) + gnOffsetHorizontal;
			}
			else { // Expand to the left
				nMoveWidth = objSubMenuTable.width;
				if (nMoveWidth == "" || nMoveWidth == "auto") nMoveWidth = (document.all) ? objSubMenuTable.currentStyle.width : objSubMenuTable.style.width;
				objSubMenu.style.left = parseInt(objParentItem.getRealLeft()) - parseInt(nMoveWidth) - gnOffsetHorizontal;
			}
			if (isIE5) {
				nBorder = objParentTable.border;
				if (nBorder == "" || nBorder == "auto") nBorder = (document.all) ? objParentTable.currentStyle.borderRightWidth : objParentTable.style.borderRightWidth;
				if (nBorder == "" || nBorder == "auto") nBorder = (document.all) ? funClassDefStyle(document.all.NavStyles.styleSheet, ".navTopMainNavTable").borderWidth : funClassDefStyle(document.getElementById("NavStyles").sheet, ".navTopMainNavTable").borderWidth;
				if (nBorder.indexOf("medium") == 0 || nBorder == "") nBorder = "0";
				objSubMenu.style.left = parseInt(objSubMenu.style.left) - parseInt(nBorder);
				//objSubMenu.style.top = parseInt(objSubMenu.style.top) - parseInt(objParentTable.border);
			}
		}
	}
}

function funPositionBelowSubNavs(sSubMenuLevel) {
	var objParentItem, objParentCell, objSubMenu, objSubMenuTable, nParentCellHeight, nBorder;
	if (isNN4) {
		objParentItem = eval("document.layer" + sSubMenuLevel);
		objParentItem.getRealLeft = getRealLeft;
		objParentItem.getRealTop = getRealTop;

		objSubMenu = eval("document.sub" + sSubMenuLevel);
		objSubMenu.pageX = parseInt(objParentItem.getRealLeft()) + gnOffsetHorizontal;
		if (gsTopNavSubAlignment == "right") objSubMenu.pageX = objSubMenu.pageX + (objParentItem.width - objSubMenu.width);
		objSubMenu.pageY = parseInt(objParentItem.getRealTop()) + parseInt(objParentItem.height) + gnOffsetVertical;
	}
	else {
		if (isIE4) {
			objSubMenu = eval("document.all.sub" + sSubMenuLevel);
			objParentItem = eval("document.all.div" + sSubMenuLevel);
			objParentItem.getRealLeft = getRealLeft;
			objParentItem.getRealTop = getRealTop;
			objSubMenu.style.left = parseInt(objParentItem.getRealLeft()) + gnOffsetHorizontal;
			if (gsTopNavSubAlignment == "right") objSubMenu.style.left = parseInt(objSubMenu.style.left) + (objParentItem.width - objSubMenu.width);
			objSubMenu.style.top = parseInt(objParentItem.getRealTop()) + parseInt(objParentItem.height) + gnOffsetVertical;
		}
		else if (isDOM) {
			objSubMenu = document.getElementById("sub" + sSubMenuLevel);
			objSubMenuTable = document.getElementById("table" + sSubMenuLevel);
			objParentItem = document.getElementById("div" + sSubMenuLevel);
			objParentCell = document.getElementById("td" + sSubMenuLevel);
			objParentTable = document.getElementById("table" + sSubMenuLevel.substr(0,sSubMenuLevel.lastIndexOf("_")));
			
			objParentItem.getRealLeft = getRealLeft;
			objParentCell.getRealTop = getRealTop;
			objSubMenu.style.left = parseInt(objParentItem.getRealLeft()) + gnOffsetHorizontal;
			if (gsTopNavSubAlignment == "right") objSubMenu.style.left = parseInt(objSubMenu.style.left) + (funGetCellWidth(objParentTable, objParentCell) - objSubMenuTable.width);
			nParentCellHeight = objParentCell.height;
			if (nParentCellHeight == "" || nParentCellHeight == "auto") nParentCellHeight = (document.all) ? objParentCell.currentStyle.height : objParentCell.style.height;
			if (nParentCellHeight == "" || nParentCellHeight == "auto") nParentCellHeight = (document.all) ? objParentItem.currentStyle.height : objParentItem.style.height;
			if (nParentCellHeight == "" || nParentCellHeight == "auto") nParentCellHeight = (document.all) ? funClassDefStyle(document.all.NavStyles.styleSheet, ".MainNav").height : funClassDefStyle(document.getElementById("NavStyles").sheet, ".MainNav").height;
			if (nParentCellHeight == "" || nParentCellHeight == "auto") nParentCellHeight = (document.all) ? funClassDefStyle(document.all.NavStyles.styleSheet, ".navTopMainNavTable").height : funClassDefStyle(document.getElementById("NavStyles").sheet, ".navTopMainNavTable").height;
			objSubMenu.style.top = parseInt(objParentCell.getRealTop()) + parseInt(nParentCellHeight) + gnOffsetVertical;

			if (isIE5) {
				nBorder = objParentTable.border;
				if (nBorder == "" || nBorder == "auto") nBorder = (document.all) ? objParentTable.currentStyle.borderBottomWidth : objParentTable.style.borderBottomWidth;
				if (nBorder == "" || nBorder == "auto") nBorder = (document.all) ? funClassDefStyle(document.all.NavStyles.styleSheet, ".navTopMainNavTable").borderWidth : funClassDefStyle(document.getElementById("NavStyles").sheet, ".navTopMainNavTable").borderWidth;
				if (nBorder.indexOf("medium") == 0 || nBorder == "") nBorder = "0";
				objSubMenu.style.left = parseInt(objSubMenu.style.left) - parseInt(nBorder);
				objSubMenu.style.top = parseInt(objSubMenu.style.top) + parseInt(nBorder);
			}
		}
	}
}

function funGetCellWidth(objTable, objCell) {
	if (document.all || document.getElementById) {
		//var objTable = (document.getElementById) ? document.getElementById(sTableID) : document.all[sTableID];
		//var objCell = (document.getElementById) ? document.getElementById(sCellID) : document.all[sCellID];
		var objRow = (document.getElementById) ? objCell.parentNode : objCell.parentElement;
		nCellIndex = objCell.cellIndex;

		// Safari Bug Fix to get CellIndex
		var sAgent = navigator.userAgent;
		if (sAgent.indexOf("Safari") > 1) { //Get the Cell Index another way
			for (var i=0; i<objRow.cells.length; i++) {
				if (objRow.cells[i] == objCell) {
					nCellIndex = i;
					break;
				}
			}
		}

		var nCellWidth, nTableLeft, nTableWidth, nCellLeft, nCellIndex, objNextCell;
		objCell.getRealLeft = getRealLeft;
		nCellLeft = parseInt(objCell.getRealLeft());
		if (nCellIndex < objRow.cells.length-1) { // Not the Last Cell
			objNextCell = objRow.cells[nCellIndex+1];
			objNextCell.getRealLeft = getRealLeft;
			nCellWidth = parseInt(objNextCell.getRealLeft()) - nCellLeft;
		}
		else { //Last Cell so use the table width
			objTable.getRealLeft = getRealLeft;
			nTableLeft = parseInt(objTable.getRealLeft());
			nCellWidth = nTableLeft + parseInt(objTable.width) - nCellLeft;
		}
		return nCellWidth;
	}
	return 0
}

/*******************************
 SELECT MENU DISPLAY FUNCTIONS
********************************/

//Hides all Select Menus in all forms
function hideSelectMenus() {
	if (document.all) {
		var objForm;
		for (j=0;j<document.forms.length;j++){
			objForm = document.forms[j];
			for (i=0;i<objForm.length;i++){
				if (objForm[i].getAttribute("type") == "select-one" || objForm[i].getAttribute("type") == "select-multiple"){
					objForm[i].style.visibility = "hidden";
				}
			}
		}
	}
}

// Un-hides all Select menus in all forms
function showSelectMenus() {
	if (document.all) {
		var objForm;
		for (j=0;j<document.forms.length;j++){
			objForm = document.forms[j];
			for (i=0;i<objForm.length;i++){
				if (objForm[i].getAttribute("type") == "select-one" || objForm[i].getAttribute("type") == "select-multiple"){
					objForm[i].style.visibility = "";
				}
			}
		}
	}
}

/*****************************
 STYLESHEET PARSING FUNCTIONS
*****************************/

// Returns a style object for a specific class definition
function funClassDefStyle(objStylesheet, sClassName) {
	var objRules = (objStylesheet.cssRules) ? objStylesheet.cssRules : objStylesheet.rules;
	for (var i=0; i<objRules.length; i++) {
		if (objRules[i].selectorText.toLowerCase() == sClassName.toLowerCase()) {
			return objRules[i].style;
			break;
		}
	}
}


/***************************
 PAGE COORDINATES FUNCTIONS
***************************/

function getRealLeft(bShowChain) {
	if (bShowChain == null) bShowChain = false;
	var xPos = this.offsetLeft;
	var tempEl = this.offsetParent;
  	while (tempEl != null) {
		//For Debugging
		if (bShowChain) alert(tempEl.tagName + ": " + tempEl.className + "(ID:" + tempEl.id + ")");
  		xPos += tempEl.offsetLeft;
  		tempEl = tempEl.offsetParent;
  	}
	return xPos;
}

function getRealTop(bShowChain) {
	if (bShowChain == null) bShowChain = false;
	var yPos = this.offsetTop;
	var tempEl = this.offsetParent;
  	while (tempEl != null) {
		//For Debugging
		if (bShowChain) alert(tempEl.tagName + ": " + tempEl.className + "(ID:" + tempEl.id + ")");
  		yPos += tempEl.offsetTop;
  		tempEl = tempEl.offsetParent;
  	}
	return yPos;
}

function getImgX(whichImg) {
	var theImg, theImgX, theImgWidth;
	theImg = eval("document." + whichImg);
	theImgWidth = theImg.width;
	if (isIE4 || isDOM) {
		theImg.getRealLeft = getRealLeft;
		theImgX = theImg.getRealLeft();
	}
	else if (isNN4) theImgX = theImg.x;

	return theImgX;
}

function getImgY(whichImg) {
	var theImg, theImgY, theImgHeight;
	theImg = eval("document." + whichImg);
	theImgHeight = theImg.height;
	if (isIE4 || isDOM) {
		theImg.getRealTop = getRealTop;
		theImgY = theImg.getRealTop();
	}
	else if (isNN4) theImgY = theImg.y;

	return theImgY;
}


/*************************
 IMAGE ROLLOVER FUNCTIONS
*************************/

function funOverNavImage(sImgName) {
	if (document.images && gbIsLoaded)
		document[sImgName].src = eval(sImgName + "On.src");
}

function funOutNavImage(sImgName) {
	if (document.images && gbIsLoaded)
		document[sImgName].src = eval(sImgName + "Off.src");
}

function DoNothing() {
	// Literally does nothing
}

//</SCRIPT>
