/* 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/ */

// List image names without extension
var myImg= new Array(3)
  myImg[0]= "AWS_2008__0217 WEB";
  myImg[1]= "AWS_2008_0064 website";
  myImg[2]= "AWS_2008__0218 web";
  myImg[3]= "aws chip foose web";

// Tell browser where to find the image
myImgSrc = "http://content.lincolnelectric.com/graphics/community/Foose/AWS/";

// Tell browser the type of file
myImgEnd = ".jpg"

var i = 0;

// Create function to load image
function loadImg(){
  document.imgSrc.src = myImgSrc + myImg[i] + myImgEnd;
  hideShowBack();
}

// Create link function to switch image backward
function prev(){
  if(i<1){
    var l = i;
  } else {
    var l = i-=1;
  }
  document.imgSrc.src = myImgSrc + myImg[l] + myImgEnd;
  hideShowBack();
}

// Create link function to switch image forward
function next(){
  if(i>2){
    var l = i = 0;
  } else {
    var l = i += 1;
  }
  document.imgSrc.src = myImgSrc + myImg[l] + myImgEnd;
  hideShowBack();
}

function hideShowBack()
{
  if (i > 0)
  {
    document.getElementById('backButton').style.display = 'inline';
  }
  else
  {
    document.getElementById('backButton').style.display = 'none';
  }
}

// Load function after page loads
window.onload=loadImg;
