// slide horyzontalny
$.easing.easeOutQuart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

jQuery(document).ready(function($){		
	$('#slideshow .imgDescription:not(:first)').hide().children().fadeOut();
	$('#slideshow .imgDescription:first').animate({width:"250px"}, 200).addClass('open');

	$('#slideshow li').click(function(){
		var current = $(this);
		if(current.find('.open').length === 0){
			current.parent().find('.open').removeClass('open').hide(200).children().fadeOut();
			current.find('.imgDescription').animate({width:"250px"}, 200,
				function(){
					var $this = $(this);
					$this.children().fadeIn("slow");
					$this.addClass("open");
				}
			);
		};
	});

	var sizeA = jQuery('#filmsBox > div > a.video_mini').size();
	var sizeBox = sizeA * 142;
	sizeBox = sizeBox+"px";
	jQuery('#filmsBox > div').css({width: sizeBox});

	jQuery('#filmsBox').serialScroll({
		items:'a.video_mini',
		prev:'#arrLeftFilm',
		next:'#arrRightFilm',
		axis:'x',
		offset:0, //when scrolling to photo, stop 10 before reaching it (from the left)
		start:0, //as we are centering it, start at the 2nd
		duration:1200,
		force:true,
		stop:true,
		lock:false,
		cycle:false, //don't pull back once you reach the end
		easing:'easeOutQuart', //use this easing equation for a funny effect
		jump: false //click on the images to scroll to them
	});	
});
