window.onload = initAll;

var currImg = 0;

// main images
var pics = new Array(
	"img_0669.jpg",  
	"img_0588.jpg",  
	"img_0590.jpg",  
	"img_0592.jpg",   
  "img_0643.jpg",
 	"img_0672.jpg",
	"img_0675.jpg"
)

// thumbnail images
var picsThm = new Array(
	"img_0669Thm.jpg",
	"img_0588Thm.jpg", 
	"img_0590Thm.jpg",
	"img_0592Thm.jpg",
	"img_0643Thm.jpg",
	"img_0672Thm.jpg",
	"img_0675Thm.jpg"
)

// captions
var captionText = new Array(
	"Under blue sky, before white edifice, on green grass in Vienna",
	"With Fr. Hilde Zach, Innsbruck Mayor",
	"With Dr. Eva Stangl-Theimer",
	"With Dr. Peter Parenzan and Fr. Waltraud Schreilechner", 
  "With Eva Weissenbacher and Inge Brodil",
	"Wtih Dr. Ilse Pfeffer",
	"Wtih Natascha Ruzicka, Volkshochschule Hernals - President"
)

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 vienna.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;
	}
}