/*
**
** $Id: report_posts.js,v 2.1.0.0 2005/09/12 19:32:23 chatasos Exp $
**
** Javascript code to enable/disable tabs and show/hide panels
**
*/

// The panels array is defined in the .tpl files

var myActiveTab = null;

function showTabContents(tab, name)
{
	var myTagList, i;

	// check if we have a stored active tab
	if ( myActiveTab )
	{
		myActiveTab.className = "tab";
	}
	else
	{
		// get all the "A" tags
		myTagList = document.getElementsByTagName("A");
		for (i = 0; i < myTagList.length; i++)
		{
			// then get all the active tabs
			if (myTagList[i].className == "tab activeTab")
			{
				// and reset their class
				myTagList[i].className = "tab";
			}
		}
	}

	// store the active tab
	myActiveTab = tab;

	// change its class and remove focus
	myActiveTab.className = "tab activeTab";
	myActiveTab.blur();

	// enable/disable panels with tab contents
	for(i = 0; i < panels.length; i++)
	{
		// check for document.all too?
		// check for getElementById too?
		// if we find our panel make it visible, else hide it
		document.getElementById(panels[i]).style.display = (name == panels[i]) ? 'block' : 'none';
	}

	return false;
}


