﻿function rc_carousel_initCallback(carousel) {
    jQuery('#rc-carousel-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#rc-carousel-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 pc_carousel_initCallback(carousel) {
    jQuery('#pc-carousel-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#pc-carousel-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(); }
            );
};

jQuery(document).ready(function() {
    // Initialise the first and second carousel by class selector.
    // Note that they use both the same configuration options (none in this case).
    jQuery('#rc-carousel').jcarousel({
        auto: 5,
        scroll: 1,
        wrap: 'last',
        initCallback: rc_carousel_initCallback,
        buttonNextHTML: null,
        buttonPrevHTML: null
    });

    // If you want to use a caoursel with different configuration options,
    // you have to initialise it seperately.
    // We do it by an id selector here.
    jQuery('#pc-carousel').jcarousel({
        auto: 7,
        scroll: 1,
        wrap: 'last',
        initCallback: pc_carousel_initCallback,
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});
