// Slide show script for HATS home page
// Alex 2002-6-18
//
//  Playbacks timed slide show without any manual control. When image is changed
//  next image is preloaded.
//
// data from server:

//    image[] - array of images
//    msPeriod - timer between slides in auto mode
//    imagesUrl - root url for all images

// local variables used by the script:
var nextImage; 

// slides new picture over the old one
function slide()
{
  document.images['pic'].src = imagesUrl + image[counter];
}


function next()
{
  // alert("next entered: act = " + currAct + ", scene = " + currScene );	
	counter++;
  
}// end next()


function preloadNextImage()
{
  if (document.images){
    nextImage = new Image();
    nextImage.src = imagesUrl + image[counter];
  }
}


// play internal
function _play()
{
  
  slide();
  next();
  
  if ( counter == numImages ) 
  {     				
    setTimeout( 'stop()', msPeriod );    
  }
  else 
  {	  
	  preloadNextImage();
  	setTimeout( '_play()', msPeriod );
  }
}


// start playing slideshow
function start()
{  
	counter = 0;

	_play();


}

function stop()
{  
	
}

