// Site JavaScript to do image cycling eyecandy
//
// $Id: srl.js,v 1.1 2006/09/05 03:07:12 walenste Exp $
//

var numMilliseconds     = 50;        // ms to wait between scroll actions
var waitTime            = 3500;      // wait time before switching pic
var numPixels           = 10;        // Smoothness of scroll, in pixesl per

var windowHeight        = 212;
var idArray             = new Array(numPics);
var positionOfTopImg    = -windowHeight;
var positionOfBottomImg = 0;
var topIndex            = 1;
var bottomIndex         = 0;

var numPics = 0;
var indexMax;           // set in init()
var i = 0;


function slideImage()
{
  if (document.getElementById)
  {
    document.getElementById(idArray[topIndex]).style.top=positionOfTopImg;
    document.getElementById(idArray[bottomIndex]).style.top=positionOfBottomImg;
    positionOfTopImg = positionOfTopImg + numPixels;
    positionOfBottomImg = positionOfBottomImg + numPixels;

    if (positionOfBottomImg >= windowHeight )
    {
      bottomIndex = topIndex;
      positionOfBottomImg=0;
      positionOfTopImg = -windowHeight;
      topIndex++;
      if(topIndex == numPics) topIndex = 0;
      stopSlide();
    }
  }
}

function stopSlide()
{
  window.clearInterval (interval);
  interval="";
  interval = window.setInterval("stopWait()",waitTime);
}

function stopWait()
{
  window.clearInterval (interval);
  interval="";
  startInterval();
}

function startInterval()
{
  interval = window.setInterval("slideImage()",numMilliseconds);
} 

function init()
{
  positionOfTopImg = -windowHeight;
  positionOfBottomImg = 0;
  eval("indexMax = "+numPics+"-1;");
  topIndex = 1;
  bottomIndex = 0;
  document.getElementById(idArray[0]).style.top = 0;
  interval = window.setInterval("stopWait()",waitTime);
} 
