homepage = {
	
	slides : [
		'#tub-slide',
		'#sling-slide',
		'#booti-slide',
		'#tub-slide'
	],
	
	initialize : function() {
		this.scheduleSlide(1);
	},
	
	scheduleSlide : function(index) {
		var that = this;
		setTimeout(function() {
			that.cycleSlide(index);
		}, 5000);
	},
	
	cycleSlide : function(index) {
		var that = this;
		var current = this.slides[index-1];
		var next = this.slides[index];
		$(current).hide("slide", { direction: "right" }, 1000, function() {
			$(next).show("slide", { direction: "right" }, 1000, function() {
				if(index < that.slides.length-1) {
					that.scheduleSlide(index+1);
				}
			});
		});
		
	}
	
};
$(function() {
	homepage.initialize();
});
