var activeTabID = -1;   // currently active dynamic tab (-1 means none)
var numTabs = 0;	// default this to prevent JS errors for non-dyn pages

function swapTab( tabID )
{
	// check that we aren't already on the selected tab and that there are other tabs to swap to
	if (tabID == activeTabID || numTabs < 2) return;

	// de-activate the currently active tab if there is one
	for(var i=0; i<numTabs; i++)
	{			  
		if (i < tabID)
		{
			eval("swapStyleClass('tab" + i + "', 'left');");
		}
		else if (i == tabID)
		{
			eval("swapStyleClass('tab" + i + "', 'current');");
		}
		else
		{
			eval("swapStyleClass('tab" + i + "', 'right');");
		}
	}

	// swap visible tab content
	if (activeTabID != -1)
	{
		eval("swapStyleClass('content" + activeTabID + "', 'inactivecontent');");
	}
	eval("swapStyleClass('content" + tabID + "', 'activecontent');");
	activeTabID = tabID;
}

// generic element class swapping function
function swapStyleClass( elementID, newClass )
{
	elem = document.getElementById(elementID);
	elem.className = newClass;
}