/*This script takes the array passed from getImages.php,shuffles the array, preloads the images, then displaysthe images in their shuffled sequence. Loops ferever.*///Define variablesvar img = []; // preloading arrayvar len = galleryarray.length; // lengthvar timeBasis = 4; // in secondsvar imgNum = 0;var play = true;//Shuffle the arrayshuffle(galleryarray);// preload imagesfor(i=0; i<galleryarray.length; i++) {	img[i] = new Image();	img[i].src = ('http://academic.reed.edu/biology/professors/rkaplan/slideshow-fixed/images/' + galleryarray[i]);}// FUNCTIONS...function showImg() {	document.write('<img src="'+img[0].src+'" name="slideshow" class="slideshow">');	setInterval("updateImg()", timeBasis*1000);}function updateImg() {	if (play) { // check if play button is on	  imgNum = imgNum + 1;	  if (imgNum > (len-1)) { //so it loops		  imgNum = 0;	  }	}	document.images['slideshow'].src = img[imgNum].src;}function shuffle(o) {	for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);	return o;}function playButton() {	var e = document.getElementById("b");	var currentLabel = e.value;	if (currentLabel == "Pause") {	  document.getElementById("b").value = "Play";	  play = false;      } else {	  document.getElementById("b").value = "Pause";	  play = true;	}}
