var thumbn1 = 1;
var thumbn2 = 2;
var thumbn3 = 3;
var thumbn4 = 4;

var thumbnails=new Array();

var aantal; //aantal foto's die je wil zien in de slideshow
var folderName;

function FillArray(pictureCount)
{
	aantal = pictureCount;
	
	for (var ind = 0; ind < aantal; ind++)
	{ //array opvullen
		var ind_2 = ind + 1;
		if (ind_2 < 10) {
			thumbnails[ind] = "00" + ind_2 + ".jpg";
		}
		else if (ind_2 < 100) {
			thumbnails[ind] = "0" + ind_2 + ".jpg";
		}
		else {
			thumbnails[ind] = ind_2 + ".jpg";
		}
	}
}
function SetFolder(folder)
{
	folderName = folder;
}

function ShowPicture(layer, imageURL) {
	if(document.getElementById) {
		if (imageURL == '1') {
			document.getElementById(layer).src= folderName + "/" + thumbnails[thumbn1 - 1];
		}
		else if (imageURL == '2') {
			document.getElementById(layer).src= folderName + "/" + thumbnails[thumbn2 - 1];
		}
		else if (imageURL == '3') {
			document.getElementById(layer).src= folderName + "/" + thumbnails[thumbn3 - 1];
		}
		else if (imageURL == '4') {
			document.getElementById(layer).src= folderName + "/" + thumbnails[thumbn4 - 1];
		}
		<!-- document.getElementById(layer).src=imageURL; -->
	}
	else if (document.all) {
		if (imageURL == '1') {
			document.all[layer].src= folderName + "/" + thumbnails[thumbn1 - 1];
		}
		else if (imageURL == '2') {
			document.all[layer].src= folderName + "/" + thumbnails[thumbn2 - 1];
		}
		else if (imageURL == '3') {
			document.all[layer].src= folderName + "/" + thumbnails[thumbn3 - 1];
		}
		else if (imageURL == '4') {
			document.all[layer].src= folderName + "/" + thumbnails[thumbn4 - 1];
		}
		<!-- document.all[layer].src=imageURL; -->
	} 
	else {
		if (imageURL == '1') {
			document[layer].src= folderName + "/" + thumbnails[thumbn1 - 1];
		}
		else if (imageURL == '2') {
			document[layer].src= folderName + "/" + thumbnails[thumbn2 - 1];
		}
		else if (imageURL == '3') {
			document[layer].src= folderName + "/" + thumbnails[thumbn3 - 1];
		}
		else if (imageURL == '4') {
			document[layer].src= folderName + "/" + thumbnails[thumbn4 - 1];
		}
		<!-- document[layer].src=imageURL; -->
	}
}		

function Next() {
	thumbn1++;
	thumbn2++;
	thumbn3++;
	thumbn4++;
		
	if (thumbn1 > aantal) {
		thumbn1 = 1;	
	}	
    else if (thumbn2 > aantal) {		
		thumbn2 = 1;
	}
	else if (thumbn3 > aantal) {
		thumbn3 = 1;		
	}
	else if (thumbn4 > aantal) {
		thumbn4 = 1;		
	}
	eval("document.t1.src= '" + folderName + "/thumbnails/" + thumbnails[thumbn1 - 1] + "'");
	eval("document.t2.src= '" + folderName + "/thumbnails/" + thumbnails[thumbn2 - 1] + "'");
	eval("document.t3.src= '" + folderName + "/thumbnails/" + thumbnails[thumbn3 - 1] + "'");
	eval("document.t4.src= '" + folderName + "/thumbnails/" + thumbnails[thumbn4 - 1] + "'");
	
	<!-- ShowPicture('layerPicture', '2') -->
}

function Back() {
	thumbn1--;
	thumbn2--;
	thumbn3--;
	thumbn4--;
		
	if (thumbn1 == 0) {
		thumbn1 = aantal;	
	}	
    else if (thumbn2 == 0) {		
		thumbn2 = aantal;
	}
	else if (thumbn3 == 0) {
		thumbn3 = aantal;		
	}
	else if (thumbn4 == 0) {
		thumbn4 = aantal;		
	}
	
	eval("document.t1.src= '" + folderName + "/thumbnails/" + thumbnails[thumbn1 - 1] + "'");
	eval("document.t2.src= '" + folderName + "/thumbnails/" + thumbnails[thumbn2 - 1] + "'");
	eval("document.t3.src= '" + folderName + "/thumbnails/" + thumbnails[thumbn3 - 1] + "'");
	eval("document.t4.src= '" + folderName + "/thumbnails/" + thumbnails[thumbn4 - 1] + "'");
	
	<!-- ShowPicture('layerPicture', '2') -->
}

