/*
	navmenu-internal.js
	Re-implements some of the functions in nevmenu.js but in a 
	manner more appropriate to internal pages.
*/

///////////////////////////////////////////////////////////
// Globals

var _sectionList = new Array();
var _currentTab = -1;
var _section = -1;
var _resetTimout;


function setSection(which)
{
	_section = which;
	tabHighlight(_section);
}

function resetSection()
{
	setSection(_section);
}

function tabHighlight(sectionIndex)
{
	//check to see if we're dealing with a modern browser
	if (_check())
	{
		selectTab(sectionIndex);
		loadSectionLinks(sectionIndex);
	}
}

function maintainTabHighlight()
{
	if (_resetTimout != null)
	{
		window.clearTimeout(_resetTimout);
		_resetTimout = null;
	}
}

function resetTabs()
{
	_resetTimout = window.setTimeout("resetSection()", 1000);
}


function selectTab(sectionIndex)
{
	maintainTabHighlight();
	if (_currentTab >= 0)
	{
		var tab = _get("tab" + _currentTab);
		if (tab) tab.className = "";
	}

	_currentTab = sectionIndex;

	var tab = _get("tab" + _currentTab);
	if (tab) tab.className = "selected";
}

function loadSectionLinks(sectionIndex)
{
	var linkArea = _get("sectionInfo");
	if (linkArea)
	{
		linkArea.innerHTML = _sectionList[sectionIndex];
	}
}

function _check()
{
	if (document.getElementById || document.all) return true;
	return false;
}

function _get(id)
{
	if (document.getElementById)
		return document.getElementById(id);
	else if (document.all)
		return document.all[id];
	else
		return null;
}


function formSubmit()
{
	f=self.document.searchForm;
	f.submit();
}
