/*
These are the functions which can be called by the tabs if the action is set. The action property of the linkedTab
object is the name of the function that is going to be called below.
*/

function selectTabWithAction(selectedTabId, tabs, style, span, version, jsActionId) {
  selectTab(selectedTabId, tabs, style, span, version);
  //alert("JS Action ID in select tab action => "+jsActionId);
  executeTabAction(jsActionId);
}

var tabActionsArr = new Array();

function addTabAction(jsActionId, actionStr) {
  var aTabAction = new Array();
  aTabAction[0] = jsActionId;
  aTabAction[1] = actionStr;

  var numActions = tabActionsArr.length;
  tabActionsArr[numActions] = aTabAction;
}

function executeTabAction(jsActionId) {
  var numActions = tabActionsArr.length;

  for(i=0;i<numActions;i++) {
    var aTabAction = tabActionsArr[i];
    //alert("JS Action ID in execute tab action => '"+jsActionId+"'");
    //alert("Tab ID in the actions table => '"+aTabAction[0]+"'");
    //alert("Action in the actions table => "+aTabAction[1]);
    //alert(aTabAction[0] == jsActionId);
    if(aTabAction[0] == jsActionId) {
      //alert("The executed tab action is: "+aTabAction[1]);
      eval(aTabAction[1]);
    }
  }
}
