document.observe('dom:loaded', function() {
	/**
	 * Inherite Control.Tabs
	 */
  if($('tabs')) {
    oTabs = new Control.Tabs('tabs', {
      defaultTab: 'tab_1',
      setClassOnContainer : false
    });
    
    /**
     * Extending existing method
     * @param {Object} link
     */
    oTabs.setActiveTab = function(link) {
      if(!link && typeof(link) == 'undefined')
        return;
      if(typeof(link) == 'string'){
        this.setActiveTab(this.links.find(function(_link){
          return _link.key == link;
        }));
      }else if(typeof(link) == 'number'){
        this.setActiveTab(this.links[link]);
      }else{
        if (this.activeContainer) {
          
          /**
           * Hide tab
           */
          //$(this.activeContainer).fade({duration:0.3, from:1.0,to:0.0});
          $(this.activeContainer).hide();
        }
        this.links.each(function(item){
          (this.options.setClassOnContainer ? $(item.parentNode) : item).removeClassName('tab active');
        }.bind(this));
        (this.options.setClassOnContainer ? $(link.parentNode) : link).addClassName('tab active');
        this.activeContainer = this.containers.get(link.key);
        this.activeLink = link;
        
        /**
         * Activate tab 
         */
        //$(this.activeContainer).appear({duration:0.6,from:0.0,to:1.0});
        
        $(this.activeContainer).show()
        if (Object.isElement($('tab_3'))) {
          if (!Prototype.Browser.IE) {
            $('tab_3').update($('tab_set_sifr_fix').innerHTML);
          }
        }
      }
    }
  }
});

Event.observe(window,'resize', function() {
  if (Object.isElement($('tab_3'))) {
    if (Prototype.Browser.IE) {
      if ($('tab_3').style.display == 'none') {
        $('tab_set_sifr_fix').setStyle({
          left: -5000 + "px",
          top: -5000 + "px"
        })
      }
      else {
        iHeight = $('tab_set_sifr_fix').getHeight()
        iLeft = $('tab3_pos').offsetLeft
        iTop = $('tab3_pos').offsetTop
       
        $('tab_3').setStyle({
          height: iHeight + 'px'
        })
        
        $('tab_set_sifr_fix').setStyle({
          left: iLeft + "px",
          top: iTop + "px"
        })
      }
    }
    else {
      $('tab_3').update($('tab_set_sifr_fix').innerHTML);            
    }
  }
});
 
