var _aryTabs = Array();


function showTabPage(tabId, src){
    var tbDiv = document.getElementById('tabButtons');
    if(tbDiv != null && tbDiv.childNodes.length > 0){

      // reset tab buttons to default style, and highlight the active one
      for(var i = 0; i < tbDiv.childNodes.length; i++){
        var tb = tbDiv.childNodes[i];
        
        if(tb != null && tb.tagName == "SPAN"){
            if(tb == src){
                tb.className = "tabButtonActive";
            }
            else {
                tb.className = "tabButton";
            }
            
        }
      }
      
      // set tab page visibility
      if(_aryTabs.length > 0){
          for(var i = 1; i <= _aryTabs.length; i++){
            var tabPageName = _aryTabs[i];
            
            var tab = document.getElementById(tabPageName);
            
            if(tab != null && i == tabId){
                tab.className = 'tabPageOpen';
            }
            else if(tab != null){
                tab.className = 'tabPage';
            }
          }
       }
      
    }
    return false;
}

function registerTabPage(index, tabPageId){
    _aryTabs[index] = tabPageId;
}

