<!-- Paste this code into an external JavaScript file named: nextPrevious.js  -->

/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Created by: Solomon, the Sleuth :: http://www.freewebs.com/thesleuth/scripts/ */

var i = 0;
var count = 0;

// List image names without extension
var myImg= new Array(count)
 myImg[0]= "Justanotherparty_01";
 
// ImageNumbers:
var myNr= new Array(count)
 myNr[0]= "1/1";

// Imagetexts:
var myText= new Array(count)
 myText[0]= "Justanotherparty - Illustration for flyer";
 
// Tell browser where to find the image
myImgSrc = "images/2006/";

// Tell browser the type of file
myImgEnd = ".jpg"

// Create function to load image
function loadImg(){
  document.imgSrc.src = myImgSrc + myImg[i] + myImgEnd;
  document.getElementById("numbers").innerHTML = myNr[i];
  document.getElementById("imgtxt").innerHTML = myText[i];
}

// Create link function to switch image backward
function prev(){
  if(i>0){
  i = i-=1;
  document.imgSrc.src = myImgSrc + myImg[i] + myImgEnd;
  document.getElementById("numbers").innerHTML = myNr[i];
  document.getElementById("imgtxt").innerHTML = myText[i];
}
}

// Create link function to switch image forward
function next(){
  if(i<count){
  i = i+=1;
  document.imgSrc.src = myImgSrc + myImg[i] + myImgEnd;
  document.getElementById("numbers").innerHTML = myNr[i];
  document.getElementById("imgtxt").innerHTML = myText[i];
}  
}

// Load function after page loads
window.onload=loadImg;
