var i = 1; 
var numWin = 8;

// browser id
var isIE = (navigator.appName == "Microsoft Internet Explorer"
	&& parseInt(navigator.appVersion) >= 4) ? true : false;
var isNS = (navigator.appName == "Netscape" && 
	parseInt(navigator.appVersion) >= 4) ? true : false;

function picWin(url, alt, gWidth, gHeight)
{
var winParms = 'copyhistory=no,directories=no,location=no,' +
'menubar=no,toolbar,resizable,scrollbars=no,status=no';

var p = window.open('', 'p' + i, winParms);

//increment i if i is not equal to the max number of windows
i == numWin ? i = 1 : i++;
	
//create html to write to the new window
var w = '';

if (isNS && parseInt(navigator.appVersion) >= 5) {
w += '<head>\r';
w += '<script language="Javascript">\r';
w += 'function winResize() {\r';
w += '\twindow.moveTo((screen.width - gWidth) / 2, ';
w += '(screen.height - gHeight) / 2);\r';
w += '}\r';
w += '</script>\r';
w += '</head>\r';
w += '\r'; }

w += '<body onload="winResize()" leftmargin="0" topmargin="0" ' +
		'marginheight="0" marginwidth="0" margin="0">\r';
w += '<img alt="' + alt + '" src="' + url + '">\r';
w += '</body>';

//open the document in the window and write the image to it
p.document.open();
p.document.write(w);
p.document.close();
p.document.title = alt;
	
if (isIE) {
//resize window to fit image
p.resizeTo(0, 0);
p.resizeBy(Math.ceil(gWidth)-91, Math.ceil(gHeight)-71);}
else if (isNS) {
p.innerHeight = imgHeight;
p.innerWidth = imgWidth;
}
else alert("Your browser cannot process this script.");

//center the image window on the screen and give it focus
var globalLeft = (screen.width - gWidth) / 2;
var globalTop  = (screen.height - gHeight) / 2;
p.moveTo(globalLeft, globalTop);
p.focus();
}