// Declare global variables
//     i - index for slide_info
//     k - number of rows

var i=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 = "images/" + slide_info[loop2] + ".jpg";
  }

// Display first slide
getSlide();

// Insert forward and back arrows
document.getElementById("slideprior").innerHTML="&lt;";
document.getElementById("slidenext").innerHTML="&gt;";
}

// This function writes the current slide information to the slideviewer page
//  It is used by initialize, nextslide & priorslide functions
function getSlide()
{
var slide_dim="";
document.getElementById("slidephoto").src="images/" + slide_info[i] + ".jpg";
document.getElementById("slideartist").innerHTML=slide_info[i+1];
document.getElementById("slidetitle").innerHTML=slide_info[i+2];
document.getElementById("slidemedia").innerHTML=slide_info[i+3];
if (slide_info[i+4]!="") slide_dim=" in.";
document.getElementById("slidesize").innerHTML=slide_info[i+4] + slide_dim;
var img_nbr=((i+j)/j);
document.getElementById("slidelocn").innerHTML=img_nbr + " of " + k + " &nbsp; &nbsp; ";
}


// 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
i=i+j;
// If past the last slide, return to the beginning
if (i>=slide_info.length)
{
i=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
i=i-j;
// If prior to first slide, return to last slide
if (i<0)
{
i=slide_info.length-j;
}
// Update data on slideviewer page
getSlide();
}