
function topshow( slideshowname, image )

{

  this.name = slideshowname;
  this.image = image;
  this.timeout = 6000;


  this.images = new Array();
  this.links = new Array();
  this.current = 0;
  this.timeoutid = 0;

  this.add_slide = slideshow_add_slide;
  this.set_image = slideshow_set_image;

  this.play = slideshow_play;
  this.pause = slideshow_pause;

  this.next = slideshow_next;
  this.previous = slideshow_previous;

  this.loop = slideshow_loop;
  this.valid_image = slideshow_valid_image;
}


function slideshow_add_slide(image_url)
{

  if (!document.images)
    return

  var i = this.images.length;

  this.images[i] = new Image();
  this.images[i].src = image_url;

}


function slideshow_set_image( imageobject )
{

  if (!document.images)
    return;

  this.image = imageobject;

}


function slideshow_valid_image()

{
  if (!this.image)
  {
    this.pause

    window.status = "Error: slideshow image not initialized for " + this.name

    return 0;
  }
  else
    return 1;
}


function slideshow_next( )
{
  if (! this.valid_image()) return;

  if (this.current < this.images.length - 1)
    this.current++;
  else
    this.current = 0;


if(document.all){
  this.image.filters.blendTrans.apply()
  }
  
   if (this.image.src.loaded = true)
  this.image.src = this.images[ this.current ].src;
   else
      return;
  
  if (document.all){
  this.image.filters.blendTrans.play();
}


/*if (overImages == 1){
var strImage = this.images[ this.current ].src

if (strImage.indexOf("bhs")>0) {
document.images.bhs.src = "images/bhs_on.gif";
document.images.silverne.src = "images/silverne.gif";
}

else if (strImage.indexOf("silverne")>0) {
document.images.bhs.src = "images/bhs.gif";
document.images.silverne.src = "images/silverne_on.gif";
}

else {
document.images.bhs.src = "images/bhs.gif";
document.images.silverne.src = "images/silverne.gif";

}

}*/

}


function slideshow_previous( )
{
  if (! this.valid_image()) return;

  if (this.current > 0)
    this.current--;
  else
    this.current = this.images.length - 1;

  this.image.src = this.images[ this.current ].src;
}


function slideshow_loop( )
{

  this.next( )

  this.play( )
}

function slideshow_play( )
{

  this.timeoutid = setTimeout( this.name + ".loop()", this.timeout)
}

function slideshow_pause( )
{
  if (this.timeoutid != 0)
  {
    clearTimeout(this.timeoutid)
    this.timeoutid = 0
  }
}

