// Easing equation, borrowed from jQuery easing plugin
// http://gsgd.co.uk/sandbox/jquery/easing/
jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

jQuery(function( $ ){
	//hide the navigation
	$('img.jFlowPrev').fadeTo("slow", 0);
	$('img.jFlowNext').fadeTo("slow", 0);
	
	//setup the slideshow
	$('#slideshow_wrap').serialScroll({
		items:'span.center',
		prev:'#prevNext img.jFlowPrev',
		next:'#prevNext img.jFlowNext',
		offset:-458,
		//start:1,
		duration:700,
		force:true,
		stop:true,
		lock:false,
		lazy:true,
		interval:4000,
		//cycle:false, //don't pull back once you reach the end
		easing:'easeOutQuart', //use this easing equation for a funny effect
		jump: true
	});
	
	//hover slideshow functionality
	$('#prevNext').hover(function(){
			$('#slideshow_wrap').trigger( 'stop' );
			$('img.jFlowPrev').fadeTo("slow", 1);
			$('img.jFlowNext').fadeTo("slow", 1);
		}, function(){
			$('img.jFlowPrev').fadeTo("slow", 0);
			$('img.jFlowNext').fadeTo("slow", 0, startSlideshow);
	});

	//pricing slider
	$('#prices_wrap').serialScroll({
		items:'div.price',
		next:'#Price_prevNext img.priceNext',
		//offset:-458,
		//start:1,
		duration:700,
		force:true,
		stop:true,
		lock:false,
		easing:'easeOutQuart', //use this easing equation for a funny effect
	});
});

function startSlideshow() {
	$('#slideshow_wrap').trigger( 'start' );	
}
