function MM_preloadImages() { //v3.0
	var d=document;
	if(d.images){
		if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
		for(i=0; i<a.length; i++)
    		if (a[i].indexOf("#")!=0){
				d.MM_p[j]=new Image;
				d.MM_p[j++].src=a[i];
			}
	}
}

function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr;
	for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
	var p,i,x;
	if(!d) d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
    	d=parent.frames[n.substring(p+1)].document;
		n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) x=d.all[n];
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n);
		return x;
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments;
	document.MM_sr=new Array;
	for(i=0;i<(a.length-2);i+=3)
		if ((x=MM_findObj(a[i]))!=null){
			document.MM_sr[j++]=x;
			if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];
		}
}

<!--

/*==================================================*
 $Id: slideshow.js,v 1.16 2003/10/14 12:39:00 pat Exp $
 Copyright 2000-2003 Patrick Fitzgerald
 http://slideshow.barelyfitz.com/

 This program is free software;
 *==================================================*/

// There are two objects defined in this file:
// "slide" - contains all the information for a single slide
// "slideshow" - consists of multiple slide objects and runs the slideshow

//==================================================
// slide object
//==================================================
function slide(src,link,text,target,attr) {        // This constructor for the slide object.

  this.src = src;                                   // Image URL
  this.link = link;                                 // Link URL
  this.text = text;                                 // Text to display
  this.target = target;                             // Name of the target window ("_blank")

  // this.timeout = 3000               // Custom duration of slide, in milliseconds, optional parameter.
  // width=n,height=n,resizable=yes or no,scrollbars=yes or no,           // Attributes for the target window:
  // toolbar=yes or no,location=yes or no,directories=yes or no,
  // status=yes or no,menubar=yes or no,copyhistory=yes or no              // Example: "width=200,height=300"

  this.attr = attr;

  if (document.images) {                               // Create an image object for the slide
    this.image = new Image();
  }

  this.loaded = false;                                 // Flag to tell when load() has already been called

  //-------------------------------------------------- // This method loads the image for the slide
  this.load = function() {                     

    if (!document.images) { return; }

    if (!this.loaded) {
      this.image.src = this.src;
      this.loaded = true;
    }
  }

  //--------------------------------------------------// This method jumps to the slide's link.
  this.hotlink = function() {
                      
    var mywindow;                                     // If a window was specified for the slide, then it opens a new window.

    if (!this.link) return;                           // If this slide does not have a link, do nothing

    if (this.target) {                                // Open the link in a separate window?
      if (this.attr) {                                // If window attributes are specified, use them
        mywindow = window.open(this.link, this.target, this.attr);
      } else {
        mywindow = window.open(this.link, this.target);                // If window attributes are not specified, do not use them
      }
      if (mywindow && mywindow.focus) mywindow.focus();                        // Pop the window to the front

    } else {
      location.href = this.link;                        // Open the link in the current window
    }
  }
}

//==================================================
// slideshow object
//==================================================
function slideshow( slideshowname ) {
  // constructor function for the slideshow object. called automatically when you create a new object.

  this.name = slideshowname;                            // Name of this object (required for auto-play)

  this.repeat = true;                                   // loop at last slide?

                                                        // Number of images to pre-fetch.
                                                        // -1 = preload all images.
                                                        //  0 = load each image is it is used.
                                                        //  n = pre-fetch n images ahead of the current image.
                                                        // preloading all images unless large images, or a large amount of images.
  this.prefetch = -1;

  this.image;  // IMAGE element on your HTML page. example, document.images.SLIDES1IMG

  // ID of a DIV element on your HTML page that will contain the text. For example, "slides2text"
  // Note: after you set this variable, call the update() method to update the slideshow display.
  this.textid;

  // TEXTAREA element on your HTML page. example, document.SLIDES1FORM.SLIDES1TEXT
  // This is a depracated method for displaying the text, but you might want to supply it for older browsers.
  this.textarea;

  // Milliseconds to pause between slides. Individual slides can override this.
  this.timeout = 3000;

  // Hook functions to be called before and after updating the slide
  // this.pre_update_hook = function() { }
  // this.post_update_hook = function() { }

  // These are private variables
  this.slides = new Array();
  this.current = 0;
  this.timeoutid = 0;

  //--------------------------------------------------
  // Public methods
  //--------------------------------------------------// Add a slide to the slideshow.
  this.add_slide = function(slide) {
                      
                                                      // For example: SLIDES1.add_slide(new slide("s1.jpg", "link.html"))
  
    var i = this.slides.length;

    if (this.prefetch == -1) {                        // Prefetch the slide image if necessary
      slide.load();
    }

    this.slides[i] = slide;
  }

  //-------------------------------------------------- // implements the automatically running slideshow.
  this.play = function(timeout) {
        
                      // If you specify the "timeout" argument, then a new default timeout will be set.
    this.pause();                                      // Make sure we're not already playing
             
    if (timeout) {         // If the timeout argument was specified (optional) then make it the new default
      this.timeout = timeout;
    }
  
                      // If the current slide has a custom timeout, use it; otherwise use the default
    if (typeof this.slides[ this.current ].timeout != 'undefined') {
      timeout = this.slides[ this.current ].timeout;
    } else {
      timeout = this.timeout;
    }
                
    this.timeoutid = setTimeout( this.name + ".loop()", timeout);      // After the timeout, call this.loop()
  }

  //--------------------------------------------------// This method stops the slideshow if automatically running.
  this.pause = function() {
                      
    if (this.timeoutid != 0) {
      clearTimeout(this.timeoutid);
      this.timeoutid = 0;
    }
  }

  //--------------------------------------------------// This method updates the slideshow image on the page
  this.update = function() {
                      
    if (! this.valid_image()) { return; }             // Make sure the slideshow has been initialized correctly
  
    if (typeof this.pre_update_hook == 'function') {       // Call the pre-update hook function if one was specified
      this.pre_update_hook();
    }

    var slide = this.slides[ this.current ];            // Convenience variable for the current slide

    var dofilter = false;                               // Determine if the browser supports filters
    if (this.image &&
        typeof this.image.filters != 'undefined' &&
        typeof this.image.filters[0] != 'undefined') {

      dofilter = true;
    }

    slide.load();                                      // Load the slide image if necessary

    if (dofilter) {                                    // Apply the filters for the image transition

      if (slide.filter &&
          this.image.style &&
          this.image.style.filter) {                        // If specified a custom filter for this slide, then set it now

        this.image.style.filter = slide.filter;
      }
      this.image.filters[0].Apply();
    }

    this.image.src = slide.image.src;                      // Update the image.

    if (dofilter) {                                     // Play the image transition filters
      this.image.filters[0].Play();
    }

    this.display_text();                                 // Update the text

    if (typeof this.post_update_hook == 'function') {    // Call the post-update hook function if one was specified
      this.post_update_hook();
    }

    if (this.prefetch > 0) {                             // Do we need to pre-fetch images?
      var next, prev, count;

      next = this.current;                                // Pre-fetch the next slide image(s)
      prev = this.current;
      count = 0;
      do {

        if (++next >= this.slides.length) next = 0;          // Get next and previous slide number. Loop past ends if necessary
        if (--prev < 0) prev = this.slides.length - 1;

        this.slides[next].load();                          // Preload the slide image
        this.slides[prev].load();

      } while (++count < this.prefetch);                  // Keep going until we have fetched the designated number of slides
    }
  }

  //--------------------------------------------------  // This method jumpts to the slide number you specify.
  this.goto_slide = function(n) {
                    
                      // -1, jumps to last slide.
                      // use this to go to a specific slide, or to go to the beginning or end.
                      // Examples: onClick="myslides.goto_slide(-1)"
  
    if (n == -1) {
      n = this.slides.length - 1;
    }
    if (n < this.slides.length && n >= 0) {
      this.current = n;
    }
    this.update();
  }


  //--------------------------------------------------
  this.goto_random_slide = function(include_current) {
                      // Picks a random slide (other than the current slide) and displays it.
                      // If the include_current parameter is true, then See also: shuffle()
    var i;
         
    if (this.slides.length > 1) {                            // Make sure there is more than one slide

      do {                        // Generate a random slide number, make sure it is not the current slide
        i = Math.floor(Math.random()*this.slides.length);
      } while (i == this.current);
 
      this.goto_slide(i);                                 // Display the slide
    }
  }

  //--------------------------------------------------// This method advances to the next slide.
  this.next = function() {
                      
    if (this.current < this.slides.length - 1) {                      // Increment the image number
      this.current++;
    } else if (this.repeat) {
      this.current = 0;
    }
    this.update();
  }

  //--------------------------------------------------// This method goes to the previous slide.
  this.previous = function() {
                      
    if (this.current > 0) {                            // Decrement the image number
      this.current--;
    } else if (this.repeat) {
      this.current = this.slides.length - 1;
    }
    this.update();
  }


  //--------------------------------------------------// This method randomly shuffles the order of the slides.
  this.shuffle = function() {

    var i, i2, slides_copy, slides_randomized;
   
    slides_copy = new Array();                          // Create a copy of the array containing the slides in sequential order
    for (i = 0; i < this.slides.length; i++) {
      slides_copy[i] = this.slides[i];
    }
       
    slides_randomized = new Array();               // Create a new array to contain the slides in random order

                      // To populate new array of slides in random order, loop through slides, picking a random slide, 
	                      // removing it from the ordered list and adding it to the random list.

    do {
      i = Math.floor(Math.random()*slides_copy.length);                        // Pick a random slide from those that remain
            
      slides_randomized[ slides_randomized.length ] = slides_copy[i];           // Add to the end of randomized array
        

                        // Remove the slide from the sequential array, so it cannot be chosen again
      for (i2 = i + 1; i2 < slides_copy.length; i2++) {
        slides_copy[i2 - 1] = slides_copy[i2];
      }
      slides_copy.length--;

    } while (slides_copy.length);                        // Keep going until we have removed all the slides

    this.slides = slides_randomized;                    // Now set the slides to the randomized array
  }


  //--------------------------------------------------// This method returns the text of the current slide
  this.get_text = function() {  
    return(this.slides[ this.current ].text);
  }

  //--------------------------------------------------// Return the text for all of the slides.
  this.get_all_text = function(before_slide, after_slide) {
                      
                                                     // For the text of each slide, add "before_slide" in front of the
                                                  // text, and "after_slide" after the text.
                                                  // For example:
                                                  // document.write("<ul>");
                                                  // document.write(s.get_all_text("<li>","\n"));
                                                  // document.write("<\/ul>");
  
    all_text = "";
  
    for (i=0; i < this.slides.length; i++) {                      // Loop through all the slides in the slideshow
      slide = this.slides[i];
    
      if (slide.text) {
        all_text += before_slide + slide.text + after_slide;
      }
    }
    return(all_text);
  }


  //--------------------------------------------------// Display the text for the current slide
  this.display_text = function(text) {

    if (!text) {                      // If the "text" arg was not supplied (usually it isn't), get the text from the slideshow
      text = this.slides[ this.current ].text;
    }
  
                      // If a textarea has been specified, then change the text displayed in it
    if (this.textarea && typeof this.textarea.value != 'undefined') {
      this.textarea.value = text;
    }

    if (this.textid) {           // If a text id has been specified, then change the contents of the HTML element
      r = this.getElementById(this.textid);
      if (!r) { return false; }
      if (typeof r.innerHTML == 'undefined') { return false; }

      r.innerHTML = text;                             // Update the text
    }
  }


  //--------------------------------------------------// calls the hotlink() method for the current slide.
  this.hotlink = function() {
                      
    this.slides[ this.current ].hotlink();
  }


  //--------------------------------------------------// Saves the position of the slideshow in a cookie,
  this.save_position = function(cookiename) {  
    if (!cookiename) {
      cookiename = this.name + '_slideshow';
    }
    document.cookie = cookiename + '=' + this.current;
  }


  //--------------------------------------------------// If previously called slideshow_save_position(), returns it to previous state.
  this.restore_position = function(cookiename) {
  
    if (!cookiename) {                                //Get cookie code by Shelley Powers
      cookiename = this.name + '_slideshow';
    }
  
    var search = cookiename + "=";
  
    if (document.cookie.length > 0) {
      offset = document.cookie.indexOf(search);

      if (offset != -1) {                            // if cookie exists
        offset += search.length;

        end = document.cookie.indexOf(";", offset);                          // set index of beginning of value

        if (end == -1) end = document.cookie.length;                          // set index of end of cookie value
        this.current = parseInt(unescape(document.cookie.substring(offset, end)));
        }
     }
  }


  //--------------------------------------------------
  this.noscript = function() {
                      // call it to get a plain HTML version of the slideshow images and text.
                      // copy the HTML and put it within a NOSCRIPT element, to
                      // give non-javascript browsers access to your slideshow information.
                      // This also ensures that your slideshow text and images are indexed
                      // by search engines.
  
    $html = "\n";
  
    for (i=0; i < this.slides.length; i++) {                      // Loop through all the slides in the slideshow
      slide = this.slides[i];
      $html += '<P>';
  
      if (slide.link) {
        $html += '<a href="' + slide.link + '">';
      }
  
      $html += '<img src="' + slide.src + '" ALT="slideshow image">';
  
      if (slide.link) {
        $html += "<\/a>";
      }
  
      if (slide.text) {
        $html += "<BR>\n" + slide.text;
      }
  
      $html += "<\/P>" + "\n\n";
    }

    $html = $html.replace(/\&/g, "&amp;" );                      // Make the HTML browser-safe
    $html = $html.replace(/</g, "&lt;" );
    $html = $html.replace(/>/g, "&gt;" );
  
    return('<pre>' + $html + '</pre>');
  }


  //==================================================
  // Private methods
  //==================================================

  //--------------------------------------------------// This method is for internal use only.
  this.loop = function() {
                      
                      // This method gets called automatically by a JavaScript timeout.
                      // It advances to the next slide, then sets the next timeout.
                      // If the next slide image has not completed loading yet,
                      // then do not advance to the next slide yet.

    if (this.current < this.slides.length - 1) {           // Make sure the next slide image has finished loading
      next_slide = this.slides[this.current + 1];
      if (next_slide.image.complete == null || next_slide.image.complete) {
        this.next();
      }
    } else {                                          // we're at the last slide
      this.next();
    }
    
    this.play( );                                      // Keep playing the slideshow
  }


  //--------------------------------------------------// Returns 1 if a valid image has been set for the slideshow
  this.valid_image = function() {
                      
    if (!this.image) {
      return false;
    }
    else {
      return true;
    }
  }

  //--------------------------------------------------// This method returns the element corresponding to the id
  this.getElementById = function(element_id) {
                      
    if (document.getElementById) {
      return document.getElementById(element_id);
    }
    else if (document.all) {
      return document.all[element_id];
    }
    else if (document.layers) {
      return document.layers[element_id];
    } else {
      return undefined;
    }
  }
  

  //==================================================
  // Deprecated methods
  // I don't recommend the use of the following methods,
  // but they are included for backward compatibility.
  // You can delete them if you don't need them.
  //==================================================

  //--------------------------------------------------
  this.set_image = function(imageobject) {
                                                  // This method is deprecated; you should use the following code instead:
                                                  // s.image = document.images.myimagename;
                                                 // s.update();

    if (!document.images)
      return;
    this.image = imageobject;
  }

  //--------------------------------------------------
  this.set_textarea = function(textareaobject) {
                                                // This method is deprecated; you should use the following code instead:
                                                // s.textarea = document.form.textareaname;
                                                // s.update();
    this.textarea = textareaobject;
    this.display_text();
  }

  //--------------------------------------------------
  this.set_textid = function(textidstr) {
                                                // This method is deprecated; you should use the following code instead:
                                                // s.textid = "mytextid";
                                                // s.update();
    this.textid = textidstr;
    this.display_text();
  }
}

//-->

