function switchToPage(intNewPage) {
   toggle(elemById('page_' + Globals.intPage));
   elemById('pagination_' + Globals.intPage).className = '';
   Globals.intPage = intNewPage.intRange(0, Globals.numOfPages);
   toggle(elemById('page_' + Globals.intPage));
   elemById('pagination_' + Globals.intPage).className = 'selected';
}

function switchToTab(intTab) {
   var elemTab, intOtherTab;
   toggle(elemById('tabsheet_' + intTab));
   elemTab = elemById('tab_' + intTab);
   elemTab.className += ' selected';
   elemTab.onclick = function(){};

   intOtherTab = (intTab + 1) % 2;
   toggle(elemById('tabsheet_' + intOtherTab));
   elemTab = elemById('tab_' + intOtherTab);
   elemTab.className = elemTab.className.substring(0, elemTab.className.indexOf(' '));
   elemTab.onclick = function(_tab){
         return function() {switchToTab(_tab)};
   }(intOtherTab);
}

function switchToUfo(intNewPage) {
   toggle(elemById('ufo_' + Globals.intUfo));
   toggle(elemById('ufo_picture_' + Globals.intUfo));
   elemById('ufo_button_' + Globals.intUfo).className = '';
   Globals.intUfo = intNewPage.intRange(0, Globals.numOfUfos);
   toggle(elemById('ufo_' + Globals.intUfo));
   toggle(elemById('ufo_picture_' + Globals.intUfo));
   elemById('ufo_button_' + Globals.intUfo).className = 'selected';
}

function addNumberClasses() {
   var _i, arrNumbers, arrItems;
   arrNumbers = new Array('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten');
   arrItems = elemsByTag('li', elemById('specslist'));
   for (_i = 0; _i < arrItems.length && _i < 10; ++_i) {
      arrItems[_i].className = arrNumbers[_i];
   }
}

function addTableClasses() {
   var _i, arrRows, arrCells;
   arrRows = elemsByTag('tr', elemById('specstable'));
   for (_i = 0; _i < arrRows.length; ++_i) {
      arrCells = elemsByTag('td', arrRows[_i]);
      if (arrCells.length == 0) {
         arrCells = elemsByTag('th', arrRows[_i]);
      }
      if (arrCells.length > 0) {
         arrCells[0].className = 'col0';
      }
   }
}
