(function($)
{
    $.fn.slideShowLeft = function(img)
    {
        tabLeft = img.valueOf();
        
        // Méthode qui fait le slideShow
        function initSlide(container)
        {
            setInterval( function(){
                if (currLeft == tabLeft.length) {
                    currLeft = 0;
                }
                
                var images = new Image();

                $(images).load(function(){
                    $(container).append(this);
                    $(container).find('img:first').css({'z-index': 1});
                    $(this).css({opacity: 0.0, 'z-index': 2}).animate({opacity: 1.0}, 3000, function() {
                            $(container).find('img:first').remove();
                        })
                }).attr('src', tabLeft[currLeft++]).css({position:'absolute',top:0,left:0,'z-index':8});
            }, 4000);
        }
        
        var imageJ = new Image();
		var container = this;
        
		$(imageJ).attr('src', tabLeft[0]).css({'position':'relative','top':0,'left':0,'z-index':0}).load(function(){
			initSlide(container);
		});
    };
    
    
    $.fn.slideShowRight = function(img)
    {
        tabRight = img.valueOf();
        
        // Méthode qui fait le slideShow
        function initSlide(container)
        {
            setInterval( function(){
                if (currRight == tabRight.length) {
                    currRight = 0;
                }
                
                var images = new Image();

                $(images).load(function(){
                    $(container).append(this);
                    $(container).find('img:first').css({'z-index': 1});
                    $(this).css({opacity: 0.0, 'z-index': 2}).animate({opacity: 1.0}, 3000, function() {
                            $(container).find('img:first').remove();
                        })
                }).attr('src', tabRight[currRight++]).css({position:'absolute',top:0,left:0,'z-index':8});
            }, 4000);
        }
        
        var imageJ = new Image();
		var container = this;
        
		$(imageJ).attr('src', tabRight[0]).css({'position':'relative','top':0,'left':0,'z-index':0}).load(function(){
			initSlide(container);
		});
    };
})(jQuery);
