/*  
    nextpictures.js - flip the pictures to and froth of the screen
*/

/*************************************************************************
    This code is for Payir.Org !
*************************************************************************/

// List image names without extension
var myImg= new Array(12)
  myImg[0]= "village1";
  myImg[1]= "village12";
  myImg[2]= "village11";
  myImg[3]= "village10";
  myImg[4]= "village13";
  myImg[5]= "village8";
  myImg[6]= "village7";
  myImg[7]= "village6";
  myImg[8]= "village5";
  myImg[9]= "village4";
  myImg[10]= "village3";  
  myImg[11]= "village2";
  myImg[12]= "village9"
  
// Tell browser where to find the image
myImgSrc = "images/village/";

// Tell browser the type of file
myImgEnd = ".gif"

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>11){
    var l = i
  } else {
    var l = i+=1;
  }
  document.imgSrc.src = myImgSrc + myImg[l] + myImgEnd;
}

// Load function after page loads
window.onload=loadImg;

