/*
 * zur Info:
 * 
 * es muss den Images als CSS-Attribut eine feste breite gegeben werden, sonst ist die Darstellung im Chrome fehlerhaft
 * 
 */

function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(5);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(5);
    });

    // 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() {
	
	var agent = navigator.userAgent.toLowerCase(); 
	if( agent.search(/chrome/) != -1 || agent.search(/safari/) != -1 ){
		 jQuery('#book-carousel').jcarousel({
			animation: 1500,
			auto: 4,
			wrap: "last",
			scroll: 1,
			initCallback: mycarousel_initCallback
	    });
	}
    else{
		 jQuery('#book-carousel').jcarousel({
			animation: 1500,
			auto: 4,
			wrap: "circular",
			scroll: 1,
			initCallback: mycarousel_initCallback
	    });
	}
});;

