function defiler($this , options){
    var defaults = {
	child    : 'li' ,
	duration : 1000
    }
    var opts = $.extend(defaults, options);
    var nbLi  = 0;
    var numLi = -1;
    $this.find(opts.child).each(function(){$(this).css('display' , 'none');nbLi++;});
    $this.find(opts.child).eq(0).css('display' , '');
    $this.next = function(){
	$this.find(opts.child).eq(numLi).fadeOut(1000 , function(){
	    if(numLi == nbLi - 1){
		numLi = -1;
	    }
	    numLi++;
	    $this.find(opts.child).eq(numLi).fadeIn();
	    setTimeout(function(){
		$this.next();
	    }, opts.duration);
	});
    }
    $this.next();
}

function defiler_img($this , options){
    var defaults = {
		duration : 1000
    };
    var opts = $.extend(defaults, options);
	var imgs = [];
	var _width  = 0;
	var _height = 0;
    var nbImg   = 0;
    var numImg  = -1;
	$this.find('img').each(function(){
		nbImg++;
		imgs.push($(this).attr('src'));
		if($(this).width()  > _width)  {_width  = $(this).width();}
		if($(this).height() > _height) {_height = $(this).height();}
	});
	$this.html('');
	var $table = $('<table></table>');
	var $tr    = $('<tr></tr>');
	var $td    = $('<td style="width: ' + (_width + 10) + 'px;height: ' + (_height + 10) + 'px;text-align:center;"></td>');
	$td.appendTo($tr);
	$tr.appendTo($table);
	//var $div = $('<div style="width: ' + (_width + 10) + 'px;height: ' + (_height + 10) + 'px;border:1px black solid;padding:10px;text-align:center;"></div>');
	var $img = $('<img alt="" src="' + imgs[0] + '" style="border:1px black solid;" />');
	$img.appendTo($td);
	$table.appendTo($this);
    $this.next = function(){
		$img.fadeOut(1000 , function(){
			if(numImg == nbImg - 1){
				numImg = -1;
			}
			numImg++;
			$img.attr('src' , imgs[numImg]);
			$img.fadeIn();
			setTimeout(function(){
				$this.next();
			}, opts.duration);
		});
	};
    $this.next();
}

