(function($){
$.fn.slideShow = function(options){
    var defaults = {
        pictures: [],
        speed: 'normal',
        timeout: 10000,
        startIndex: 0
    };

    var options = $.extend(defaults, options);

    currentIndex = options.startIndex;

    return this.each(function(){
        var doTransition = function(obj, currentIndex){
            obj.fadeOut(options.speed, function(){
                    obj.css('background-image', "url('" + options.pictures[currentIndex] + "')");
                    obj.fadeIn(options.speed);
                });
        };

        var obj = $(this);

        doTransition(obj, currentIndex); //

        setInterval(function(){
            currentIndex++;
            if(currentIndex >= options.pictures.length){ currentIndex = 0; }

            doTransition(obj, currentIndex);
        }, options.timeout);
    });
};
})(jQuery);
