
tab = function(tab_list){
  this.tab_items = [];
  
  for ( var i = 0; i < tab_list.length; i++ ){ 
         this.tab_items.push(tab_list[i]);    
  }
  
  
}

tab.prototype = {
  tab_on : function (item){
      
      this.tabs_off();
      if(item){
        
        var on_class = this.tabs_switch_on(item);
        
        item.className = on_class;
        
        //show content
        tab_content = item.id + '_content' 
        document.getElementById(tab_content).style.display = 'block';
      }   
  },
  
  tabs_off : function (){
    for (var i = 0; i < this.tab_items.length; i++){ 
       off_class = this.tabs_switch_off(i);
       this.tab_items[i].className = off_class; 
       
       //hide content
       tab_content = this.tab_items[i].id + '_content'
       document.getElementById(tab_content).style.display = 'none';
    }
  },
  
  //custom for logos
  tabs_all_on : function (){
    for (var i = 0; i < this.tab_items.length; i++){ 
       on_class = this.tabs_switch_on(this.tab_items[i]);
       this.tab_items[i].className = on_class; 
       
       //hide all content
       tab_content = this.tab_items[i].id + '_content'
       document.getElementById(tab_content).style.display = 'none';
    }
  },
  
  tabs_switch_off : function (item_num){
  
    var new_off_class = "";    
    var classes = this.tab_items[item_num].className.split(' '); 
      
      for (var i = 0; i < classes.length; i++){  
   
        switch(classes[i])
        {
  
          case "tab_on":
            new_off_class = new_off_class + ' tab_off'
            break
          default:
            new_off_class = new_off_class + " " + classes[i]   
        }     
      }
      return new_off_class;
  }
  
  ,
  
  tabs_switch_on: function (item){
    
    var new_on_class = "";    
    var classes = item.className.split(' '); 
      
      for (var i = 0; i < classes.length; i++){  
   
        switch(classes[i])
        {
  
          case "tab_off":
            new_on_class = new_on_class + ' tab_on'
            break
          default:
            new_on_class = new_on_class + " " + classes[i]   
        }     
      }
      return new_on_class;
  }
}

