window.onload = initAll;

var currImg = 0;

// main images
var pics = new Array(
	"kihoMonacoCoverMed.jpg", // Official poster
	"monacoNewsMed.jpg",      // Monaco newspaer clip
	"monaco05Med.jpg",        // with certificate
	"monacoCertMed.jpg",      // certificate
	"monaco01Med.jpg",        // on stage
  "kihoMonaco1Med.jpg"      // in Turin, Italy
)

// thumbnail images
var picsThm = new Array(
	"kihoMonacoCoverThm.jpg",
	"monacoNewsThm.jpg",
	"monaco05Thm.jpg", 
	"monacoCertThm.jpg",
	"monaco01Thm.jpg",
	"kihoMonaco1Thm.jpg"
)

// captions
var captionText = new Array(
	"2007 Monaco-Japan Art Festival, held 3/9-3/11 in Monte Carlo, Monaco",
	"Monaco newspaper clipping showing Kiho at the opening of the 2007 Monaco-Japan Art Festival",
	"Kiho with the Serge Diaghilev award certificate at the 2007 Monaco-Japan Art Festival",
	"Certificate of the Serge Diaghilev Award in the 2007 Monaco-Japan Art Festival",
	"Kiho on stage with M. Michel Bouquier, Minister of Tourism of Monaco (left)), and " + 
  "M. Rainier Rocchi, Director of Cultural Affairs (right)",
	"Kiho in Turin, Italy, where she and her companions visited after participating in the Monaco-Japan Art Festival"
)

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;
	}
}