(function($) {
	$(document).ready(function() {
		$('#horizontal-carousel').show().jcarousel({
			auto: 7,
			wrap: 'circular',
			scroll: 1,
			easing: 'swing',
			initCallback: function (carousel) {
				// Disable autoscrolling if the user clicks the prev or next button.
			    carousel.buttonNext.bind('click', function() {
			        carousel.stopAuto();
			        carousel.startAuto();
			    });
				
			    carousel.buttonPrev.bind('click', function() {
			        carousel.stopAuto();
			        carousel.startAuto();
			    });
				
			    // Pause autoscrolling if the user moves with the cursor over the clip.
			    carousel.clip.hover(function() {
			        carousel.stopAuto();
			    }, function() {
			        carousel.startAuto();
			    });
			    
			    // redirect to the link if the user clicks the li
			    $(carousel.list).find('li').click(function () {
			    	var link = $(this).find('a');
			    	if (link.length) {
			    		window.location.href = link.attr('href');
			    	}
			    	return false;
			    });
			},
			buttonPrevHTML: '<div class="carousel-hor-lft"><a title="Links scrollen" class="" href="javascript:void(0);"></a></div>',
			buttonNextHTML: '<div class="carousel-hor-rgt"><a title="Rechts scrollen" class="" href="javascript:void(0);"></a></div>'
		});
	});
})(jQuery);
