(function($){
    
$.fn.simpletabs = function(options) {

    var settings = $.extend({
        tab_navigation: '.tabbed_navigation a',
        tab_content: '.tabbed_content > div',
        top_anchor: '#container',
        active_class: 'active',
        show: '0'
    }, options);		
    
    return this.each(function () {
    
        var $hash = window.location.hash.replace('-content','');
        
        var tab_content = $(settings.tab_content);
        
        if($hash && $hash != settings.top_anchor) {
        
            tab_content.hide().filter($hash).show();
            $what = 'a[href*='+$hash+']';
                
        } else {
        
            tab_content.hide().filter(':eq('+ settings.show +')').show();
            $what = ':eq('+ settings.show +')';
            
        }
        
        $(settings.tab_navigation).click(function () {
        
            tab_content.hide().filter(this.hash).show();
            $(this).parent().parent().find('li').removeClass(settings.active_class);
            $(this).parent().addClass(settings.active_class);
            
            $hash = $(this).attr('href');

            window.location.hash = $hash;
            
            return false;

        }).filter($what).click();
        
    });
    
};

})(jQuery);