//// JavaScript Image slideshow// Patrick Fitzgerald, fitz@csicop.org// This code can be found on the following web page:// http://www.csicop.org/~fitz/www/slideshow///// This first SCRIPT section belongs in the HEAD section of your HTML file.//function slideshow( slideshowname, image )//// Constructor function for the slideshow object.// this.name = the name of your new object,// this.image = an image object// this.timeout = an integer (milliseconds)//{  // Public  this.name = slideshowname  this.image = image  // image object, like document.images.imagename  this.timeout = 5000 // default, milliseconds  // These are private  this.images = new Array()  this.links = new Array()  this.current = 0  this.timeoutid = 0  // Public methods  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.hotlink = slideshow_goto  // Private methods  this.loop = slideshow_loop  this.valid_image = slideshow_valid_image}function slideshow_add_slide(image_url,link_url){  // If this version of JavaScript does not allow us to  // change images, then we can't do the slideshow.  if (!document.images)    return  var i = this.images.length;  this.images[i] = new Image()  this.images[i].src = image_url  this.links[i] = link_url}function slideshow_set_image( imageobject ){  // If this version of JavaScript does not allow us to  // change images, then we can't do the slideshow.  if (!document.images)    return  // Set the "image" property of the slideshow object.  this.image = imageobject}function slideshow_valid_image()// Returns 1 if a valid image has been set for the slideshow{  if (!this.image)  {    // Stop the slideshow    this.pause    // Display an error message    window.status = "Error: slideshow image not initialized for " + this.name            return 0  }  else    return 1}function slideshow_goto(){  location.href = this.links[ this.current ]}function slideshow_next( ){  if (! this.valid_image()) return;  // Increment the image number  if (this.current < this.images.length - 1)    this.current++  else    this.current = 0  // Change the image.  this.image.src = this.images[ this.current ].src}function slideshow_previous( ){  if (! this.valid_image()) return;  // Decrement the image number  if (this.current > 0)    this.current--  else    this.current = this.images.length - 1  // Change the image.  this.image.src = this.images[ this.current ].src}function slideshow_loop( ){  // Go to the next image  this.next( )  // Keep playing the slideshow  this.play( )}function slideshow_play( ){  // Set a timeout, then exit this function.  // After the timeout the function will be called again.  this.timeoutid = setTimeout( this.name + ".loop()", this.timeout)}function slideshow_pause( ){  if (this.timeoutid != 0)  {    clearTimeout(this.timeoutid)    this.timeoutid = 0  }}