    var imagesSetTop = ['images/slideshow/top/thumb/img1.jpg','images/slideshow/top/thumb/img2.jpg','images/slideshow/top/thumb/img3.jpg', 'images/slideshow/top/thumb/img4.jpg', 'images/slideshow/top/thumb/img5.jpg'];
    var imagesSetMid1 = ['images/slideshow/middle/thumb/img1.jpg','images/slideshow/middle/thumb/img2.jpg','images/slideshow/middle/thumb/img3.jpg','images/slideshow/middle/thumb/img4.jpg','images/slideshow/middle/thumb/img5.jpg'];
    var imagesSetMid2 = ['images/slideshow/middle/thumb/img6.jpg','images/slideshow/middle/thumb/img7.jpg','images/slideshow/middle/thumb/img8.jpg','images/slideshow/middle/thumb/img9.jpg','images/slideshow/middle/thumb/img10.jpg'];
    var imagesSetMid3 = ['images/slideshow/middle/thumb/img11.jpg','images/slideshow/middle/thumb/img12.jpg','images/slideshow/middle/thumb/img13.jpg','images/slideshow/middle/thumb/img14.jpg','images/slideshow/middle/thumb/img15.jpg'];
    var imagesSetBottom = ['images/slideshow/bottom/thumb/img1.jpg','images/slideshow/bottom/thumb/img2.jpg','images/slideshow/bottom/thumb/img3.jpg', 'images/slideshow/bottom/thumb/img4.jpg'];

    var cntTop = imagesSetTop.length;
    var cntMid1 = imagesSetMid1.length;
    var cntMid2 = imagesSetMid2.length;
    var cntMid3 = imagesSetMid3.length;
    var cntBottom = imagesSetBottom.length;

    var fadeTime = 2000; 
    
    jQuery.extend({
	random: function(X) {
	    return Math.floor(X * (Math.random() % 1));
	},
	randomBetween: function(MinV, MaxV) {
	  return MinV + jQuery.random(MaxV - MinV + 1);
	}
    });

    
    jQuery.preloadImages = function()
    {
      for(var i = 0; i<arguments.length; i++)
      {
        jQuery("<img>").attr("src", arguments[i]);
      }
    }
    
    $.preloadImages(imagesSetTop);    
    $.preloadImages(imagesSetMid1);
    $.preloadImages(imagesSetMid2);
    $.preloadImages(imagesSetMid3);
    $.preloadImages(imagesSetBottom);     
          
    var i = 1; 
    var slideNum = 1;                                                  
    $(function() {  
        Slider();            
    });                                           
                                                         
    function Slider() {  
        while (i == slideNum) {
            i = $.randomBetween(1,5);   
        }
        slideNum = i;
        switch (slideNum) {
            case 1: $('#slideshowTop').fadeOut(fadeTime, function() {  
                    $(this).attr('src', imagesSetTop[(++imagesSetTop.length) % cntTop]).fadeIn(fadeTime,Slider);
                    }); 
                    break;
                    
            case 2: $('#slideshowMid1').fadeOut(fadeTime, function() {  
                    $(this).attr('src', imagesSetMid1[(++imagesSetMid1.length) % cntMid1]).fadeIn(fadeTime,Slider);
                    });
                    break; 
                            
            case 3: $('#slideshowMid2').fadeOut(fadeTime, function() {     
                    $(this).attr('src', imagesSetMid2[(++imagesSetMid2.length) % cntMid2]).fadeIn(fadeTime,Slider);
                    });
                    break; 
                            
            case 4: $('#slideshowMid3').fadeOut(fadeTime, function() {     
                    $(this).attr('src', imagesSetMid3[(++imagesSetMid3.length) % cntMid3]).fadeIn(fadeTime,Slider);
                    }); 
                    break;
                             
            case 5: $('#slideshowBottom').fadeOut(fadeTime, function() {     
                    $(this).attr('src', imagesSetBottom[(++imagesSetBottom.length) % cntBottom]).fadeIn(fadeTime,Slider);
                    }); 
                    break;     
        } 
    }                    