<!--
/* THIS FILE DEPENDS ON slides.php, WHICH DOES SETUP THEN LOADS THIS FILE */
maximum = imagearray.length;

var rotation = (maximum - 1);  // initialize
var mydelay = 4000; // milliseconds between slides
var pause = 0; // pause flag
var fto = 1;
var myimages = new Array();

function setTimer(secs) {
	mydelay = secs * 1000;
}

function setPP(val) {
	if(elm = document.getElementById("pp")) elm.innerHTML = val;
}

function setPH(val) {
	if(elm = document.getElementById("headline")) elm.innerHTML = '&nbsp;'+val+'&nbsp;';
}

function setPC(val) {
	if(elm = document.getElementById("caption")) {
		var str = val.replace(/\n/,'<br />');
		elm.innerHTML = '&nbsp;'+str+'&nbsp;';
	}
}

function chgImage() {
	if (document.images) document.images.rotate.src = dir+imagearray[rotation];
	else document.all.rotate.src = dir+imagearray[rotation];
	// Change the caption
	myimages[rotation+1] = new Image();
	myimages[rotation+1].src = dir+imagearray[rotation+1];
}	

function nextImage() {
	pause = 1;
	setPP("Play");
	rotation++;
	if (rotation == maximum) {rotation = 0;}
	chgImage();
}

function priorImage() {
	pause = 1;
	setPP("Play");
	if (rotation == 0) {rotation = maximum;}
	rotation--;
	chgImage();
}
function rotate(){
	if (pause == 1);
	else {
	  rotation++;
	  if (rotation == maximum) {rotation = 0; fto = 0;}
	  chgImage();
		mytimer = setTimeout("rotate()", mydelay);
	}
}

function pausePlay() {
	if (pause == 1) {
		pause = 0;
		setPP("Pause");
		rotate();
	}
	else {
		pause = 1;
		setPP("Play");
	}
}

function showInit() {
	rotation++;
	if (rotation == maximum) {rotation = 0;}
	myimages[rotation] = new Image();
	myimages[rotation].src = dir+imagearray[rotation];
	myimages[rotation+1] = new Image();
	myimages[rotation+1].src = dir+imagearray[rotation+1];
	if (pause == 1);
	else {mytimer = setTimeout("rotate()", mydelay);}
}
//-->
