jQuery(document).ready( function( $){
    
    
    function mycarousel_initCallback(carousel)
    {
        // Disable autoscrolling if the user clicks the prev or next button.
        carousel.buttonNext.bind( 'click', function() {
            carousel.startAuto();
        });
        carousel.buttonPrev.bind( 'click', function() {
            carousel.startAuto();
        });
        $( '#cboxOverlay, #colorbox').hover(function() {
            carousel.stopAuto();
        }, function() {
            carousel.startAuto();
        });
        
        // Pause autoscrolling if the user moves with the cursor over the clip.
        carousel.clip.hover(function() {
            carousel.stopAuto();
        }, function() {
            carousel.startAuto();
        });
    };
    
    
    $( '.mycarousel').jcarousel({
        animation: 3000,
        auto: 5,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });
    
    
    $( '.colorbox-img').each( function(){
        $( ".colorbox-img").colorbox({
            maxWidth : '800px',
            opacity: 0.3,
            close  : '閉じる',
            current: "画像 {current} / {total}"
        });
    });
    
});
