(function($) { // 2009 Hubsoft.com && SebringCreative.com (written by Jason Sebring, mail@jasonsebring.com) - Dual licensed under the MIT and GPL licenses.
	$.fn.dumbCrossFade = function(settings) {
		var config = {'index':0,'showTime':5000,'transitionTime':1000,'doHoverPause':false, 'maxZIndex':100};
		var timeOut = null;
		var itemArray = [];
		var blockAnimation = false;
		var lastIndexRequest = -1;

		function cancelCrossFade() {
			if (timeOut !== null) { window.clearTimeout(timeOut); timeOut = null; }
		}

		function doCrossFadeNow() {
			if (blockAnimation) {
				if (arguments.length > 0) {
					lastIndexRequest = arguments[0];
				}
				return;
			}
			var currentIndex = config.index;
			var nextIndex = (arguments.length > 0) ? arguments[0] : (config.index >= itemArray.length - 1) ? 0 : config.index + 1;
			if (currentIndex == nextIndex) { return; }
			itemArray[currentIndex].css('z-index',(config.maxZIndex-1)+'');
			itemArray[nextIndex].css('z-index',config.maxZIndex+'');
			blockAnimation = true;
			itemArray[nextIndex].fadeIn(config.transitionTime, function() {
				itemArray[currentIndex].hide();
				blockAnimation = false;
				if (lastIndexRequest != -1) {
					doCrossFadeNow(lastIndexRequest);
					lastIndexRequest = -1;
				}
			});
			config.index = nextIndex;
		}

		function doCrossFade() {
			cancelCrossFade();
			timeOut = window.setTimeout(function() {
				doCrossFadeNow();
				doCrossFade();
			},config.showTime);
		}
		
		this.each(function() {
			(itemArray.length === config.index) ? $(this).show() : $(this).hide();
			itemArray[itemArray.length] = $(this);
		});
		doCrossFade();
	};
})(jQuery);