/**
 * @compagny : Archriss, web agency & ingénérie
 * @website : www.archriss.fr
 * @author : Jean-Philippe RIVET
 * @contact : jprivet@archriss.com
 * @copyriht : Tous droits réservés
 * @purpose : ...
 */

/* *************************************** */
/* RSS défilant */
/* *************************************** */

(function($){
	// exemple pour "options" : {param3: 'param3', param4: 'param4'}
	$.fn.rsscarousel = function(options){
		// A la place de "$(this)" écrire ici "this", ce dernier étant déjà un objet jQuery.
		
		// Paramètres par defaut
		var o = { }
		
		// Maintient de la chainabilité avec "return"
		return this.each(function(){
			
			// Initialisation de this
			var $this = $(this);
			
			// Si les options existent...
			if(options){ 
				// Fusion aux paramètres par défaut
		        $.extend(o, options);
		    }
			
			var tempoStart = function(){
				timeoutID = window.setTimeout(tempoExe, o.speed);
			}
			
			var tempoClear = function(){
				  window.clearTimeout(timeoutID);	
			}
			
			var tempoExe = function(){
				list.eq(current).fadeOut();
				current++;
				if(current >= nbItem) {
					current = 0;
				}
				list.eq(current).fadeIn();
				tempoStart();
			}
			
			
			list = $this.find('.item');
			list.hide();
			nbItem = list.length;
			current = 0;
			list.eq(current).show();
			tempoStart();
			
		});
		
	};
})(jQuery);




