// Portions (C) 2003 by CodeLifter.com
// Free for all users, but leave in this header.

// ==============================
// Set the following variables...
// ==============================

//window.alert("start");

// Set the slideshow speed (in milliseconds)
var SlideShowSpeed = 10000;

// Set the duration of crossfade (in seconds)
var CrossFadeDuration = 2;

//var Picture = new Array(); // don't change this
var showHot = false;       // don't change this

// Pictures, CaptionTitles, and CaptionTexts must be passed in from HTML
// Defined in a separate <script>
//window.alert( "before split");

//window.alert( Pictures);

//window.alert( 'after Pictures');
var Picture      = Pictures.split("|");
var CaptionTitle = CaptionTitles.split("|");
var CaptionText  = CaptionTexts.split("|");
//window.alert( "after split");

//window.alert( Picture[0]);
//window.alert( Picture[1]);

var tss;
var iss;
var jss = 1;
var pss = Picture.length-1;
var firstTime = 1;

var preLoad = new Array();
for (iss = 1; iss < pss+1; iss++){
 preLoad[iss] = new Image();
 preLoad[iss].src = Picture[iss];
}

//window.alert( "exit init");

// End of auto initialization - global variables


function runSlideShow() {

//window.alert( 'runSlideShow');

if (!firstTime) {
   jss = jss + 1;
   if (jss > (pss)) jss=1;
}
firstTime = 0;

/*
document.write( Pictures+"<br>");
document.write( Picture[1]+"<br>");
document.write( Picture[2]+"<br>");
document.write( Picture[3]+"<br>");
document.write( Picture[4]+"<br>");
*/

if (document.all){
 document.images.PictureBox.style.filter="blendTrans(duration=2)";
 document.images.PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)";
 document.images.PictureBox.filters.blendTrans.Apply();
}

document.images.PictureBox.src = preLoad[jss].src;

// Change caption title
var nodeCaptionTitle = document.getElementById( "CaptionTitle");
nodeCaptionTitle.firstChild.nodeValue = CaptionTitle[jss];

// Change caption text
var nodeCaptionText = document.getElementById( "CaptionText");
nodeCaptionText.firstChild.nodeValue = CaptionText[jss];

// Change image number
var nodeCaptionCurrent = document.getElementById( "CaptionCurrent");
nodeCaptionCurrent.firstChild.nodeValue = jss + " of ";

// Change image max
var nodeCaptionMax = document.getElementById( "CaptionMax");
nodeCaptionMax.firstChild.nodeValue = pss;


if (document.all) document.images.PictureBox.filters.blendTrans.Play();
tss = setTimeout('runSlideShow()', SlideShowSpeed);


}

function control(how){
//window.alert( "how " + how);
if (showHot){
//if (how=="H") jss = 1;
if (how=="F") {
  jss = jss + 1;
}
if (how=="B") {
  jss = jss - 1;
}
if (jss > (pss)) jss=1;
if (jss < 1) jss = pss;
if (document.all){
 document.images.PictureBox.style.filter="blendTrans(duration =2)";
 document.images.PictureBox.style.filter="blendTrans(duration =CrossFadeDuration)";
 document.images.PictureBox.filters.blendTrans.Apply();
}

// Change caption title
var nodeCaptionTitle = document.getElementById( "CaptionTitle");
nodeCaptionTitle.firstChild.nodeValue = CaptionTitle[jss];

// Change caption text
var nodeCaptionText = document.getElementById( "CaptionText");
nodeCaptionText.firstChild.nodeValue = CaptionText[jss];

// Change image number
var nodeCaptionCurrent = document.getElementById( "CaptionCurrent");
nodeCaptionCurrent.firstChild.nodeValue = jss + " of ";

// Change image max
var nodeCaptionMax = document.getElementById( "CaptionMax");
nodeCaptionMax.firstChild.nodeValue = pss;

document.images.PictureBox.src = preLoad[jss].src;
if (document.all)  document.images.PictureBox.filters.blendTrans.Play();
clearTimeout( tss);
}
}

