var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
var thumb_x = 0;
var richting;
var volgorde;
var volgorde_alt;
var huidige_foto = 0;

function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
}

function move_thumbs() {
	var pos = parseInt(document.getElementById('alle_thumbs').style.left+0);
	if ((richting == 'links')&&(pos < thumb_x)) {
		pos += 25;
		document.getElementById('alle_thumbs').style.left = pos + 'px';
		setTimeout('move_thumbs()', 25);
	}
	if ((richting == 'rechts')&&(pos > thumb_x)) {
		pos -= 25;
		document.getElementById('alle_thumbs').style.left = pos + 'px';
		setTimeout('move_thumbs()', 25);
	}
}

function pijl_links()
{
	var breed = document.getElementById('alle_thumbs').clientWidth;
	//var pos = parseInt(document.getElementById('alle_thumbs').style.left+0);
	var pos = thumb_x;
	var pos = pos + 450;
	if (pos < 450) {
		richting = 'links';
		thumb_x = pos;
		move_thumbs();
		//document.getElementById('alle_thumbs').style.left = pos + 'px';
	}

}

function pijl_rechts()
{
	var breed = document.getElementById('alle_thumbs').clientWidth;
	//var pos = parseInt(document.getElementById('alle_thumbs').style.left+0);
	var pos = thumb_x;
	var pos = pos - 450;
	if (pos + breed > 0) {
		richting = 'rechts';
		thumb_x = pos;
		move_thumbs();
		//document.getElementById('alle_thumbs').style.left = pos + 'px';
	}

}

function open_cat(tekst) {
	document.getElementById("page").innerHTML = tekst;
}
		
function open_foto(id) {
	oude_foto = huidige_foto;
	huidige_foto = id;
	if (document.getElementById("foto_groot") != null) {
		var timer = 0;
		changeOpac(0, "foto_groot");
		document.getElementById("foto_groot").src = "img/foto/"+volgorde[id]+".jpg";
		document.getElementById("foto_groot").alt = volgorde_alt[id];
		document.getElementById("foto_groot").title = volgorde_alt[id];
		for(i = 0; i <= 100; i++) { 
			setTimeout("changeOpac(" + i + ",'foto_groot')",(timer * 5));
			timer++; 
		} 

	} else
		document.getElementById("page").innerHTML = "<table cellpadding='0' cellspacing='0' style='width: 100%; height: 100%;'><tr><td style='text-align: center;'><img id='foto_groot' src='img/foto/"+volgorde[id]+".jpg' alt='"+volgorde_alt[id]+"' title='"+volgorde_alt[id]+"' /></td></tr></table>";

}


function vorige_foto() {
	if (huidige_foto != 0) open_foto(huidige_foto-1);
}

function volgende_foto() {
	if (volgorde[huidige_foto+1] != 0) open_foto(huidige_foto+1);
}

function laad_fotos(fotos, alt) {
	volgorde = fotos;
	volgorde_alt = alt;
}
