var opened = false;

function showpic(file,width,height) {
	if(opened) {
	picture.close();
	}

var positionx=(screen.availWidth-width)/2;
var positiony=(screen.availHeight-height)/2;
picture = window.open("showpic.php?file="+file,"picture","toolbar=no,scrollbars=no,resizable=no,width="+width+",height="+height+",screenx="+positionx+",screeny="+positiony+",left="+positionx+",top="+positiony);
picture.focus();
opened = true;

}
