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('active');
        }.bind(this));
        (this.options.setClassOnContainer ? $(link.parentNode) : link).addClassName('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();
      }
    }
  }
});