function openWin($url, $about)
{
/*
	Spun off by copying same code from AESE site. 
	Has a little more power than I currently use in the OPAS site.
	I'm only passing a URL ... single parameter calls.

	Input:
	-- $url (required) is of the form www.hashes.com
		Exception: if 'h_' prefix, open Help window for the page specified;
	-- $about (optional); open a special window for About link
	-- g_mode (optional): = 'test' or 'prod'

	WARNING: don't use $prefix on JS globals set in PHP, as it can fool
		PHP into thinking they are PHP globals

*/
	// return any globals to my standard "$" prefix on JS variables
	$g_mode = g_mode;

	if ($url.indexOf('h_') == 0)	{
		$url_type = 'help';
		$full_url = 'http://www.aese.org/help/' + $url + '.html';
	}
	else	{
		$url_type = 'normal';
		$top_url = 'http://' + $url;
		$full_url = $top_url;
	}
	// handle $g_mode, if set
	if ($g_mode == 'test')	{
		// If staying on the site, need to retain test mode.
		// The test on 'shell.html' deliberately ignores the About links,
		// which while technically staying on the site, don't get a menu.
		if ($url.indexOf('shell.html') > 0)	{
			if ($url.indexOf('?')  > 0)	{
				$full_url = $top_url + '&mode=test';
			}
			else	{
				$full_url = $top_url + '?mode=test';
			}
		}
	}

	if (openWin.arguments.length == 2)
	        var $windowRef = open ($top_url, "aboutWin", 'width=500,height=200,toolbar=no,scrollbars=yes,location=no,menubar=no,resizable=yes,left=30,top=30,screenx=30,screeny=30'); 
	else	{
		if ($url_type == 'normal')
	        var $windowRef = open ($full_url, "displayWin", 'width=500,height=300,toolbar=yes,scrollbars=yes,location=yes,menubar=no,resizable=yes,left=170,top=190,screenx=170,screeny=190'); 
		else
	        var $windowRef = open ($full_url, "helpWin", 'width=300,height=550,toolbar=no,scrollbars=yes,location=no,menubar=no,resizable=yes,left=0,top=0,screenx=0,screeny=0'); 
	}
        $windowRef.focus(); // ensure new window on top
}	// end of openWin()

// ========================================================================
function openWinBird($num, $id)
{
/*
	Purpose: spun off from general purpose function openWin($url, $about) 
	to compress generated HTML code by taking advantage of repeated links 
	to the same handful of base URLs.

	Input:
	-- $num (required) ... specifies one of a set of pre-determined URLs
	-- $id (required) bird id num for the sit specified by $url_num
	-- g_mode (required): = 'test' or 'prod'

	WARNING: don't use $prefix on JS globals set in PHP, as it can fool
		PHP into thinking they are PHP globals

*/
	// return any globals to my standard "$" prefix on JS variables
	$g_mode = g_mode;

	$url_type = 'normal';

	// WARNING: BirdWeb URL much too complex for this simple treatment, so not using.
	// Ex: www.birdweb.org/birdweb/family_EZ.asp?famname=Phasianidae

	// line numbers in next comments identify approx. code location in html_build.pl
	// entries: 1 - BirdWeb, bird family  ... 590
	//				2 - Pax River, species ... 635
	//				3 - Pax River, BBS ... 685
	//				4 - Pax River, CBC ... 685
	//				5 - Pax River, Life History
	//				6 - Pax River, Video
	// life history: <a href="../Lifehistory/lh4780.html" 
	// http://www.mbr-pwrc.usgs.gov/id/framlst/Lifehistory/lh4780.html ... this works
//href="../BBSMap/ra1430.gif" TARGET="ACCOUNT"><img src="../ball10.gif" alt="*" border="0"> BBS Map </a>
//<br><a href="../CBCMap/ra1430.gif"
	// video: /Video/h1430v1.mov" 

// old BBS: 'www.mbr-pwrc.usgs.gov/bbs/htm96/map617/ra',
// old CBC: 'www.mbr-pwrc.usgs.gov/bbs/htm96/cbc622/ra',

	$url_prefix = new Array(
'www.birdweb.org/birdweb/family_',
'www.mbr-pwrc.usgs.gov/id/framlst/i',
'www.mbr-pwrc.usgs.gov/id/framlst/BBSMap/ra',
'www.mbr-pwrc.usgs.gov/id/framlst/CBCMap/ra',
'www.mbr-pwrc.usgs.gov/id/framlst/Lifehistory/lh',
'www.mbr-pwrc.usgs.gov/id/framlst/Video/h'
	);
	$url_postfix = new Array(
'filler ... not used',
'id.html',
'.gif',
'.gif',
'.html',
'v1.mov'
	);

	$full_url = 'http://' + $url_prefix[$num] + $id + $url_postfix[$num];
//alert($full_url);
        var $windowRef = open ($full_url, "displayWin", 'width=500,height=300,toolbar=yes,scrollbars=yes,location=yes,menubar=no,resizable=yes,left=170,top=190,screenx=170,screeny=190'); 
        $windowRef.focus(); // ensure new window on top
}	// end of openWinBird()

// ========================================================================
function openWinImage($subpath, $w, $h, $caption)
{
/*
	Purpose: to display an image via a popup box.
	Need smart dynamic sizing of the window.
	For starters, assume image will fit on screen of 800x600 display, with upper
	   left corner of box in from 0,0 by 40 pixels in both X & Y dimensions.

	Input:
	-- $subpath (required) Ex: images/dot.gif, or images/birds/duck.jpg
		Assumes images is folder in subdir holding calling code.
	-- $w (required) -- image width in pixels
	-- $h (required) -- image height in pixels
	-- $caption (required) -- self evident

	WARNING: don't use $prefix on JS globals set in PHP, as it can fool
		PHP into thinking they are PHP globals

	// return any globals to my standard "$" prefix on JS variables
	$g_mode = g_mode;
*/
	$url = 'http://' + 'www.hashes.com/opas/image.php';	// not in /lib re. path to image

	// $subpath, caption are not well behaved re. living in a URL
	$cap = '&cap=' + escape($caption);
	$h_cap = 10;	// vertical space for caption below image; num. matches font size

	$image_parms = '?subpath=' + escape($subpath) + '&w=' + $w + '&h=' + $h + $cap;
	$url += $image_parms;
//alert($url);	// correct $url

/*
        var $windowRef = open ($full_url, "imageWin", 
'width=500,height=300,'
toolbar=yes,scrollbars=yes,location=yes,menubar=no,
resizable=yes,left=170,top=190,screenx=170,screeny=190'); 
*/

	// test suggests we need a pad of 10 pixels or so for each dimens
	// seem to be stuck with a surrounding white border
	$pad = 20;	// set this empirically; okay for horiz
	$wid = $w + $pad;
	// 11/10/04 ... note for future. If caption is too long, want to recognize
	// that by some empirically determined measure here, then icrease the window 
	// height to allow for a two-line caption below the image.
	$hgt = $h + $pad + 4 + $h_cap;	// 4 is vspace in image.php
	$dimens = 'width=' + $wid + ',height=' + $hgt;
	$bars = ',toolbar=no,scrollbars=no,location=no,menubar=no,resizable=no';
	$xy = ',left=40,top=40,screenx=40,screeny=40';
	$window_parms = $dimens + $bars + $xy;
//alert ($parms);

	// want unique window name, so append first 5 chars of caption ... assume its okay
	$win_name = '' + $caption.substring(0, 5);

	// if window open from a previous picture, need to close it ... but
	// don't know $windowRef ... ahhh, but window name is imageWin, so maybe that will work
	$windowRef = open ($url, $win_name, $window_parms);
	$windowRef.focus(); // ensure new window on top

}	// end of openWinImage()

// ========================================================================
function openWinContinue($fn, $title)
{
/*
	Purpose: to continue an article in a separate temp window. This allows
		page overflow without having to otherwise alter the web site
		to accommodate the extra text to display.
	Input:
	-- $fn (required) of .html file holding remainder of an article.
		file must be in /opas/continue/
	-- $title (optional) -- self evident

	WARNING: don't use $prefix on JS globals set in PHP, as it can fool
		PHP into thinking they are PHP globals

	// return any globals to my standard "$" prefix on JS variables
	$g_mode = g_mode;
*/
//alert('top');	
//alert('w=' + $w);
//alert('subpath=' + $subpath); // this works, so we reach here okay
	$url = 'http://' + 'www.hashes.com/opas/continue.php';	// not in /lib re. path to image
	$url += '?fn=' + $fn;
	if (openWinContinue.arguments.length == 2)
		$url += '&title=' + escape($title);
//alert($url);	// correct $url

/*
        var $windowRef = open ($full_url, "imageWin", 
'width=500,height=300,'
toolbar=yes,scrollbars=yes,location=yes,menubar=no,
resizable=yes,left=170,top=190,screenx=170,screeny=190'); 
*/
//        var $windowRef = open ($full_url, "imageWin", 'width=500,height=300,toolbar=yes,scrollbars=yes,location=yes,menubar=no,resizable=yes,left=170,top=190,screenx=170,screeny=190'); 
	// need smart dynamic sizing of the window.
	// for starters, assume image will fit on screen of 800x600 display, with upper
	// left corner in 40 pixels X & Y dimensions.

	$win_name = 'text'; // maybe only need a single reusable window

	// test suggests we need a pad of 10 pixels or so for each dimens
	// seem to be stuck with a surrounding white border
	$wid = 300;
	$hgt = 400;
	$dimens = 'width=' + $wid + ',height=' + $hgt;
	$bars = ',toolbar=no,scrollbars=yes,location=no,menubar=no,resizable=no'; // ok
//	$bars = ',toolbar=no,scrollbars=yes,location=no,menubar=no,resizable=yes'; //test
	$xy = ',left=40,top=40,screenx=40,screeny=40';
	$window_parms = $dimens + $bars + $xy;
//alert ($window_parms);

	// if window open from a previous picture, maybe need to close it ... but
	// don't know $windowRef ... ahhh, but window name is imageWin, 
	// so maybe that will work
	$windowRef = open ($url, $win_name, $window_parms);
	$windowRef.focus(); // ensure new window on top

}	// end of openWinContinue()

