$(function(){
    // spotlight functionality
    $('.pagination div').click(function(){
        $newSpotlight = $(this);
        
        // find the new active class
        var classList = $newSpotlight.attr('class').split(/\s+/);
        var activeSpotlight;
        for (i = 0; i < classList.length; i++) {
            if(classList[i].length > 10){
                activeSpotlight = classList[i];
            }
        }
        
        // show the new spotlight
        $('#spotlights .spotlight_container.active').fadeOut('fast', function(){
			$(this).removeClass('active');
            $('#spotlights .spotlight_container.'+activeSpotlight).addClass('active').fadeIn('fast');
        });
        
        // change active button
        $('.pagination .active').removeClass('active');
        $('.pagination .'+activeSpotlight).addClass('active');
    });
    
    // next button
    $('.pagination_arrows .next').click(function(){
        
        $('.pagination .active').next().trigger('click');
    });
    
    // prev button
    $('.pagination_arrows .prev').click(function(){
        
        $('.pagination .active').prev().trigger('click');
    });
});
