$(function() {

    $(".tab_observer").click(function() {
        
        // Figure out current list via CSS class
        var curList = $(".tab_observer.active").attr("rel");
        
        // List moving to
        var $newList = $(this);
              
        // Remove highlighting - Add to just-clicked tab
        $(".tab_observer").removeClass("active");
        //$newList.addClass("active");
        $('[rel="'+$newList.attr("rel")+'"]').addClass('active');
        
        // Figure out ID of new list
        var listID = $newList.attr("rel");
        
        if (listID != curList) {
            
            // Fade out current list
            $("#"+curList).fadeOut(300, function() {
                
                // Fade in new list on callback
                $("#"+listID).fadeIn();
            
            });
            
        }
        
        //scroll to tabs
        $('#tabs_list').scrollTo(500);
        
        // Don't behave like a regular link
        return false;
    });

});

