function toonPlaatInDiv(e) {
	if (!e) var e = window.event;
	var t = e.target ? e.target : e.srcElement;
	if (t.nodeType == 3) // Safari bug
		t = t.parentNode;
	t = t.parentNode;
	var bgDiv = document.getElementById('transpAchtergrondDiv');
	if (!bgDiv) {
		var nwDiv = document.createElement('div');
		nwDiv.id = 'transpAchtergrondDiv';
		document.getElementsByTagName('body')[0].appendChild(nwDiv);
		bgDiv = document.getElementById('transpAchtergrondDiv');
	}
	var fotoDiv = document.getElementById('fotoDiv');
	if (!fotoDiv) {
		var nwDiv = document.createElement('div');
		nwDiv.id = 'fotoDiv';
		document.getElementsByTagName('body')[0].appendChild(nwDiv);
		fotoDiv = document.getElementById('fotoDiv');
	}
	var pic = new Image(); pic.src = t.href;
	document.getElementsByTagName('body')[0].onkeyup = function(e) {if (!e) var e = window.event; if (e.keyCode == 27) sluitPlaatInDiv();};
	fotoDiv.innerHTML = '<img src="' + t.href + '" border="0">';
	if (t.title && t.title.length > 0) {
		fotoDiv.innerHTML += '<div style="float:left; width: 500px;">' + t.title + '</div>';
	}
	fotoDiv.innerHTML += '<div style="float:right; width: 20px;"><a href="#" onclick="sluitPlaatInDiv(); return false;" title="sluit ([ESC])"><img src="pix/sluitknop.gif" border="0" alt="sluit"></a></div>';
	var rootElm = (document.documentElement && document.compatMode == 'CSS1Compat') ? document.documentElement : document.body;
	var vpw = self.innerWidth ? self.innerWidth : rootElm.clientWidth;
	var vph = self.innerHeight ? self.innerHeight : rootElm.clientHeight;
	bgDiv.style.height = Math.max(rootElm.scrollHeight, vph) + 'px';
	bgDiv.style.display = 'block';
	fotoDiv.style.left = '35%';
	if (pic.width == 0) {
		pic.onload = function () { 
			fotoDiv.style.left = ((vpw - this.width) / 2) + 'px'; 
			fotoDiv.style.top = (rootElm.scrollTop + (vph - (this.height + 100))/2 ) + 'px';
			fotoDiv.style.display = 'block';
			fotoDiv.style.width = this.width + 'px';
		} ;
	} else {
		fotoDiv.style.left = ((vpw - pic.width) / 2) + 'px'; 
		fotoDiv.style.top = (rootElm.scrollTop + (vph - (pic.height + 100))/2 ) + 'px';
		fotoDiv.style.display = 'block';
		fotoDiv.style.width = pic.width + 'px';
	}
	return false;
}
function sluitPlaatInDiv() {
	document.getElementById('transpAchtergrondDiv').style.display = 'none';
	document.getElementById('fotoDiv').style.display = 'none';
	document.getElementsByTagName('body')[0].onkeyup = null;
}
function initLightBoxen() {
	var aas = document.getElementsByTagName('a');
	for (var i = 0, aasL = aas.length; i < aasL; i++) {
		if (aas[i].className.indexOf('lightbox') > -1) {
			aas[i].onclick = toonPlaatInDiv;
		}
	}
}
addOnload(initLightBoxen);

// meerdere onloads handelen
function addOnload(newFunction) {
	var oldOnload = window.onload;
	if (typeof oldOnload == "function") {
		window.onload = function() {
			if (oldOnload) {oldOnload();}
			newFunction();
		}
	} else {window.onload = newFunction;} 
}