// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000;
// Duration of crossfade (seconds)
var crossFadeDuration = 3;
// Specify the image files

var Pic = new Array();
var p =0;
var j = 0;
var preLoad = new Array();
var n;  // # of picts 
var folder;  // fold picts ar in

function plPicLoad(picts, folder){
n = parseInt (picts); //probably don't need to do this
for (a = 0; a< n; a++){
Pic[a] = folder + '/' + (a + 1) + '.jpg'}

// moved variables to global var p = Pic.length, j and preLoad
p = Pic.length;
for (i = 0; i < p; i++) {
preLoad[i] = new Image();
preLoad[i].src = Pic[i];
	}
}
//alert ("outside number of picts " +n);

function runSlideShow() {

if (document.all) {
document.images.SlideWindow.style.filter="blendTrans(duration=2)";
document.images.SlideWindow.style.filter="blendTrans(duration=crossFadeDuration)";

document.images.SlideWindow.filters.blendTrans.Apply();
}
document.images.SlideWindow.src = preLoad[j].src;
if (document.all) {
document.images.SlideWindow.filters.blendTrans.Play();
}
j = j + 1;
if (j > (p - 1)) j = 0;
t = setTimeout('runSlideShow()', slideShowSpeed);
}

var x=0;
var nextPic=new Array();
//n is global variable that sets total # of pics

function pictSwitch(increm, folder) {
x= x + parseInt(increm);
if (x<1) x=1; 	
if (x>n) x=n;
document.SlideWindow.src= folder +'/' + x +'.jpg';


 if (parseInt(increm) ==1){
   nextPic[x] = new Image();
   nextPic[x].src = folder +'/' + x +'.jpg';
 }
}
