// Declare global variables
//     j - number of variable per image row [i]
//     igal - index for slide_info
//     k - number of rows

var j=3;
var igal=0;
var k=0;

//This script initializes the information for the first slide in the list
function initialize()
{

// Determines k (number of rows) in slide_info array.
k=slide_info.length/j;

// Define array for holding images
var slide = new Array(k);

// Initialize slide array and preload images
for (var loop1=0, loop2=0; loop2<slide_info.length; loop1++, loop2=loop2+j)
  {
  slide[loop1] = new Image();
  slide[loop1].src = slide_info[loop2];
  }

// Display first slide
getSlide();

}

// This function writes the current slide information to the slideviewer page
//  It is used by initialize, nextslide & priorslide functions
function getSlide()
{
	document.getElementById("slidephoto").src=slide_info[igal];
	if (slide_info[igal+1] != "") {
		document.getElementById("slidephoto").alt=slide_info[igal+1];
	} else {
		document.getElementById("slidephoto").alt="Photo";
	}
	if (slide_info[igal+2] != "") {
		document.getElementById("slidecaption").innerHTML=slide_info[igal+2];
	} else {
		document.getElementById("slidecaption").innerHTML="&nbsp;";
	}
	var img_nbr=((igal+j)/j);
	document.getElementById("slidelocn").innerHTML=" | " + img_nbr + " of " + k + " | ";
}


// This script updates the information for the next slide in the list
// If invoked on the last slide, the first slide will be returned
function nextslide()
{
// Increment indexes
igal=igal+j;
// If past the last slide, return to the beginning
if (igal>=slide_info.length)
{
igal=0;
}
// Update data on slideviewer page
getSlide();
}

// This script updates the information for the prior slide in the list
// If invoked on the first slide, the last slide will be returned
function priorslide()
{
// Decrement index
igal=igal-j;
// If prior to first slide, return to last slide
if (igal<0)
{
igal=slide_info.length-j;
}
// Update data on slideviewer page
getSlide();
}
