function create_slide_show(ele_name,image_array,number_visible){
  return {

    where          : ele_name,
    where_id       : null,
    images         : image_array,
    number_visible : number_visible,
    random         : create_random(),
    preload_array  : new Array(),
    percentage_fade: 5,        // This is the percentage that the image transparency is reduced on each cycle
    ms_between_fade: 65,        // The number of milliseconds between each cycle of fading
    time_after_fade: 14000,        // Once the image is transparent, this is the number of milliseconds to wait before starting another fading cycle
    preload:function(){

      if(this.preload_array.length > 0) return;

      var img;
      for(var i=0;i<this.images.length;i++){
        this.preload_array[i] = new Image(50,50);
        this.preload_array[i].src = this.images[i];
      }
    },
    start : function(){
      var html = "";
      var img_name,span_id,img_id;
      var slide;

      this.where_id = document.getElementById(this.where),

      this.preload();

      // clear out any children that may exist on where_id
      while(this.where_id.childNodes.length != 0) this.where_id.removeChild(this.where_id.childNodes[0]);

      for(var i=0;i < this.number_visible;i++){
        img_name = this.get_random_image();
        span_id = document.createElement("span");
        span_id.style.paddingRight = "2px";
        img_id = document.createElement("img");
        img_id.src = img_name;
        img_id.style.opacity = 1;

        span_id.img_name = img_name;
 
        span_id.appendChild(img_id);

        this.where_id.appendChild(span_id);
      }
      var slots = [];
      for(var i=0;i<this.number_visible;i++){
        slots[i]= i;
      }
      var x,y,z;
      for(var i=0;i<300;i++){
        x = this.random.get_random(this.number_visible); 
        y = this.random.get_random(this.number_visible); 
        z = slots[x];
        slots[x] = slots[y];
        slots[y] = z;
      }
      this.instantiate(0,slots,0);
    },
    instantiate : function(curr,slots,next){
      var fn, me = this; 

      if(curr >= slots.length) return;
      fn = function(){
        var slide = create_slide(me.where_id,slots[curr],me.images);
        slide.fadder = create_fadder(me.percentage_fade,me.ms_between_fade,me.time_after_fade);
        slide.start();
      }
      window.setTimeout(fn,next);
      next = next + 3500;        // Once the image is transparent, this is the number of milliseconds to wait before starting fading of next photo
      this.instantiate(curr+1,slots,next);
    },

    get_random_image : function(){
      if(this.number_visible == this.images.length){
        return this.images[this.random.get_random(this.images.length)];
      }
      var img,b = true;
      while(b){
        b = false;
        img = this.images[this.random.get_random(this.images.length)];
        for(var i=0;i<this.where_id.childNodes.length;i++){
          if(this.where_id.childNodes[i].img_name == img){
            b = true;
            continue;
          }
        }
      }
      return img;
    } 
  }
};

