/**
 * @author Maxim Miroshnichenko <max@webproduction.com.ua>
 * @copyright WebProduction
 * @package JSPrototypeTabs
 */
var JSPrototypeTabs = Class.create({

    initialize: function(tabs) {
        this.tabs = $$(tabs);

        this.tabs.each(function (e) {
            e.observe('click', function (event) {
                // hide all tabs
                $$(tabs).each(function (t) {
                    $$(t.rel).invoke('hide');
                });

                // select tab
                $$(e.rel).invoke('show');

                // removes all selected
                $$(tabs).invoke('removeClassName', 'selected');

                // set selected
                e.addClassName('selected');

                Event.stop(event);
            });
        });
    }

});
