I have a PHP page with a Javascript image popup function in the <head>
area. Page layout is by CSS. You can see it here:
        http://www.allnovascotia.com/test/sandwichchef/index.php
Menu buttons on the side reload the page, and a value passed in the URL
controls what is loaded and displayed in the centre column.

If the page is loaded with NO query string, just
.../sandwichchef/index.php the popup works fine. If Ctrl+R is pressed to
reload the page, no problem.

If the page is loaded WITH a query string (or one of the buttons is
clicked), such as ../sandwichchef/index.php?pgget=1, the popup script
executes, but no picture is loaded , just a black box with a missing
image symbol.

Nothing shows up in the Javascript console. 

Is the problem the reliance of the popup code on passing an URL, but the
browser already has a different query string stored?

Here's a link to the main page:
        http://www.allnovascotia.com/test/sandwichchef/index.phps
The included files contain nothing but text.

The popup page (popPic.htm) is v. short and is presented below my
signature.

I'm really puzzled and suggestions / guidance will be most welcome.

Regards - Miles Thompson

popPic.htm:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
 <TITLE>SandwichChef - Guildford, Surrey - What good food!</TITLE>
 <script language='javascript'>
   var arrTemp=self.location.href.split("?");
   var imgname = (arrTemp.length>1)?arrTemp[1]:"";
   var referrer = (document.referrer);
   var NS = (navigator.appName=="Netscape")?true:false;

     function FitPic() {
       iWidth = (NS)?window.innerWidth:document.body.clientWidth;
       iHeight = (NS)?window.innerHeight:document.body.clientHeight;
       iWidth = document.images[0].width - iWidth;
       iHeight = document.images[0].height - iHeight;
       window.resizeBy(iWidth, iHeight);
       self.focus();
     };
 </script>
</HEAD>
<BODY bgcolor="#000000" onload='FitPic();' topmargin="0"  
marginheight="0" leftmargin="0" marginwidth="0">
 <script language='javascript'>
 document.write( "<img src='" + referrer + imgname +"' border=0>" );
 </script>
</BODY>
</HTML>