// JavaScript Document
// (C) 2002 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this header.
// Extended by Federico Calvo
// www.TURKEL.info

// Set the slideshow speed (in milliseconds)
var SlideShowSpeed = 4000;

// Set the duration of crossfade (in seconds)
var CrossFadeDuration = 4;

// Set the relative path to the images
var imgPath="images/stages_whatnew/" 


var Picture = new Array(); // don't change this
var Caption = new Array(); // don't change this


// Dynamically create image name array based on NrImg 
// which is defined in the page where the rotator will be used.
for(var i=0;i<NrImg;i++){
	Picture[i] = imgPath+'Image'+(i+1)+'.jpg';	
}

//scramble Image Array
for (n=0;n<NrImg;n++){
	rndNr = (Math.random() * (NrImg-1)) +1
	rndNr = parseInt((rndNr-1),10);
	tmp = Picture[n];
	Picture[n] = Picture[rndNr];
	Picture[rndNr]=tmp;
}


// =====================================
// Do not edit anything below this line!
// =====================================

var tss;
var iss;
var jss = 0;

var preLoad = new Array();
for (iss = 0; iss < NrImg; iss++){	
	//generate images
	preLoad[iss] = new Image();
	preLoad[iss].src = Picture[iss];
}

function runSlideShow(){
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;
	if (document.all) document.images.PictureBox.filters.blendTrans.Play();
		jss = jss + 1;
		if (jss >= (NrImg))	jss=0;
		tss = setTimeout('runSlideShow()', SlideShowSpeed);
}

