//plugin name - simpletabs
//jQuery ui tabs are not friendly for using tabs a links, so I wrote this plugin - pab
(function($){
    $.fn.extend({ 
        simpletabs: function(options) {
            //Settings list and the default values  
            var defaults = {
                selected: 0
            };

            var options = $.extend(defaults, options);

            return this.each(function() {
                var o =options;
                var obj = $(this);		    //Assign current element to variable, in this case is UL element 		
                var menu = $("ul:first", obj);
                var items = $("li", menu);   //Get all LI in the UL  
                var panel = $(".tab-panel", obj);

                //Add jQuery UI tab classes
                obj.addClass('ui-tabs ui-widget ui-widget-content ui-corner-all');
                menu.addClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all');
                items.addClass('ui-state-default ui-corner-top');
                panel.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom');

                //Select tab  
                $("ul li:eq(" + o.selected + ")",obj).addClass('ui-state-default ui-corner-top ui-tabs-selected ui-state-active');

                //Attach mouseover and mouseout event to the LI   
                items.mouseover(function() {
                    $(this).addClass("ui-state-hover");
                }).mouseout(function() {
                    $(this).removeClass("ui-state-hover");
                });
                
                obj.show();
            });
        }
    });
})(jQuery);

 

