(function($){
	$.fn.imgFlipper = function(options){


		var opts = $.extend({}, $.fn.imgFlipper.defaults, options);
		return this.each(
			function(){
				
				var $this = $(this);
				
				$this.children().each(function(e){
					var $this = $(this);
					$this.css({
						"display":"none",
						"position":"absolute",
						"top":0,
						"left":0
					})
				});
				$this.children(".active").css({"display":"block"});
				setInterval(function(){
						var $active = $this.children(".active");
						var $next = ($active.next().length > 0) ? $active.next() : $this.children("*:first");
						$active.fadeOut();
						$next.fadeIn(function(){
							$active.removeClass("active");
							$next.fadeIn().addClass("active");
						});
					}, opts.fadeInterval);
			}
		);
	}
	$.fn.imgFlipper.defaults = {
		fadeInterval:4000,
		fadeSpeed:300
	};
})(jQuery);

