var i = new Image();

function displayimg(photo,w,h) {
	if (window.innerHeight)
	{
		  posy = window.pageYOffset;
		  posx = window.pageXOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
	{
		posy = document.documentElement.scrollTop;
		posx = document.documentElement.scrollLeft;
	}
	else if (document.body)
	{
		  posy = document.body.scrollTop;
		  posx = document.body.scrollLeft;
	}

	var l = document.getElementById('loading');
	l.style.top = ((document.documentElement.clientHeight/2) - (45) + posy) +"px";
	l.style.left = ((document.documentElement.clientWidth/2) - 90 + posx) +"px";
	l.style.display = 'block';

	i.src = photo.src.replace("_s","");

	var p = document.getElementById('photoview');
	var pb = document.getElementById('photobar');
	photoheight = h + 10;
	photowidth = w + 20;
	p.style.top = ((document.documentElement.clientHeight/2) - (photoheight/2) + posy) +"px";
	p.style.left = ((document.documentElement.clientWidth/2) - (photowidth/2) + posx) +"px";
	p.style.width = photowidth+"px";
	pb.style.width = photowidth+"px";
	p.style.height = photoheight+"px";

	i.onload = function() {
		document.getElementById('photoviewimg').src = i.src;
		l.style.display ='none';
		p.style.display ='block';
	}
}

function closephoto() {
	document.getElementById('photoview').style.display='none';
	window.status = "";
}