function setupGallery() {
    
    var slideshow = this;
    $('#slideshow .mood img:first').show('clip', {}, 1300, function() {
        setTimeout(function() {
            slideshow.interval = setInterval(setupIntroSlides, 5000);
        }, 0);
    });
        
        
    var currentIndex = 0;
    function setupIntroSlides() {
        var images = $('#slideshow .mood img');
        
        // Do no setup slide when we only have 1 image
        if ( images.length == 1) {
            clearInterval(slideshow.interval);
            return;
        }
        
        // Calculate the new image key
        if ( currentIndex < (images.length - 1) ) {
            var nextIndex = currentIndex + 1;
        } else {
            var nextIndex = 0;
        }

        // Fade the old image out
        $(images[currentIndex]).fadeOut(1500);

        // Fade the new image in
        $(images[nextIndex]).fadeIn(1500, function() {
            currentIndex = nextIndex;
        });
    }
    
}
$(setupGallery);


function setupItemHover(e) {
    var state = false;
    $('#slideshow ul.menu li')
        .mouseenter(function(e) {
            if (!state) {
                state = true;
                $(this).addClass('active');
                $(this).find('.panel').show("slide", { direction: "down" }, 800);
            }
        })
        .mouseleave(function(e) {
            if (state) {
                state = false;
                $(this).removeClass('active');
                $(this).find('.panel').stop(true, true).hide();
            }
        });
}
$(setupItemHover);


function resetTable(e) {
    var table = $('table#ctl00_Zone1 tbody tr td > table');
    table.attr('cellpadding', '0');
}
$(resetTable);
