// JavaScript Document

/* 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()
  //myImg[0] = "testimonios-index.jpg";
  myImg[0] = "rejuvenecimiento-index.jpg";

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

// 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;
  document.imgSrc.src = myImgSrc + myImg[i];
}

// 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.imgSrc.src = myImgSrc + myImg[l];
}

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

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