var SimpleFabtabs = Class.create();
SimpleFabtabs.prototype = {
   initialize : function(element) {
          this.element = $(element);
          var options = Object.extend({}, arguments[1] || {});
          this.menu = $A(this.element.getElementsBySelector('tr td a'));
          this.show(this.getInitialTab());
          this.menu.each(this.setupTab.bind(this));
 },
        setupTab : function(elm) {
            Event.observe(elm,'mouseover',this.activate.bindAsEventListener(this),false)
  },
        activate :  function(ev) {
           var elm = Event.findElement(ev, "a");
           Event.stop(ev);
           this.show(elm);
           this.menu.without(elm).each(this.hide.bind(this));
        },
        hide : function(elm) {
            $(elm).removeClassName('active-tab');
            $(this.tabID(elm)).removeClassName('active-tab-body');
    },
        show : function(elm) {
            $(elm).addClassName('active-tab');
            $(this.tabID(elm)).addClassName('active-tab-body');
  },
        tabID : function(elm) {
           return elm.href.match(/#(\w.+)/)[1];
      },
        getInitialTab : function() {
           return this.menu.first();
 }
}

var NewsFabTabs;

Event.observe(window,'load',function(){ new SimpleFabtabs('recently-compared-list-table'); },false);
Event.observe(window,'load',function(){ new SimpleFabtabs('prepared-list-table'); },false); 
