//Universal Functions for tabs that appear on many pages.

function SetUnActive(root){
	document.getElementById(root+'_Tab').style.backgroundImage='url(images/tab_unactive_bg.gif)';
	document.getElementById(root+'_Tab_right').style.backgroundImage='url(images/tab_unactive_right.gif)';
	document.getElementById(root+'_Tab').style.textDecoration='underline';
	document.getElementById(root+'_Tab').style.backgroundColor='#999999'
	document.getElementById(root+'_Tab_right').style.backgroundColor='#999999'
}
function SetActive(root){
	document.getElementById(root+'_Tab').style.backgroundImage='url(images/TestTabs_bg.gif)';
	document.getElementById(root+'_Tab').blur(); //prevents FF from drawing a box around the tab
	document.getElementById(root+'_Tab_right').style.backgroundImage='url(images/TestTabs_right.gif)';
	document.getElementById(root+'_Tab').style.textDecoration='none';
	document.getElementById(root+'_Tab').style.backgroundColor='#990000'
	document.getElementById(root+'_Tab_right').style.backgroundColor='#990000'
}

function ActivateTab(iTab)
{
	//check if the page height has been set.. and set it if we're taller than we were
	var PageHeight = $("Footer").getTop() - $("RightSide").getTop();
	if(!$("RightSide").style.height || $("RightSide").getSize().size.y > PageHeight - 28 )
	{
		$("RightSide").style.height = PageHeight+"px";
	}

	setTab(iTab);
	dhtmlHistory.add( TabNames[iView], {message: 'setTab('+iView+');'});
}
	
function setTab(iTab)
{
	iView = iTab;
	document.getElementById('TabsBannerInner').innerHTML=DisplayNames[iTab];
	
	for(var i=0 ;i < TabCount;i++)
	{
		if(i==iTab)
		{
			if(!ContentLoaded[i])
			{
				document.getElementById(TabNames[i]+"_at").innerHMTL = "Loading....";
				new Ajax("Ajax/"+sTabsPage, {method: "get",update: $(TabNames[i]+"_in")}).request("type="+TabNames[i]+"&id="+PageID);
				ContentLoaded[i] = true;
			}
		
			document.getElementById(TabNames[i]+"_at").style.display='block';
			SetActive(TabNames[i]);
		}
		else
		{
			document.getElementById(TabNames[i]+"_at").style.display='none';
			SetUnActive(TabNames[i]);
		}
	}
}
	