// JavaScript Document
function switchImage(imgName, imgSrc) 
{
  if (document.images)
  {
    if (imgSrc != "none")
    {
      document.images[imgName].src = imgSrc;
    }
  }
}

// * Dependencies * 
// this function requires the following snippets:
// JavaScript/images/switchImage
//
// BODY Example:
//
var SlideList2 = ['js_reception.jpg', 'basford_chair_sm.jpg', 'basford_entrance_sm.jpg', 'receptionist.jpg'];
var SlideShow2 = new SlideShow(SlideList2, 'slide1', 6000, "SlideShow2");
SlideShow.prototype.play = SlideShow_play; 

// SCRIPT Example:
//var mySlideList2 = ['image4.gif', 'image5.gif', 'image6.gif'];
//var mySlideShow2 = new SlideShow(mySlideList2, 'slide2', 1000, "mySlideShow2");
function SlideShow(slideList, image, speed, name)          
{
  this.slideList = slideList;
  this.image = image;
  this.speed = speed;
  this.name = name;
  this.current = 0;
  this.timer = 0;
} 
function SlideShow_play()       
{
  with(this)
  {
    if(current++ == slideList.length-1) current = 0;
    switchImage(image, slideList[current]);
    clearTimeout(timer);
    timer = setTimeout(name+'.play()', speed);
  }
}

