function getSize()
{
	var arSizes=new Array(2);
	arSizes[0]=0;
	arSizes[1]=0;
	
	if (typeof(window.innerWidth)=='number')
	{
		arSizes[0]=window.innerWidth;
		arSizes[1]=window.innerHeight;
	}
	else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
	{
		arSizes[0]=document.documentElement.clientWidth;
		arSizes[1]=document.documentElement.clientHeight;
	}
	else if (document.body && (document.body.clientWidth || document.body.clientHeight ))
	{
		arSizes[0]=document.body.clientWidth;
		arSizes[1]=document.body.clientHeight;
	}
	
	return (arSizes);
}

function hideImage()
{
	document.getElementById("photobox").style.display="none";
	document.getElementById("photoback").style.display="none";
}

function showWhenloaded()
{
	if (document.getElementById("photo").complete)
	{
		document.getElementById("photobox").style.display="block";
	}
	else
	{
		setTimeout("showWhenloaded()",100);
	}
}

function showImage(strImage,intWidth,intHeight)
{
	if (document.getElementById("photobox"))
	{
		// Show the popupbox and show the text string in it
		var arSizes=getSize();
		objPhotobox=document.getElementById("photobox");
		objPhoto=document.getElementById("photo");
		objPhotobox.style.display="none";
		document.getElementById("photoback").style.display="block";
		objPhoto=document.getElementById("photo");
		//objPhoto.onload=function() {document.getElementById("photo").style.display="block";}
		objPhoto.src="";
		objPhoto.src="/photos/"+strImage+".jpg";
		objPhotobox.style.height=intHeight+"px";
		objPhotobox.style.width=intWidth+"px";
		objPhotobox.style.top=arSizes[1]/2-(intHeight/2);
		objPhotobox.style.left=arSizes[0]/2-(intWidth/2);
		setTimeout("showWhenloaded()",100);
	}
	else
	{
		var arSizes=getSize();
		objBack=document.createElement("div");
		objBack.id="photoback";
		objBack.style.top=0;
		objBack.style.left=0;
		objBack.style.position="absolute";
		objBack.style.backgroundColor="#000000";
		objBack.style.height="100%";
		objBack.style.width="100%";
		objBack.style.zIndex="1";
		objBack.style.opacity=".85";
		objBack.style.filter="alpha(opacity=85)"
		objBack.style.display="block";

		// The popup box doesn't exist yet so create it
		objPhotobox=document.createElement("div");
		objPhotobox.id="photobox";
		objPhotobox.align="center";
		objPhotobox.style.position="absolute";
		objPhotobox.style.backgroundColor="#FFFFFF";
		objPhotobox.style.zIndex="2";
		objPhotobox.innerHTML="<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td align=\"right\"><div onclick=\"hideImage()\" style=\"font-size: 12px;cursor: pointer;padding-top: 4px;padding-right: 3px;\"><strong>Sluit</strong> <img src=\"/images/img_close.gif\" align=\"absolutebottom\"></div></td></tr><tr><td><img id=\"photo\"></div></td></tr></table>";
		document.body.appendChild(objBack);
		document.body.appendChild(objPhotobox);
		objPhoto=document.getElementById("photo");
		objPhoto.src="/photos/"+strImage+".jpg";
		objPhotobox.style.height=intHeight+"px";
		objPhotobox.style.width=intWidth+"px";
		objPhotobox.style.top=arSizes[1]/2-(intHeight/2)-16;
		objPhotobox.style.left=arSizes[0]/2-(intWidth/2);
		objPhotobox.style.display="block";
	}
}
