I am using the Popup Window Generator script http://www.dynamicdrive.com/dynamicindex8/popwin.htm, and I would like to customize the window somewhat, if possible. I would like an image to pop up when a thumbnail is clicked on, so I put:

<a href="images/fullsize1.jpg" onclick="NewWindow(this.href,'fullsize','500','500','no','center');return false" onfocus="this.blur()"><img src="images/pent1.jpg" width="80" height="80" border="0" alt="Amboyna Statesman" /></a>

But when the window pops up, it is slightly bigger than the image (even though the image is the same size as I specified the window to be) and the image is not centered. How can I either 1) make the window the same size as the image, or 2) center the image in the window and change the window background to a color other than white? Also, would it be possible to add a caption to the image in the window?

Thanks in advance for any tips!

Script follows:

<script language="javascript" type="text/javascript">
<!--
/****************************************************
Author: Eric King
Url: http://redrival.com/eak/index.shtml
This script is free to use as long as this info is left in
Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
****************************************************/
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,re sizable=no';
win=window.open(mypage,myname,settings);}
// -->
</script>

Insert the following code into your html document where you want the link:

<a href="images/fullsize1.jpg" onclick="NewWindow(this.href,'fullsize','500','500','no','center');return false" onfocus="this.blur()"><img src="images/pent1.jpg" width="80" height="80" border="0" alt="Amboyna Statesman" /></a>