$(document).ready(function() {
    var carousel = $('.carousel');

    carousel._TMS({
        items           : '.images li',
        pagination      : false,
        playBlock       : true,
        slideShow       : 6000,
        progressBar     : false,
        banners         : false,
        playBu          : '.play',
        prevBu          : '.prev',
        nextBu          : '.next',
        pauseOnHover    : false,
        numStatus       : false,
        bannerMeth      : 'custom',
        reverseWay      : false,
        duration        : 400,
        interval        : 40,
        blocksX         : 7,
        blocksY         : 4,
        easing          : 'easeInQuad',
        way             : 'diagonal',
        anim            : 'expand',
        preset          : 'diagonalExpand',
        beforeAnimation : function () {
            banner = $('.banners').find('li').eq(carousel._TMS.current - 1);

            if (banner) {
                banner.stop().animate({ bottom: -100 }, 500, 'easeInBack');
            }
        },
        afterAnimation  : function () {
            banner = $('.banners').find('li').eq(carousel._TMS.current + 0);

            if (banner) {
                $('div.carousel > a.overall').attr('href', banner.find('a:first').attr('href'));
                banner.animate({ bottom: 0 }, 0).hide().fadeIn(1000);
            }
        }
    });
    
    $("#showroom").jcarousel({
        auto: 3,
        wrap: 'last',
        scroll: 2,
        animation: 'slow',
        initCallback: function(carousel) {
            carousel.clip.hover(function() {
                carousel.stopAuto();
            }, function() {
                carousel.startAuto();
            });
        }
    });
});

