var api;	


////////////////	
// jQUERY TOOLS - OVERLAY

$(function() {
 
	// if the function argument is given to overlay,
	// it is assumed to be the onBeforeLoad event listener
	$("a[rel]").overlay({
 
		mask: '#f5e9fb',
		effect: 'apple',
 
		onBeforeLoad: function() {
 
			// grab wrapper element inside content
			var wrap = this.getOverlay().find(".contentWrap");
 
			// load the page specified in the trigger
			wrap.load(this.getTrigger().attr("href"));
		}
 
	});
	
	// initialize scrollable
	$(".scrollable").scrollable({size: 1, circular: false, speed: 200});
	
	// access api
	api = $(".scrollable").data("scrollable");

	// do something upon scroll
	api.onSeek(function() {

		// inside callbacks the "this" variable is a reference to the API
		if (api.getIndex() == (api.getItems().length - 3))
		{
			$('.next').addClass('disabled');
		}

});

});


