$(document).ready(function() {
 $("a.lightbox").fancybox();

$.scrollTo.defaults.axis = 'x'; 
//this one is important, many browsers don't reset scroll on refreshes
$('div.pane').scrollTo( 0 );//reset all scrollable panes to (0,0)
$.scrollTo( 0 );//reset the screen to (0,0)

//Target examples bindings
var $paneTarget = $('div.outer');
var speed = 600;
var itemWidth = 245;

$('div.outer ul').css("width", ($('div.outer ul li').length * itemWidth));
$('div.outer').css("width", 3 * itemWidth).serialScroll({
 items:'li',
 prev:'a.prev',
 next:'a.next',
 exclude:2,
 duration:speed,
 force:true,
 stop:true,
// lock:true, //if true(default), the plugin will ignore events if already animating. Then animations can't be queued.
 cycle:true,
 constant:false
// interval: 1,
// easing:'linear',
// duration:3000
});

 // -- add keyboard support to serial scroll --
 $(document).keyup(function(e){
        switch( e.keyCode ){
        	case 39://right (->)
        		$paneTarget.trigger('next');
        	break;
        	case 37://left (<-)
        		$paneTarget.trigger('prev');
        	break;
        }
 });

// -- Stop the auto-scrolling when hovering -- 
// You can temove the .stop() to let it finish the active animation
/*
 $paneTarget.hover(function(){
	$(this).stop().trigger('stop');
 },function(){
	$(this).stop().trigger('start');
 });
*/

 // -- nice fade hoover effect on menu --
 $('#menu a')
	.css( {backgroundPosition: "0 0"} )
	.mouseover(function(){
		 $(this).stop().animate({backgroundPosition:"(0 -250px)"}, {duration:400})
	})	
	.mouseout(function(){
		$(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:600})
 })

}); 