/* Tab Javascript
 * 
 * Copyright (C) 2004 mbc Computer Solutions Ltd. */
 
 
// Tab Collection
var tabs = new Array();

/*
 * Registers a tab in the Tab Collection
 * 
 * Parameters:
 * tabName - Name of the tab to register.
 *
 * Returns: Nothing.
 */
 
function RegisterTab(tabName)
{
	tabs.push(tabName);
}

/*
 * Change the active tab
 * 
 * Parameters:
 * tabName - Name of the tab to change/
 *
 * Returns: Nothing.
 */

function ChangeTab(tabName)
{
	for(i = 0; i < tabs.length; i++)
	{
		if(tabs[i].toString().toLowerCase() != tabName.toString().toLowerCase())
		{
			HideTab(tabs[i]);
		}		
	}
	
	ShowTab(tabName);			
}

function ChangeTabRounded(tab, index)
{
	var currenttab = document.getElementById('current');
	currenttab.id = ""
	
	for(i = 0; i < tabs.length; i++)
	{
		HideTab(tabs[i]);
	}
	
	ShowTabRounded(tab, index);			
}

/*
 * Displays a specified tab
 * 
 * Parameters:
 * tabName - Name of the tab to display.
 *
 * Returns: Nothing.
 */
function ShowTab(tabName)
{	
	var tab = document.getElementById(tabName + '_tab');
	
	if(tab != null)
	{
		tab.className = 'tabOn';						
	}
	
	var panel = document.getElementById(tabName + '_panel')
	
	if(panel != null)
	{
		panel.style.display = 'block';
	}		
}

function ShowTabRounded(tab, index)
{	

	if(tab != null)
	{
		tab.id = 'current';						
	}
	
	var panel = document.getElementById('tab' + index.toString() + '_panel')
	
	if(panel != null)
	{
		panel.style.display = 'block';
	}		
}

/*
 * Hides a specified tab
 * 
 * Parameters:
 * tabName - Name of the tab to hide.
 *
 * Returns: Nothing.
 */

function HideTab(tabName)
{
	var tab = document.getElementById(tabName + '_tab');
	
	if(tab != null)
	{
		tab.className = 'tabOff';						
	}
	
	var panel = document.getElementById(tabName + '_panel')
	
	if(panel != null)
	{
		panel.style.display = 'none';
	}
}
