// -- This is a modified version of the original script 
// -- from CodeLifter.com, in order to fit in SPGM

// SlideShow with Captions and Cross-Fade
// (C) 2002 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this header.

// ==============================
// Set the following variables...
// ==============================

// Set the slideshow speed (in milliseconds)
var SlideShowSpeed = 3000;

// Set the duration of crossfade (in seconds)
var CrossFadeDuration = 3;


var tss;
var jss = 1;
var iss = 1;

var preLoad = new Array();
var arrWidth = new Array();
var arrHeight = new Array();

function runSlideShow() {

  if (document.getElementById('picture') == null) window.alert('hop');

  if (document.all){
    document.getElementById('picture').style.filter="blendTrans(duration=2)";
    document.getElementById('picture').style.filter="blendTrans(duration=CrossFadeDuration)";
    document.getElementById('picture').filters.blendTrans.Apply();
  }
  document.getElementById('picture').setAttribute('width', arrWidth[jss]);
  document.getElementById('picture').setAttribute('height', arrHeight[jss]);
  document.getElementById('picture').src = preLoad[jss].src;
  if (document.all) document.getElementById('picture').filters.blendTrans.Play();

  jss = jss + 1;
  if (jss > (iss - 1)) jss=1;
  tss = setTimeout('runSlideShow()', SlideShowSpeed);
}

function addPicture(pictureURL, width, height) {
  preLoad[iss] = new Image();
  preLoad[iss].src = pictureURL;
  arrWidth[iss] = width;
  arrHeight[iss] = height;
  iss = iss + 1;
}

