// 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;
};

/********************************************
Snippet for jQuery.SerialScroll
--Manipulate SerialScroll with the keyboard--

Note that this also applies to the mouse,
just trigger prev or next whenever you want
*********************************************/

jQuery(function( $ ){
	var $pane = $('#slideshow');//let's save it, the element being scrolled
	
	
	$pane.serialScroll({
	items:'li',
		prev:'div.previous_button',
		next:'div.next_button',
		offset:-55, //when scrolling to photo, stop 230 before reaching it (from the left)
		start:1, //as we are centering it, start at the 2nd
		duration:1000,
		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 
		
		
	});
	
	 $(document).keyup(function(e){
        switch( e.keyCode ){
        	case 39://right (->)
        		$pane.trigger('next');
        	break;
        	case 37://left (<-)
        		$pane.trigger('prev');
        	break;
			case 38://up 
				$pane.trigger(".next_job");
	    	break;
			case 40://down
				$pane.trigger(".previous_job");
			break;
        }
    });
	
});



/************************************************
If you want to use up and down:
- use 38(up), and 40(down).

To see other keyCodes, check: http://rurl.org/pdl
*************************************************/

