/*

  In the head of the document load the images array.
  var slide_files = new Array
  (
    "images/image_1.jpg",
    "images/image_2.jpg"
  );
  
  In the body set the initial image
  <img src="images/image.jpg" name="slide" style="filter:blendTrans(duration=3)">
  
  Then call this script file anywhere past the image. Very bottom of the page works fine.
  <script type="text/javascript" src="slideshow.js"></script>
 
*/

var ie = document.all;
var slide_delay = 3000;
var slide_pos = 1;
var blend_delay = (ie) ? (document.images.slide.filters[0].duration * 1000) : 0;

var slide_objects = new Array();

for (i = 0; i < slide_files.length; i++){
  slide_objects[i] = new Image();
  slide_objects[i].src = slide_files[i];
}

function slide ()
{
  if (!document.images) {
    return;
  }
  
  if (ie) {
    document.images.slide.filters[0].apply();
    document.images.slide.src = slide_objects[slide_pos].src;
    document.images.slide.filters[0].play();
  } else {
    document.images.slide.src = slide_objects[slide_pos].src;
  }
  
  slide_pos = (slide_pos < slide_files.length - 1) ? slide_pos + 1 : 0;
  
  setTimeout("slide()", (slide_delay + blend_delay));
}

slide();
