
function mycarousel_initCallback(carousel)
{
    // Navigation liens carousel
    jQuery('.car_depotventeauto').bind('click', function() {
        carousel.scroll(1);
        carousel.startAuto(0);
        return false;

    });        
        jQuery('.car_achat').bind('click', function() {
        carousel.scroll(2);
        carousel.startAuto(0);
        return false;    
    });     
        jQuery('.car_reprise').bind('click', function() {
        carousel.scroll(3);
        carousel.startAuto(0);    
        return false;
    });
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

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

    // 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('#mycarousel').jcarousel({
        auto: 10,
        wrap: 'last',
        scroll: 1,
        initCallback: mycarousel_initCallback,
        itemVisibleInCallback: {
            onBeforeAnimation: function (carousel, liObject, index) {
                $('#subcarousel h4.item-' + index).addClass('carouselbacknav');
            }
        },
        itemVisibleOutCallback: {
            onBeforeAnimation: function (carousel, liObject, index) {
                $('#subcarousel h4.item-' + index).removeClass('carouselbacknav');
            }
        }
    });
    
    jQuery('.annonce', '#annonciste').bind('click', function ()
    {
        window.location.href = jQuery('#voirplusdannonces').attr('href');
    });
});

