/*
 * Script imageWindow.js written by Dan Berger, copyright 2005
 *	These functions may be used or modified freely, with the following conditions:
 *	1. The functions may not be sold or otherwise used to generate revenue in any way.
 *	2. The functions, if used as-is, must include this copyright block.
 *
 *	imageWindow.js uses the universal newWindow object which may already have been set
 * 	by other scripts; therefore, before creating the object, it checks to see whether 
 *	the object exists.
 *
 *	function imageWindow(theURL, theWidth, theHeight):
 *	This function is intended for displaying image files in new windows. It takes three
 *	parameters:
 *		theURL is the complete web address of the image
 *		theWidth is the width of the image in pixels
 *		theHeight is the height of the image in pixels
 *
 *	imageWindow uses an internal constant, sizeAdjust, to allow for necessary padding in the
 *	pop-up window. The variable myWidth is set to theWidth + sizeAdjust; but the variable
 *	myHeight is set to theHeight + _twice_ sizeAdjust, to allow for a "close window" link.
 *
 *	imageWindow opens a new window of width "myWidth" and height "myHeight" with no other 
 *	parameters. It then writes some simple HTML to the window, centered. This includes an 
 *	IMG tag with src = theURL, and a "close window" link.
 */

if (!newWindow) {
	var newWindow = new Object();
	newWindow.closed = true;
}

function imageWindow(theURL, theWidth, theHeight) {
	var sizeAdjust = 25; // add to size of image to give padding in window
	var myWidth = theWidth + sizeAdjust;
	var myHeight = theHeight + 2*sizeAdjust;
	if (!newWindow.closed) newWindow.close();
	newWindow = window.open("","","width=" + myWidth + ",height=" + myHeight + ",resizable");
	newWindow.document.write("<html><head><title>no name</title><style type=\"text/css\">body {background: #fff; color: #000; font: x-small sans-serif;}</style>");
	newWindow.document.write("</head><body><p align=\"center\">");
	newWindow.document.write("<img src=\"" + theURL + "\" border=\"0\">");
	newWindow.document.write("<br><a href=\"javascript: close()\">Close window</a>");
	newWindow.document.write("</p></body></html>");
	newWindow.document.close();
	newWindow.moveTo(15,15);
	newWindow.focus();
	return;
}
