(function($){
    var defaults = {
        event: 'mouseover',
        selectedClass: 'ui-tscure',
        hideClass: 'ui-tabs-hide'  
    };
    $.fn.tabs = function(o){
        var o = $.extend(defaults, o), $tabs=null, panels=[];
        
        var $tabs = $('a:first-child', this);        
        $tabs.each(function(){
            var hash = this.hash && this.hash.substr(1);
            panels.push(hash);
        });  
        if (panels.length == 0) return false;
        
        //bind behaviors
        $tabs.unbind(o.event)
            .bind(o.event, function(){
                $tabs.hasClass(o.selectedClass) && $tabs.removeClass(o.selectedClass);
                $(this).addClass(o.selectedClass);
                var pid = this.hash && this.hash.substr(1);
                for(var i = 0; i < panels.length; i++){
                    if (panels[i] == pid){
                        $('#'+ panels[i]).removeClass(o.hideClass);
                    }else{
                        $('#'+ panels[i]).addClass(o.hideClass);
                    }                    
                }
            }).click(function(){
                this.blur();
                return false;
            });
    };
})(jQuery);