// JavaScript Document

    var totalitems = 4; // number of total items in your carousel, you can probably detect it with jquery and replace this 

            function mycarousel_initCallback(carousel) {
    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
	    jQuery('.jcarousel-control a').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        return false;
    });
 
    jQuery('.jcarousel-scroll select').bind('change', function() {
        carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value);
        return false;
    });
 
    jQuery('#mycarousel-next').bind('click', function() {
        carousel.next();
        return false;
    });
 
    jQuery('#mycarousel-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        // Configuration goes here
		scroll: 1,
		auto: 5,
		wrap: 'last',
		initCallback: mycarousel_initCallback,
		itemFirstInCallback: function(carousel, item, idx, state) {
        $('.jcarousel-control').removeClass('active').find('.control-' + idx).addClass('active');
		},
		itemLastOutCallback: function(carousel, item, idx, state) {
        $('.jcarousel-control').find('.control-' + idx).removeClass('active');
		},
        buttonNextHTML: null,
        buttonPrevHTML: null	
    });
});
