// JavaScript Document
var d = 0; // time delay between showing images

var run = false; // detects whether or not the slideshow is running

var arr = ""; // array of images to scroll through

var tar = ""; // the target div that will be effected

var tot = 0;

var cur = 0;

function setupSlideshow(delay, array, target) {
	tar = target;
	arr = array.split("|");
	d = delay;
	tot = arr.length - 1;
//	document.getElementById("test").innerHTML = "tar = " + tar;
//	run = true;
//	runSlideshow();
}

function pauseSlideshow(img) {
	run = false;
	document.getElementById(tar).innerHTML = "<img src=\"" + img + "\" width=\"576\" height=\"419\" />";
//	alert("img = " + img);
}

function hitPlay() { run = true; }

function runSlideshow() {
	if (run == true) {
		document.getElementById(tar).innerHTML = "";
		document.getElementById(tar).innerHTML = "<img src=\"" + arr[cur] + "\" width=\"576\" height=\"419\ />";
		cur ++;
		if (cur == tot) { cur = 0; }
		if (run == true) {
//			setTimeout(runSlideshow, d);
		}
	}
}
