// List image names without extension
var myImg= new Array(6)
  myImg[0]= "h1";
  myImg[1]= "h2";
  myImg[2]= "h3";
  myImg[3]= "h4";
  myImg[4]= "h5";
  myImg[5]= "h6";

// Tell browser where to find the image
myImgSrc = "/img/";

// 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;
}

// 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;
}

// Create link function to switch image forward
function next(){
  if(i>2){
    var l = i
  } else {
    var l = i+=1;
  }
  document.imgSrc.src = myImgSrc + myImg[l] + myImgEnd;
}

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