/**********************************************************
 * Javascript Photo Album
 **********************************************************/

self.name = "main"; // If you are using frames, change "main" to the name of the frame that the photoalbum is in.

current = 0; // Sets the current picture being shown to the first one.

ActiveVar = 0; // Sets up the variable that counts the pictures.
var ActiveArray = new Array() // Sets up the active array.
for (loop=0; loop < MainVar; loop++) {
  ActiveArray[ActiveVar++] = new Fix(MainArray[loop].DatVal, MainArray[loop].PicVal, MainArray[loop].TitVal, MainArray[loop].CatVal, MainArray[loop].TxtVal)
}


function LoadPiclist() { // Loads initial list of pictures on web page.
  for (loop=0; loop < MainVar; loop++)  {
    document.write("<option value=" + ActiveArray[loop].PicVal + ">" + ActiveArray[loop].TitVal + "</option>");
  }
}

function LoadNextPic()  { // Loads next picture for faster operation.
	NextImage = new Image();
	NextPic = current + 1;
    if (NextPic>=ActiveVar) NextPic = 0;
    NextImage.src = ActiveArray[NextPic].PicVal;
}

function NextPic() { // Flips to the next photo.
  TotalImages = document.MyForm.Dropdown.options.length;
  current++;
  if (current>=ActiveVar) current = 0;
  ShowPic(current);
}

function PreviousPic() { // Flips to the previous photo.
  current--;
  if(current<0) current = ActiveVar - 1;
  ShowPic(current);
}


function ShowPic(newpic) { // Shows the photo and text on the page.
  current = newpic;
  SelectionBox = document.MyForm.Dropdown;
  SelectionBox.options[current].selected = true;
  document.getElementById("PhotoSpot").innerHTML = '<img name="PicShowing" src=' + ActiveArray[current].PicVal + ' height=200 width=266 border=0>';
  document.getElementById("Journal").outerHTML = '<div id=journal><br><b>' + ActiveArray[current].TitVal + '</b><p>' + ActiveArray[current].DatVal + '<p style="text-align:justify; text-indent:25px">' + ActiveArray[current].TxtVal + '</div>';
  }

