window.onload = initAll;

var currImg = 0;

// main images
var pics = new Array(
	"exhibition_20050203.jpg",  
	"008.jpg",  
	"007.jpg",  
	"006.jpg",   
  "005.jpg",
 	"004.jpg",
	"003.jpg",
  "001.jpg"
)

// thumbnail images
var picsThm = new Array(
	"exhibition_20050203Thm.jpg",
	"008Thm.jpg",
	"007Thm.jpg",
	"006Thm.jpg",
	"005Thm.jpg",
	"004Thm.jpg",
	"003Thm.jpg",
	"001Thm.jpg"
)

// captions
var captionText = new Array(
	"Poster for the Kiho Art Exhibition, 2/3-2/8, 2007, at Honcho Gallery in Yokohama, Japan",
	"Artist by her works",
	"Kiho ready to greet art connoisseurs",
	"Gallery interior 1", 
  "Gallery interior 2",
	"Gallery interior 3",
	"Kiho answering quesions to one of her fans",
  "Entrance to the Honcho Gallery, Yokohama, Japan"
)

function initAll() {
	// initialize monacoSlSh.html
  if (document.getElementById("imgText")) {
  	document.getElementById("imgText").innerHTML = captionText[0];
	 	document.getElementById("prevLink").onclick = processPrevious; // set for event response--not a function call
		document.getElementById("nextLink").onclick = processNext;     // set for event response--not a function call
	}

	// initialize monaco.html

//  if (document.getElementById("img0"){
  	initAlbum();
//  }
}

function processPrevious() {
	newSlide(-1);
}

function processNext() {
	newSlide(1);
}

function newSlide(direction) {
	var imgCt = captionText.length;

	currImg = currImg + direction;
	if (currImg < 0) {
		currImg = imgCt - 1;
	}

	if (currImg == imgCt) {
		currImg = 0;
	}
	document.getElementById("slideShow").src = pics[currImg];
	document.getElementById("imgText").innerHTML = captionText[currImg];
}

// process monaco.html
function initAlbum(){
	// initialize thumbnails
  for (i = 0; i < picsThm.length; i++){
  	thisURL = "<a href='" + pics[i] + "'><img src='" + picsThm[i] + "'></a>";
  	thisImg = "img" + i;
  	document.getElementById(thisImg).innerHTML = thisURL;
	}

  // initialize captions
	for (i = 0; i < picsThm.length; i++){
		thisTxt = "txt" + i;
		thisCaption = captionText[i];
		document.getElementById(thisTxt).innerHTML = thisCaption;
	}
}