<!-- Original:  Ronnie T. Moore, Editor -->
<!-- Modified:  Jerry Schwartz, Write by Night -->
<!-- Web Site:  The JavaScript Source -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
// Close window after __ number of seconds?
// 0 = do not close, anything else = number of seconds

function LaunchImage(URL, WIDTH, HEIGHT, TITLE, timeout) 
{

// If height or width are not specified, set them automatically

	myimage = new Image(); // This must not be a local variable
	myimage.src = (URL);

	if (HEIGHT == 0) {HEIGHT = myimage.height};
	if (WIDTH == 0) {WIDTH = myimage.width};

	if ((WIDTH == 0) || (HEIGHT == 0)) 
	{
		functioncall = "WaitAwhile('" + URL + "'," + WIDTH + ","
			+ HEIGHT + "," + "'" + escape(TITLE) + "'," + timeout + ")";
		setTimeout(functioncall,20)
	}
	else
	{
		ShowThePicture(URL,WIDTH,HEIGHT,TITLE,timeout)
	}
}

function WaitAwhile(URL,WIDTH,HEIGHT,TITLE,timeout)
{
	TITLE = unescape(TITLE);	// Undo any previous escaping, or they accumulate!
	if (HEIGHT == 0) {HEIGHT = myimage.height};
	if (WIDTH == 0) {WIDTH = myimage.width};
	if ((WIDTH == 0) || (HEIGHT == 0))
	{
		functioncall = "WaitAwhile('" + URL + "'," + WIDTH + ","
			+ HEIGHT + "," + "'" + escape(TITLE) + "'," + timeout + ")";
		setTimeout(functioncall,20);
	}
	else
	{
		ShowThePicture(URL,WIDTH,HEIGHT,TITLE,timeout);
	}
}

function ShowThePicture(URL,WIDTH,HEIGHT,TITLE,timeout)
{

	if (timeout == 0) HEIGHT += 50;	//	Leave room for the "close" text
	
	HEIGHT += 50;	//	Add some white space around the picture
	WIDTH += 50;

	wintop = (screen.height - HEIGHT) / 2;
	winleft = (screen.width - WIDTH) / 2;

	TITLE = unescape(TITLE);
	
	windowprops = "left=" + winleft + ",top=" + wintop + ",width=" + WIDTH + ",height=" + HEIGHT
		+ ",scrollbars=yes";

	text = "<html><head><title>" + TITLE + "</title></head><body bgcolor='white'";

	if (timeout != 0) text +=" onLoad=\"setTimeout('window.close()', " + timeout*1000 + ");\"";

	text += "><center>";

	if (timeout == 0) text += "<p><a href='javascript:window.close();'>Close</a><p>";

	text += "<img src='" + URL + "'>";

	if (timeout != 0) text +="<br><font face='arial, helvetica' size='-1'>Image closes after " + timeout + " seconds.</font>";

	text += "</center></body></html>";


	preview = window.open("", "preview", windowprops);
	preview.document.open();
	preview.document.write(text);
	preview.document.close();
}


//  End -->

