window.onload = initLinks;

/* topic-slide.js contains the images and their captions for the rotating image gallery. */

/* */

/* Filesnames are relative to location of the calling HTML file, not to the location of this JavaScript file.  */

var myPix = new Array("../images/LAmerica/Pentecostal-celebration.jpg",
								"../images/LAmerica/50-Sea-lion-observer.jpg",
								"../images/LAmerica/48-morning-light-from-the-zodiacs.jpg",
								"../images/LAmerica/61-Lake-Atitlan-volcano-morning-shot.jpg",
								"../images/LAmerica/81-Tikal-Temple-3-in-the-forest.jpg",
								"../images/LAmerica/Altair-Hacienda.jpg",
								"../images/LAmerica/Angel-the-spotted-jaguar.jpg",
								"../images/LAmerica/Buenos-Aires-Music-on-the-green.jpg",
								"../images/LAmerica/Machu-Picchu-T92B.jpg",
								"../images/LAmerica/Mexico-City-Aztec-performers.jpg",
								"../images/LAmerica/Oaxaca-Day-of-Dead-sand-carpet.jpg",
								"../images/LAmerica/Power-of-water.jpg",
								"../images/LAmerica/Sacsayhuaman-stonework.jpg",
								"../images/LAmerica/Bartholome-Spike-T132A.jpg",
								"../images/LAmerica/Urubamba-Valley-vendors.jpg");
						 
								 
								
var myCaption = new Array("Pentecostal Celebration, Lima, Peru",
								"Sea Lion Observer",
								"Morning Light, Sea of Cortez, Mexico",
								"Lake Atitlan and Volcano, Guatemala",
								"Tikal Temple, Guatemala",
								"Altair Hacienda",
								"Angel, the spotted jaguar",
								"Music on the Green, Buenos Aires, Argentina",
								"Machu Picchu, Peru",
								"Aztec Performers, Mexico City",
								"Sand Carpet, Day of the Dead, Oaxaca, Mexico",
								"The Power of Water",
								"Sacsayhuaman Stonework, Cuzco, Peru",
								"Spike at Bartholome Island, Galapagos, Ecuador",
								"Vendors in Urubamba Valley, Peru");
																		

var thisPic = 0;
								


function initLinks() {
	document.getElementById("prevLink").onclick = processPrevious;
	
  document.getElementById("nextLink").onclick = processNext;
  
}

<!-- element ids for the getElementById and other ids must agree with calling file, otherwise you get msg about html file not found for prev.html and next.html, even though these are just virtual placeholder files for this clever bit to work.  -->

function processPrevious() {
  if (thisPic == 0) {
  	thisPic = myPix.length;
    }
  thisPic--;  
  document.getElementById("pictureArea2").src= myPix[thisPic];
  document.getElementById("caption").innerHTML=myCaption[thisPic];
  return false;
}

function processNext() {
  thisPic++;  
  if (thisPic == myPix.length) {
  	thisPic = 0;
    }
  document.getElementById("pictureArea2").src= myPix[thisPic];
  document.getElementById("caption").innerHTML=myCaption[thisPic];
  return false;
}


  







		
