// Culled from so many different places, it's not possible to credit anyone but the internet as a whole

function OpenAlbumPhoto(imgNum, horiz, vert, caption) {       
//newWindow=window.open("images/"+imgNum+".jpg","newWin","scrollbars=no,resizable=no,width=720,height=760,left="+(screen.width-700)/2+",top="+(screen.height-900)/2);
//newWindow=window.open("","newWin","scrollbars=no,resizable=no,width=720,height=760,left="+(screen.width-700)/2+",top="+(screen.height-900)/2);

var scrollup = "no";
if (vert < screen.height-80) {
	var winheight=(screen.height-vert-100)/2;
	}
else {
	var winheight=40;
	var scrollup="yes";
	var vert=screen.height-80;
	}

if (horiz < screen.width-80) {
	var winwidth=(screen.width-horiz+20)/2;
	}
else {
	var winwidth=40;
	var scrollup="yes";
	var horiz=screen.width-80
}

newWindow=window.open("","newWin","resizable=no,status=no,menubar=no,scrollbars="+scrollup+",width="+horiz+",height="+vert+",left="+winwidth+",top="+winheight);
newWindow.window.resizeTo(horiz,vert);
newWindow.window.moveTo(winwidth,winheight)
newWindow.document.clear()
newWindow.document.write ("<html><head><title>Photo Album</title></head><body><center><img name='mainimage' border='0' src='images/");
newWindow.document.write (imgNum);
newWindow.document.write (".jpg'><BR><BR>");
newWindow.document.write (caption);
newWindow.document.write ("</center></body></html>");
newWindow.document.close()
newWindow.focus()

}
