$(function(){
				
$.easing.elasout = function(x, t, b, c, d) {
	var s=1.70158;var p=0;var a=c;
	if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
	if (a < Math.abs(c)) { a=c; var s=p/4; }
	else var s = p/(2*Math.PI) * Math.asin (c/a);
	return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
};

$.easing.easeOutQuart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

$('#prev_frame_disabled,#next_frame_disabled').hide();
$('#prev_frame').hide();
$('#prev_frame_disabled').show();

$('#pane-target').serialScroll({
		items:'li',
		prev:'#prev_frame',
		next:'#next_frame',
		offset:0, //when scrolling to photo, stop 230 before reaching it (from the left)
		margin: true,
		start:0, //as we are centering it, start at the 2nd
		duration:1000,
		force:false,
		stop:true,
		lock:false,
		lazy: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
		onBefore:function( e, elem, $pane, $items, pos ){

			$('#prev_frame,#next_frame').show();
			$('#prev_frame_disabled,#next_frame_disabled').hide();
			if( pos == 0 ) {
			$('#prev_frame').hide();
			$('#prev_frame_disabled').show();
			}
			else if( pos == $items.length-3 ) {
			$('#next_frame').hide();
			$('#next_frame_disabled').show();
			}

		}
});

$('#prev_frame_disabled2,#next_frame_disabled2').hide();
$('#prev_frame2').hide();
$('#prev_frame_disabled2').show();

$('#pane-target2').serialScroll({
		items:'li',
		prev:'#prev_frame2',
		next:'#next_frame2',
		offset:0, //when scrolling to photo, stop 230 before reaching it (from the left)
		margin: true,
		start:0, //as we are centering it, start at the 2nd
		duration:1000,
		force:false,
		stop:true,
		lock:false,
		lazy: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
		onBefore:function( e, elem, $pane, $items, pos ){

			$('#prev_frame2,#next_frame2').show();
			$('#prev_frame_disabled2,#next_frame_disabled2').hide();
			if( pos == 0 ) {
			$('#prev_frame2').hide();
			$('#prev_frame_disabled2').show();
			}
			else if( pos == $items.length-3 ) {
			$('#next_frame2').hide();
			$('#next_frame_disabled2').show();
			}

		}
});

$('#prev_frame_disabled3,#next_frame_disabled3').hide();
$('#prev_frame3').hide();
$('#prev_frame_disabled3').show();

$('#pane-target3').serialScroll({
		items:'li',
		prev:'#prev_frame3',
		next:'#next_frame3',
		offset:0, //when scrolling to photo, stop 230 before reaching it (from the left)
		margin: true,
		start:0, //as we are centering it, start at the 2nd
		duration:1000,
		force:false,
		stop:true,
		lock:false,
		lazy:false,
		axis:'y',
		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
		onBefore:function( e, elem, $pane, $items, pos ){

			$('#prev_frame3,#next_frame3').show();
			$('#prev_frame_disabled3,#next_frame_disabled3').hide();
			if( pos == 0 ) {
			$('#prev_frame3').hide();
			$('#prev_frame_disabled3').show();
			}
			else if( pos == $items.length-3 ) {
			$('#next_frame3').hide();
			$('#next_frame_disabled3').show();
			}

		}
});

$('#prev_frame_disabled4,#next_frame_disabled4').hide();
$('#prev_frame4').hide();
$('#prev_frame_disabled4').show();

$('#pane-target4').serialScroll({
		items:'li',
		prev:'#prev_frame4',
		next:'#next_frame4',
		offset:0, //when scrolling to photo, stop 230 before reaching it (from the left)
		margin: true,
		start:0, //as we are centering it, start at the 2nd
		duration:1000,
		force:false,
		stop:true,
		lock:false,
		lazy:false,
		axis:'y',
		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
		onBefore:function( e, elem, $pane, $items, pos ){

			$('#prev_frame4,#next_frame4').show();
			$('#prev_frame_disabled4,#next_frame_disabled4').hide();
			if( pos == 0 ) {
			$('#prev_frame4').hide();
			$('#prev_frame_disabled4').show();
			}
			else if( pos == $items.length-3 ) {
			$('#next_frame4').hide();
			$('#next_frame_disabled4').show();
			}

		}
});

});

/*
var str="";
for(prop in $items) {
str+=prop + " value :"+ $items[prop]+"\n";//Concate prop and its value from object
}
alert(str);
*/
//alert(pos);