(function($){
	
	$.fn.changetexte = function(options) {
		
		var defaults = {
			delay: 3,
			animationSpeed: "normal"
		};
		
		var options = $.extend(defaults, options);
		
		this.each(function(){
			
			var obj = $(this);
			
			if($(obj).find("span").length > 1) {
				
				var inter = setInterval(function(){nextElt(options)}, (options.delay*1000));
				
				$(obj).find("span").hide();
				
				$(obj).find("span:first-child").addClass("active").fadeIn(options.animationSpeed);
					
			}
			
			function nextElt(options){
				
				$(obj).find("span.active").fadeOut(options.animationSpeed, function() {
					
					if(!$(obj).find("span.active").is(":last-child")){
						
						$(obj).find("span.active").next().addClass("active").prev().removeClass("active");
						
						$(obj).find("span.active").fadeIn(options.animationSpeed);
						
					}else{
						
						$(obj).find("span:first-child").addClass("active").fadeIn(options.animationSpeed);
						
						$(obj).find("span:last-child").removeClass("active");
						
					}
				
				});
			
			}
		
		});
		
		return this;
		
	};
	
})(jQuery);
