
var photos = new Array();
var photoslink = new Array();
var which = 0;
var picvar = 0;


function Fix(photo, cap, title, code) { 

   this.photo = photo;

   this.cap = cap; 

   this.title = title;

   this.code = code;
} 

// File Name, Caption, Title, Date, picvar

//define images

photos[picvar++] = new Fix("images/maze1.jpg","K&P Maze Creations, LLC","Photo #1",picvar);
photos[picvar++] = new Fix("images/maze2.jpg","K&P Maze Creations, LLC","Photo #2",picvar);
photos[picvar++] = new Fix("images/maze3.jpg","K&P Maze Creations, LLC","Photo #3",picvar);
photos[picvar++] = new Fix("images/maze4.jpg","K&P Maze Creations, LLC","Photo #4",picvar);
photos[picvar++] = new Fix("images/maze5.jpg","K&P Maze Creations, LLC","Photo #5",picvar);
photos[picvar++] = new Fix("images/maze6.jpg","K&P Maze Creations, LLC","Photo #6",picvar);

var nothing = "&nbsp;";
var previous = "&nbsp;&nbsp;<a href='#' onClick='backward();return false' class='set5'><font size='+1'><strong>Previous Photo</strong></font></a>";
var next = "<a href='#' onClick='forward();return false' class='set5'><font size='+1'><strong>Next Photo</strong></font></a>&nbsp;&nbsp;";


//Specify whether images should be linked or not (1=linked)

var linkornot=0;

//Set corresponding URLs for above images. Define ONLY if variable linkornot equals "1"
//photoslink[0]="";
//photoslink[1]="";
//photoslink[2]="";


function applyeffect(){

   if (document.all && photoslider.filters){

      photoslider.filters.revealTrans.Transition=Math.floor(Math.random()*23);
      photoslider.filters.revealTrans.stop();
      photoslider.filters.revealTrans.apply();
   }

}


function playeffect() {

  if (document.all && photoslider.filters)
     photoslider.filters.revealTrans.play();
}

function keeptrack() {

  window.status= "Image " + (which+1) +" of "+photos.length;

}


function backward() {

  var SelectionBox2 = document.kevinform.kevin1;

  if (which>0) {
    which--;
    applyeffect();
    document.images.photoslider.src=photos[which].photo;
    document.getElementById("title").innerHTML = "<font color='white' size='+1'><strong>" + photos[which].title + "</strong></font>";
    document.getElementById("caption").innerHTML = "<font color='white'><strong>" + photos[which].cap + "</strong></font>";
    document.getElementById("numbers").innerHTML = "<font color='white' size='+1'><strong>Image " + (which+1) + " of " + picvar;
    playeffect();
    keeptrack();
    SelectionBox2.options[which].selected = true;

  }

  if (which == photos.length-1) {
    document.getElementById("ahead").innerHTML = nothing;
  }
  else {
    document.getElementById("ahead").innerHTML = next;
  }


  if (which != 0) {
    document.getElementById("back").innerHTML = previous;
  } 
  else {
    document.getElementById("back").innerHTML = nothing;
  }

}


function forward()  {

  var SelectionBox1 = document.kevinform.kevin1;

  if (which<photos.length-1) {
    which++;
    applyeffect();
    document.images.photoslider.src=photos[which].photo;
    document.getElementById("title").innerHTML = "<font color='white' size='+1'><strong>" + photos[which].title + "</strong></font>";
    document.getElementById("caption").innerHTML = "<font color='white'><b>" + photos[which].cap + "</b></font>";
    document.getElementById("numbers").innerHTML = "<font color='white' size='+1'><strong>Image " + (which+1) + " of " + picvar;
    playeffect();
    keeptrack();
    SelectionBox1.options[which].selected = true;

  }

  if (which == photos.length-1) {
    document.getElementById("ahead").innerHTML = nothing;
  }

  if (which != 0) {
    document.getElementById("back").innerHTML = previous;
  } 
  else {
    document.getElementById("back").innerHTML = nothing;
  }

}


function transport() {

  window.location=photoslink[which]
}



function getPhoto(code1) {

  which = code1;
  var SelectionBox = document.kevinform.kevin1;
  SelectionBox.options[which].selected = true;

  applyeffect();
    document.images.photoslider.src=photos[which].photo;
    document.getElementById("title").innerHTML = "<font color='white' size='+1'><strong>" + photos[which].title + "</strong></font>";
    document.getElementById("caption").innerHTML = "<font color='white'><b>" + photos[which].cap + "</b></font>";
    document.getElementById("numbers").innerHTML = "<font color='white' size='+1'><strong>Image " + (which+1) + " of " + picvar;
    playeffect();
    keeptrack();
  
  if (which == photos.length-1) {
    document.getElementById("ahead").innerHTML = nothing;
  }
  else {
    document.getElementById("ahead").innerHTML = next;
  }


  if (which != 0) {
    document.getElementById("back").innerHTML = previous;
  } 
  else {
    document.getElementById("back").innerHTML = nothing;
  }

}