/// <history>
///		<change date="2004-06-18" author="Darrin Morgan">Original Version</change>
/// </history>

/// <summary>
/// Handle a click on a tab button.
/// </summary>
/// <remarks>
/// Raised by the OnClick event on a tab "span" element.  Hides the
/// current tab page (and resets tab button), and displays the tab
/// page associated with the new button.
/// </remarks>
function OnTabClick()
{
	// get the source element (that raised the event).
	var tabButton = window.event.srcElement;

	// get the parent division.
	var tabGroup = tabButton.parentElement;

	var tabPageId = "";
	var tabPage = null;

	// examine each node in the tabgroup.
	for (childIndex=0; childIndex < tabGroup.childNodes.length; childIndex++)
	{
		// get the child node.
		var node = tabGroup.childNodes[childIndex];

		// locate the current tab button.
		if (node.tagName == "SPAN" && node.className == "TabBlue") 
		{
			// fade to gray.
			node.className = "TabGray";

			// locate the associated tab page.
			tabPageId = "TabPage" + node.id.substr(3);
			tabPage = document.getElementById(tabPageId);

			// hide the current tab page.
			tabPage.style.display = "none";
		}
	}

	// make the new tab button blue.
	tabButton.className = "TabBlue";

	// locate tab page associated with new button.
	tabPageId = "TabPage" + tabButton.id.substr(3);
	tabPage = document.getElementById(tabPageId);

	// make new tab page visible.
	tabPage.style.display = "";
}
