(function($){
	$.fn.start_diapo = function(photo_array,time,speed,pos,repeat){
		
		var Objs = this;
		if(typeof(time) == 'undefined') time = 5000;
		if(typeof(speed) == 'undefined') speed = 'fast';
		if(typeof(pos) == 'undefined') pos = 'top left';
		if(typeof(repeat) == 'undefined') repeat = 'no-repeat';
		var i = 0;
		
		function _change_bg(Objs){
			Objs.each(function(){
				var Obj = $(this);
				Obj.fadeOut(speed, function(){
					if(i >= photo_array.length) i = 0;
					Obj.css('background-image','url('+photo_array[i]+')');
					Obj.css('background-position',pos);
					Obj.css('background-repeat',repeat);
					Obj.fadeIn(speed);
					i++;
				});
			});
		}
		_change_bg(Objs);
		
		var timer = setInterval(function(){
			
			_change_bg(Objs);
			
		}, time);
	};
})(jQuery);

