var winTitle="The Stag Image Window"; // Description you want in the title bar.

var imgWinOn = false;

function showImg(imageName, imgWidth, imgHeight)
{
	var scWidth=0; var scHeight=0;
	if (imgWidth+20>screen.availWidth) { 
		scWidth = screen.availWidth; 
	} else { 
		scWidth= imgWidth; 
	}
	if (imgHeight+60>screen.availHeight-30) { 
		scHeight = screen.availHeight-30; 
	} else { 
		scHeight = imgHeight+60; 
	}

	var winName = imageName.substring(0,imageName.length-4);

	imgWin=window.open('', winName, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=' + scWidth +',height=' + scHeight+',screenX=0,screenY=0');

	imgWin.document.write('<HTML><HEAD><TITLE> ' + winTitle +' </TITLE></HEAD><BODY marginheight=0 topmargin=0 leftmargin=0 marginwidth=0>');
	imgWin.document.write('<SCRIPT language="Javascript">self.moveTo(0,0);imagePos = location.search.indexOf("img=");imageName=location.search.substring(imagePos+4,location.search.length);</SCR');
	imgWin.document.write('IPT><p><img src="' + imageName + '"><div align=center><a href="javascript:top.close();">Close</a></div></p></BODY></HTML>');
	imgWin.document.close();

	return false;
}
