
$(document).ready(function(){

// custom easing called "custom"
$.easing.custom = function (x, t, b, c, d) {
	var s = 1.70158; 
	if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
	return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
}


// main vertical scroll
var api=$("#main").scrollable({speed:400,

	// basic settings
	vertical: true,
	
	next: 'disabled',
	prev: 'disabled',

	// up/down keys will always control this scrollable
	keyboard: 'static',
	
	
	// assign left/right keys to the actively viewed scrollable
	onSeek: function(event, i) {
		horizontal.eq(i).data("scrollable").focus();
		
		}

}).navigator("#main_navi");







// horizontal scrollables. each one is circular and has its own navigator instance  
var horizontal = $(".scrollable").scrollable({ 
											size:1,
											
											easing: 'custom', 
											 
											 onBeforeSeek: function() { 
											 this.getItems().fadeTo(200, 0.6);											 
											 this.getItems().filter(":first").fadeTo(200, 1);
											 }, 
											 
											 onSeek: function() { 
											 this.getItems().fadeTo(400, 1); 
											 },

											
											speed: 1800, 
											
											horizontal: true, 
											
											circular: true, 
											
											mousewheel:true }).navigator(".navi");


// when page loads setup keyboard focus on the first horzontal scrollable
horizontal.eq(0).data("scrollable").focus();

	
});


