function TabHandler() {
  this.buttons = new Array();
  this.contents = new Array();
}

TabHandler.prototype.addTabController = function(idButton, idContent) {
  button = document.getElementById(idButton);
  cont = document.getElementById(idContent)
  if (button && cont) {
   button.tabHandler = this;
   button.tabId = idContent;
   button.onclick = function() {
     this.tabHandler.showTab(this.id, this.tabId);
   }
   this.buttons.push(button);
   this.contents.push(cont);
  }
}

TabHandler.prototype.showTab = function(buttonId, contentId) {
  for (var i = 0; i < this.buttons.length; i++) {
		if (buttonId == 'Glossary') {
			this.buttons[i].className = 'last';
		}	else if (this.buttons[i].id == 'Glossary') {
			this.buttons[i].className = 'last';
		} else if (buttonId == this.buttons[i].id) {
       this.buttons[i].className = 'active';
    } else {
     this.buttons[i].className = '';
    }
  }
  for (var i = 0; i < this.contents.length; i++) {
   if (contentId == this.contents[i].id) {
     this.contents[i].style.display = 'block';
   } else {
     this.contents[i].style.display = 'none';
   }
  }
}