//script taken from fokforum, http://forum.fok.nl
//adapted for Hadrian Forum http://forum.hadrian.net

var resized_images_width = new Array();
var resized_images_height = new Array();

	function fullSize(){
		scrollbars = 0;
		var oSource = window.event.srcElement.src;
		width = resized_images_width[oSource];
		height = resized_images_height[oSource];
		width = width;
		height = height;

		url = this.src;

		if(width > screen.availWidth){
			width = screen.availWidth;
			scrollbars = 1;
		}

		if(height > screen.availHeight){
			height = screen.availHeight;
			scrollbars = 1;
		}

		fullscr = window.open("../tickets/picspop.cgi?url="+url, "_blank","toolbar=no,location=no,menubar=no,fullscreen="+scrollbars+",channelmode="+scrollbars+",scrollbars="+scrollbars+",status=no,left=0,top=0,width="+width+",height="+height);
	}

	function resize(image){
		if(!image){
			var image = window.event.srcElement;
		}

		width = image.width;
		height = image.height;
		var url = image.src;
		var threshold = 600;

		if(width>threshold){
			resized_images_width[url] = width;
			resized_images_height[url] = height;
			image.width = 600;
			image.alt = 'Klik voor originele grootte ('+width+'x'+height+')';
			image.style.border = "dotted 1px black";
			image.style.cursor = "hand";
			image.onclick = fullSize;
			image.height = Math.floor(height/(width/threshold));
		}
	}

	//image resize function, thanks to Fok!
	function check_images(hostName){
		count = document.images.length;
		i = 0;
		while(count>i){
			url = document.images[i].src;
			if(!url.match(hostName)){
				if(document.images[i].complete){
					resize(document.images[i]);
				}else{
					document.images[i].onload = resize;
				}
			}
			i++;
		}
	}