//================================================================

//Scripts for Tab panels (SR3.5)

//===============================================================

var tabCount = 1; //initialy only one tab

var tabButtonLabels = [""];



/*

* Changes the tab-button i to be active and the other tab-buttons

* to be inactive. 0 < i < number of tab-buttons - 1

*/

function changeActiveTab(i) {

	for( j=0; j < tabCount; ++j ) {

		if( i==j ) { activateTab(j); }

		else { deactivateTab(j); }

	}

	activeTabIndex = i;

}



/*

* Activates the tab-button i and shows it's content panel.

*/

function activateTab(i) {

	var obj = document.getElementById( "tab-bg:"+i );

	if(obj) {obj.className="tab_on";}

	document.getElementById( "tab-body:"+i ).style.display='block';



	// fire custom on load event

	if (typeof cms_UserTracking_sendOnLoadEvent == "function"

			&& typeof usertracking_pagetitle_default == "string") {

		usertracking_pagetitle_customized = usertracking_pagetitle_default + " - " + tabButtonLabels[i];

		cms_UserTracking_sendOnLoadEvent(null, usertracking_pagetitle_customized, usertracking_onload_config);

	}

}



/*

* Deactivates the tab-button i and hides it's content panel.

*/

function deactivateTab(i) {

	var obj = document.getElementById( "tab-bg:"+i );

	if(obj) {obj.className="tab_off";}

	document.getElementById( "tab-body:"+i ).style.display='none';

}



/*

* Call this function before calling any other function.

* Set parameter i to the number of tab-buttons when calling.

* Initialises the script.

*/

function initTabScript(pLabels) {

  tabButtonLabels = pLabels;

	tabCount = pLabels.length;

}


