	
	(function($) {
		
			$.fn.artAnimation = function(options) { 
				var defaults = {
					speed: 			5000,
					fadeSpeed: 		1000,
					activeImage:	0,
					imageCount:		0,
					TO:				''
				};	
				
				var options = $.extend(defaults, options);
				var jQueryMatchedObj = this; 
				options.imageCount = jQueryMatchedObj.length;
							
				function start() {
					window.clearTimeout(options.TO);
					options.TO = window.setTimeout(function() { animate() }, options.speed); 
				} 	
				
				function animate() {
					if(options.activeImage+1 < options.imageCount) {
						$(jQueryMatchedObj[options.activeImage+1]).fadeIn(options.fadeSpeed, endAnimation);
					} else {
						$(jQueryMatchedObj[options.imageCount-1]).fadeOut(options.fadeSpeed, endAnimation);
					}
				}
				
				function endAnimation() {
					if(parseInt(options.activeImage) > 0 ) {
						$(jQueryMatchedObj[options.activeImage]).hide(1);
					} 
					
					if(options.activeImage+1 < options.imageCount) {
						options.activeImage++;
					} else {
						options.activeImage = 0;	
					}
					start();
				}
				
				start(jQueryMatchedObj);
			}
	})(jQuery);