function mycarousel_itemVisibleInCallback(carousel, item, idx, state) {

	$(".jcarousel-control-btn").css("background-color", "#666");
	
	var txt = "#btn"+idx;
	$(txt).css("background-color", "#F00");
}

function mycarousel_initCallback(carousel) {
    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;
    });
	
	// Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

$(function() { 
	$('#brandCarousel').jcarousel({ scroll: 1, wrap: "both" }); 
	$('#mainImage').jcarousel({ 
		auto: 5, 
		wrap: "both", 
		scroll: 1,
		initCallback: mycarousel_initCallback,
        itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
		buttonNextHTML: null,
		buttonPrevHTML: null
	}); 
});
