var picture = null;

function openpic(path) {
	if(window.picture){picture.close(); picture=null;}
	var image = new Image;
	image.onload = function () {
		picture=window.open('','picture','width=1,height=1,resizable=yes,scrollbars=no');
		picture.document.write('<html><head><title>Picture<\/title><\/head><body style="overflow:hidden" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" scroll="no"><img src="' + this.src + '" onload="opener.resize(this.width, this.height)" onclick="opener.picture=null;self.close();" \/>');
		picture.document.close();
	}
	image.src = path;
}
function resize(width,height) {
	picture.resizeTo(width+10,height+50);
	picture.moveTo((screen.width-width)/2,(screen.height-height)/2);
}