var options;

(function(jQuery) {
	jQuery.fn.fadecycle = function(options) {
		options = jQuery.extend(jQuery.fn.fadecycle.defaults, jQuery.fn.fadecycle.options);
		
		return this.each(function() {
			current = jQuery(this).find("div:eq(0)");
			t = jQuery(this);
			
			//setInterval(function () {
				showNext(t, current);
			//}, jQuery.fn.fadecycle.options.fadeInterval);
		});
	}
	
	jQuery.fn.fadecycle.defaults = { 
		fadeInterval: 3000
	};
})(jQuery);

function showNext(t,c) {
	t.find("div:visible").hide();

	if ((c == undefined) || (c.next().size() == 0)) {
		c = t.find("div:eq(0)");
	} else {
		c = c.next();
	}

	c.fadeIn("slow", function() {
		setTimeout(function() {
			showNext(t,c);
		}, jQuery.fn.fadecycle.options.fadeInterval);
	});
}