﻿
(function(jQuery)
	{

		
		var defaults = {
			interval: 5000,
			transitionDelay: 1000,
			compensateHeight: 0
		}
		
		jQuery.fn.superSimpleSlideShow = function(options) 
		{
			
			jQuery.extend(defaults, options); 
			var slideShowNr = 0;
			
		  	return this.each(
				function()
				{

					var options = jQuery.extend({}, defaults);
					var jRef = jQuery(this);
					var children = jRef.children(); 
					var firstChild = jQuery(children[0]);
			
					jRef.height((firstChild.height() + options.compensateHeight) + "px");
					
					options.currentItem = 0;		
					
					if (children.length > 1)
					{		
						options.intervalRef = setInterval(
							
							function()
							{
								
								var currentChild = jQuery(children[options.currentItem]);
								options.currentItem++;
								if (options.currentItem > children.length - 1) options.currentItem = 0;
								
								var nextChild = jQuery(children[options.currentItem]);
								
								nextChild.fadeIn(options.transitionDelay, 
									function()
									{
										jRef.append(currentChild.hide());
									}
								);
								
							}
							,options.interval + slideShowNr * 400
						);
					}
						
					slideShowNr++;
			  	}
			);
			
		};

	
	}
)
(jQuery);


	
