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/Asia/New-Zealand-Maori-carved-masks.jpg",
								"../images/Asia/Australia-Kuranda-Rainforest-Train-Bonoff-river-gorge.jpg",
								"../images/Asia/Ayers-Rock-Australia-Outback.jpg",
								"../images/Asia/Beijing-Forbidden-City.jpg",
								"../images/Asia/New-Zealand-Milford-Sound.jpg",
								"../images/Asia/New-Zealand-Southern-Alps.jpg",
								"../images/Asia/Sydney-Opera-House-Skyline.jpg",
								"../images/Asia/Xian-Warrior-detail.jpg",
								"../images/Asia/Yangtze-River-Gorge-Sampans.jpg");
								 
								
var myCaption = new Array("Maori Carved Masks",
								"Kuranda Rainforest, Australia",
								"Uluru (Ayers Rock)",
								"Beijing, Forbidden City",
								"Milford Sound, New Zealand",
								"Southern Alps, New Zealand",
								"Sydney Opera House and Skyline",
								"Xi'an Warrior",
								"Sampans on the Yangtze River");
																		

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;
}


  







		
