// obiekt do zaznacznia
function tab(){
    // zaznaczone sekcje 
    this.tabs = new Array();

    // dodanie sekcji do listy
    this.addTab = function(tab) {
       if (this.tabs.indexOf( tab ) < 0) {
            if (this.tabs.length == 0) {
                this.tabs = new Array(tab);
            } else {
                this.tabs.push(tab);
            }
        }
    }

    // reakcja na onClick
    this.onClick = function(tab) {
        for (i = 0; i < this.tabs.length; i++) {
            li = document.getElementById(this.tabs[i]);
            div = document.getElementById(this.tabs[i]+'_container');
            if (this.tabs[i] == tab) {
                div.style.display = 'block';
                li.className='active';
            } else {
                div.style.display = 'none';
                li.className='';
            }
        }
        // ukrywanie wersji promocyjnych radka
        show_extra(-1);
    }
    
    this.setFirstActive = function() {
        this.onClick(this.tabs[0]);
    }
    
    this.setTabActive = function( ID ) {
        this.onClick(this.tabs[ID]);
    }

    return this;
}

if (!Array.prototype.indexOf)
{
  Array.prototype.indexOf = function(elt /*, from*/)
  {
    var len = this.length;

    var from = Number(arguments[1]) || 0;
    from = (from < 0)
         ? Math.ceil(from)
         : Math.floor(from);
    if (from < 0)
      from += len;

    for (; from < len; from++)
    {
      if (from in this &&
          this[from] === elt)
        return from;
    }
    return -1;
  };
}
