
<!-- Paste this code into an external JavaScript file named: nextPrevious.js  -->



// List image names without extension
var myImg= new Array(9)
  myImg[0]= "actividades01";
  myImg[1]= "actividades02";
  myImg[2]= "actividades03";
  myImg[3]= "actividades04";
  myImg[4]= "actividades05";
  myImg[5]= "actividades06";
  myImg[6]= "actividades07";
  myImg[7]= "actividades08";
  myImg[8]= "actividades09";
  myImg[9]= "actividades10";

// Tell browser where to find the image
myImgSrc = "/actividades/";

// 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>8){
    var l = i
  } else {
    var l = i+=1;
  }
  document.imgSrc.src = myImgSrc + myImg[l] + myImgEnd;
}

// Load function after page loads
window.onload=loadImg;










