(function($){
$.fn.rotator = function(options) {
var opts = $.extend({}, $.fn.rotator.defaults, options);
return this.each(function(){
path = opts.path;
images = opts.images;
image = $(this).children('img');
othis = $(this);
setInterval("rotate(path,images,othis)", opts.time);
});
}
rotate = function (path,images,othis){
image = othis.children('img');
for(var i = 0; i<images.length; i++){
$src = path + images[i];
if ($src == image.attr('src')){
if (i+1 == images.length) var g = 0;
else var g = i+1;
$newsrc = path + images[g];
}
}
var i = new Image(); 
         $(i).load(function(){
                $('#image_holder').prepend(i);
                $('#image_holder img:last').fadeOut(2500, function(){$(this).remove()});
                }).attr('src', $newsrc);
}
$.fn.rotator.defaults = {
 path: '/images/slideshow/',
 time: '5000',
 images: ['1.jpg','2.jpg','3.jpg','4.jpg','5.jpg','6.jpg','7.jpg']
};
})(jQuery);
