basehref='';

var resized_images = new Array();
var maxImageWidth = 500;
	function fullsize(){
		var oSource = window.event.srcElement.src;
		var w = window.event.srcElement.width;
		var h = window.event.srcElement.height;
		var myleft = (screen.width)?(screen.width-w)/2:100;
		var mytop = (screen.height)?(screen.height-h)/2:100;
		myleft = 0;
		mytop = 0;
		tempvar = resized_images[oSource];
		showpopupwindow = window.open('', "_blank","toolbar=no,location=no,menubar=no,scrollbars=no,status=no,left="+myleft+",top="+mytop+""+tempvar);
		showpopupwindow.document.writeln("<html><head><title>" + unescape(oSource) +  "</title>");
		showpopupwindow.document.writeln("</head><body topmargin=\"0\" leftmargin=\"0\" marginheight=\"0\" marginwidth=\"0\">");
		showpopupwindow.document.writeln("<img src=\"" + oSource + "\" onclick=\"window.close()\" title=\"Klik om dit venster te sluiten\">");
		showpopupwindow.document.writeln("</body></html>");
		showpopupwindow.document.close();
	}

	function resize(image){
		if(!image){
			var image = window.event.srcElement;
		}

		width = image.width;
		height = image.height;
		var url = image.src;

		if(width>maxImageWidth){
			resized_images[url] = ",width="+width+",height="+height;
			image.width = maxImageWidth;
			image.title = 'Originele grootte: '+width+'x'+height;
			image.style.border = "solid 1px black";
			image.style.cursor = "pointer";
			image.onclick = fullsize;
			image.height = Math.floor(height/(width/(maxImageWidth)));
		}
	}

	function check_images(){
		count = document.images.length;
		i = 0;

		while(count>i){
			imgurl = document.images[i].src;
			if(imgurl.match(basehref)){
				if(document.images[i].complete){
					resize(document.images[i]);
				}else{
					document.images[i].onload = resize;
				}
			}
			i++;
		}
	}