$(document).ready(function(){
    // Find all instances of the 'div.sc_menu_wrapper'
    // For each one found test to determine if the scroller arrows should be
    // visible and make them visible accordingly.
    $('div.sc_menu_wrapper').each(function(){
        var self = $(this),
        wrapperHeight = self.height(),
        menuHeight = self.children('.sc_menu').height();
        if( wrapperHeight < menuHeight ){
            self.siblings('.scroll_arrow_up').css("visibility", "visible");
            self.siblings('.scroll_arrow_down').css("visibility", "visible");
            if( !($.browser.msie && parseInt($.browser.version) <= 8 ) ){
                // Pretty animations for browsers that properly support opacity
                self.siblings('.scroll_arrow_up').animate({
                    opacity: 1.0
                }, 2000);
                self.siblings('.scroll_arrow_down').animate({
                    opacity: 1.0
                }, 2000);
            }
        }
    });
    // Do the same thing for the horizontal media thumbnail scroller if present
    $('div.jcarousel-clip').each(function(){
        var self = $(this),
        wrapperWidth = self.width(),
        scrollerWidth = self.children('.jcarousel-list').width();
        if( wrapperWidth < scrollerWidth ){
            self.siblings('.jcarousel-prev').css("visibility", "visible");
            self.siblings('.jcarousel-next').css("visibility", "visible");
            if( !($.browser.msie && parseInt($.browser.version) <= 8 ) ){
                // Pretty animations for browsers that properly support opacity
                self.siblings('.jcarousel-prev').animate({
                    opacity: 1.0
                }, 2000);
                self.siblings('.jcarousel-next').animate({
                    opacity: 1.0
                }, 2000);
            }
        }
    });
});
