$(document).ready(function(){
	jQuery(function($) {
			$.setScrollableRootHeight = function(api, index, method) {
			method = method || "animate";
			var item = api.getItems().eq(index),
			root = api.getRoot();
			root.stop()[method]({ height: item.height() });
		}
		$.fn.autoheight = function() {
			return this.each(function() {
				var api = $(this).data("scrollable");
				api.onSeek(function(e, index) {
					$.setScrollableRootHeight(api, index);
				}); 
				$(window).load(function() {
					$.setScrollableRootHeight(api, 0, "css");
					api.seekTo(0, 0);
				});
			});
		};    
	});

	var onLastSlide = false;
	jQuery(function() {
		$.easing.custom = function (x, t, b, c, d) {
			if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
			return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
		}
		$("#gallery_panes").scrollable({ easing: 'custom', speed: 'slow', disabledClass: 'disable'}).navigator({ navi: "#gallery_buttons"}).autoheight();
	});
});	
