function mycarousel_initCallback(carousel) {
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

$(document).ready(function(){
    
    $('#splash-rotator .menu li').click(function() {
    	$('#splash-rotator .menu li').each(function() {
    		$(this).removeClass('on');
    	});
    	$(this).addClass('on');
    	if(!$(this).parents('.item').hasClass('select')) {
    		$(this).parents('.item').addClass('select');
    		$(this).parents('.item').siblings().removeClass('select');
    	}
    });

    $('#rotator-menu-achats').click(function(){ 
    	$('#splash-rotator .rotation-wrap').animate({ top: 0 }, { "duration": "slow", "easing": "swing" });
    });				
    $('#rotator-menu-revendre').click(function(){ 
    	$('#splash-rotator .rotation-wrap').animate({ top: "-340px" }, { "duration": "slow", "easing": "swing" });
    });				
    $('#rotator-menu-animer').click(function(){ 
    	$('#splash-rotator .rotation-wrap').animate({ top: "-680px" }, { "duration": "slow", "easing": "swing" });
    });				
    $('#rotator-menu-cadeaux').click(function(){ 
    	$('#splash-rotator .rotation-wrap').animate({ top: "-1020px" }, { "duration": "slow", "easing": "swing" });
    });				

    $('#home-carousel').jcarousel({
        auto: 2,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });
    $('#cadeaux-carousel').jcarousel({
        auto: 2,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });

});	

