// Tell browser where to find the image
myImgSrc = "/images/portfolio/";

// Tell browser the type of file
myImgEnd = ".jpg"

var i = 0;
var image_no=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;
  document.getElementById("image_no").innerHTML=l+1;  
}

// Create link function to switch image forward
function next(){
  if(i>=(number_of_images-1)){
    var l = i
  } else {
    var l = i+=1;
  }
  document.imgSrc.src = myImgSrc + myImg[l] + myImgEnd;
  document.getElementById("image_no").innerHTML=l+1;  
}

// Load function after page loads
window.onload=loadImg;

