$(function(){
        $('#background-overlay').hide();
        $('#background-sequence').cycle({timeout: 2400, delay:0}).hide().fadeIn('slow');
        $('#smallprint').hide();
        $('#nav').hide();
        $('h1').hide();  
        $('h1').delay(8000).fadeIn(1000, function(){
        $('#background-sequence').cycle('pause');
            $('#nav').fadeIn(4000, function(){
                $('#background-overlay').fadeIn();
                $('#smallprint').fadeIn('slow');
            });
        });
    
        $('#nav > li > a').click(function(){
            if ($(this).next('div').css({'opacity':'0.2'}).hasClass('expanded')) {
                $(this).next('div').slideUp('slow').removeClass('expanded');
                $(this).parent().removeClass('current');
            } else {
                $('#nav > li > div.expanded').css({'opacity':'0.2'}).slideUp('slow').removeClass('expanded').fadeOut('slow');
                $('#nav > li').removeClass('current');
                $(this).next('div').slideDown('slow').addClass('expanded').css({'opacity':'1'});   
                $(this).parent().addClass('current');
                if ($(this).parent().hasClass('scrollable')) {
                    //$('#background-overlay').hide();
                    $('div#collection-scroller').smoothDivScroll({ scrollingSpeed: 8, mouseDownSpeedBooster: 3, visibleHotSpots: 'always', hiddenOnStart: false });
                    $("div.scrollingHotSpotRight").show();
                    $(window).trigger('resize');
                    $('#background-sequence').cycle(5);
                    $('#scrollableArea a').mouseout(function(){
        $('#scrollableArea').css({'opacity':'0.1'});
    });
                } else {
                    $('#background-sequence').cycle($(this).parent().index()+4);
                    $('#background-overlay').fadeIn();
                }
            }
        });
        
        $('.scrollableArea a').click(function(){
            if ($('#background-overlay').is(':visible')) {$('#background-overlay').fadeOut();}
        });
        /*
        var showhash = window.location.hash ? '[hash=' + window.location.hash + ']' : '';
        if (showhash != '') {
            $('#nav a').filter(showhash).click();
            $(window).trigger('resize');
        }
        */    
    });
    
