var curImage=-1;

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.slideshow)
	  {
        target=document.images.slideshow;
	  }
      if (document.all && document.getElementById("slideshow"))
	  {
        target=document.getElementById("slideshow");
	  }
  
      // make sure target is valid.  It might not be valid
      //   if the page has not finished loading
      if (target)
      {
        target.src=dimages[nextImage].src;
        curImage=nextImage;
      }

      setTimeout("swapPicture()", 5000);

    }
    else
    {
      setTimeout("swapPicture()", 500);
    }
  }
}

setTimeout("swapPicture()", 5000);