var AutoTabTimer;

function InitAutoTabSwitch()
{
	AutoTabTimer = setTimeout("AutoTabSwitch()", 5000);
}

function ClearAutoTabSwitch()
{
	clearTimeout(AutoTabTimer);
}

function AutoTabSwitch()
{
	var Tabs = new Array(1, 2, 3, 4, 5);
	var ActiveTabID = parseInt(getElementsByClass('TabA', document, 'div')[0].id.substring(1, 2));
	var NextTab = (ActiveTabID + 1 <= Tabs.length) ? ActiveTabID + 1 : Tabs[0];
	SwitchTab(NextTab);
	InitAutoTabSwitch();
}

function getElementsByClass( searchClass, domNode, tagName)
{
	if (domNode == null) domNode = document;
	if (tagName == null) tagName = '*';
	var i = null;
	var j = null;
	var el = new Array();
	var tags = domNode.getElementsByTagName(tagName);
	var tcl = " "+searchClass+" ";
	for (i=0, j=0; i < tags.length; i++)
	{
		var test = " " + tags[i].className + " ";
		if (test.indexOf(tcl) != -1)
		{
			el[j++] = tags[i];
		}
	}
	return el;
}

function SwitchTab(ID)
{
	var Tabs = new Array(1, 2, 3, 4, 5);
	for (var i = 0; i < Tabs.length; i++)
	{
		if (Tabs[i] == ID)
		{
			document.getElementById('T' + Tabs[i]).className = 'TabA'
			document.getElementById('TC' + Tabs[i]).className = 'TabContentA';
		}
		else
		{
			document.getElementById('T' + Tabs[i]).className = 'TabB'
			document.getElementById('TC' + Tabs[i]).className = 'TabContentB';
		}
	}
}

function SwitchForumTab(ID)
{
	var ForumTabs = new Array(1, 2);
	for (var i = 0; i < ForumTabs.length; i++)
	{
		if (ForumTabs[i] == ID)
		{
			document.getElementById('ForumT' + ForumTabs[i]).className = 'ForumTabA'
			document.getElementById('ForumTC' + ForumTabs[i]).className = 'ForumTabContentA';
		}
		else
		{
			document.getElementById('ForumT' + ForumTabs[i]).className = 'ForumTabB'
			document.getElementById('ForumTC' + ForumTabs[i]).className = 'ForumTabContentB';
		}
	}
}