
// Credit to F. Permadi. Source code found at http://www.permadi.com/tutorial/jsImgSlide/index.html, (C) 2002 F. Permadi
// Adjust the next few lines to vary the effect. Change the number of images here and the paths to them on both this file and the related .js file.
// This script is being used to preload the images, set a timer, and initiate the switch. 

  var startdelay=10
  var holdtime=10
  var transitiontime=5

  var dimages=new Array();
  var numImages=4;

  dimages[0]=new Image();
  dimages[0].src="/wideimages/fp_2012_connecting.jpg";
  dimages[1]=new Image();
  dimages[1].src="/wideimages/fp_2012_healing.jpg";
  dimages[2]=new Image();
  dimages[2].src="/wideimages/fp_2012_developing.jpg";
  dimages[3]=new Image();
  dimages[3].src="/wideimages/fp_2012v2.jpg";

  var curImage=-1;

// Make sure the main image is the last in the rotation above. Preloaded images are called in the external swapfade.js

function swapPicture()
{
  if (document.images)
  {
    var nextImage=curImage+1;
    if (nextImage>=numImages)
      nextImage=0;
    if (dimages[nextImage] && dimages[nextImage].complete)
    {
      var target=0;
      if (document.images.replaceImage)
        target=document.images.replaceImage;
      if (document.all && document.getElementById("replaceImage"))
        target=document.getElementById("replaceImage");
  
      // make sure target is valid.  It might not be valid
      //   if the page has not finished loading
      if (target)
      {
 	  swapfade(document.getElementById('replaceImage'), dimages[nextImage].src, transitiontime);
        curImage=nextImage;
      }
      setTimeout("swapPicture()", 10000);
    }
    else
    {
      setTimeout("swapPicture()", holdtime*1000);
    }
  }
}
setTimeout("swapPicture()", startdelay*1000);


