jQuery( function($) {
	if ($('.referenzen-list-scroll').html() != null) {
		$('.referenzen-list').prepend('<div class="prev"></div><div class="next"></div>').each(function(){
			var li = $(this).find('div.referenzen-list-scroll li');
			if (li.length > 3) {
				//$('.referenzen-list-scroll').height(175);
				$(this).find('.referenzen-list-scroll ul').width((li.size() + 3) * 180);
				$(this).serialScroll({
					target: '.referenzen-list-scroll',
					items: 'li',
					prev: 'div.prev',
					next: 'div.next',
					axis: 'x',
					duration: 500,
					force: true,
					cycle: false,
					step: 3,
				
					onBefore: function(e, elem, $pane, $items, pos){
						e.preventDefault();
						if (this.blur) 
							this.blur();
					}
				});
			} else {
				$(this).find('div.prev').css('cursor','auto');
				$(this).find('div.prev').fadeTo(500, .2);
				$(this).find('div.next').css('cursor','auto');
				$(this).find('div.next').fadeTo(500, .2);
			}
		});
	}
});
