function mycarousel_initCallback(carousel)
{
    jQuery('#carouselNav li').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        return false;
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

jQuery(document).ready(function() {
    jQuery('#carousel').jcarousel({
        auto: 5,
		scroll: 1,
		animation: 1000,
        wrap: 'null',
        initCallback: mycarousel_initCallback,
		
		// This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null,
		itemVisibleInCallback: {
         onBeforeAnimation: function(c, o, i, s) {
		   //Makes carousel nav active
           $('#carouselNav li').removeClass('active');
           $('#carouselNav li:eq('+(i-1)+')').addClass('active');
		   //Makes banner active
		   $('#carousel li').removeClass('active');
           $('#carousel li:eq('+(i-1)+')').addClass('active');
         }
		}
    });
});
