
<!-- // hide script from older browsers, just in case....

/****************************************************
* Heritage Web Solutions Popup Script               *
* (c) 2005 Mike Porter and HWS Internet             *
* All Rights Reserved                               *
* USAGE: hwspopup(target,height,width, options )    *
*   opens a popup window pointing at target         *
*   width and options can be preset for consistency *
*   if the popup window is already open, will resize*
*   the window to height, width and point to target *
* EXAMPLE:                                          *
*   <a onClick=hwspopup(my.url,200,200)>test</a>    *
****************************************************/
 $handle=false;

function hwsResize (mywin) {
		$work=mywin.document.getElementById('img');
		$table=mywin.document.getElementById('main');
		$width=$work.width + 28; //resizeTo resizes the OUTSIDE of the window...
		$height=$work.height + 83;
		if ($table.width < $work.width) {$width = $table.width;alert('test');}
		if ($table.width < $work.width) {$width = $table.width;alert('test');}
		mywin.resizeTo($width+20,$height+20);
		mywin.resizeTo($width,$height);
	}
	
function hwsWindow (handle) {
		handle.document.write('<html><head>');
		handle.document.write('<title>Gallery</title>\n');
		handle.document.write('<link rel="stylesheet" type="text/css" href="stylesheet.css"></head>\n');
		handle.document.write('<body onLoad="winResize();">\n');
		handle.document.write('<script>\n');
		handle.document.write('function winResize () {\n');
		handle.document.write('var $work=document.getElementById(\'img\');\n');
		handle.document.write('var $table=document.getElementById(\'main\');');
		handle.document.write('$width=$work.width; \n');
		handle.document.write('$height=$work.height;\n');
		handle.document.write('$table.innerHTML="<img src=images/spacer.gif height=\" + $height + \" width= \" + $width + \">"\n');
		handle.document.write('$width+=  28; \n');
		handle.document.write('$height+= 83;\n');
		handle.document.write('this.resizeTo($width+40,$height+40);\n');
		handle.document.write('this.resizeTo($width,$height);\n');handle.document.write('}\n');
		handle.document.write('</script>\n');
		handle.document.write('<table align=center border="0">');
		handle.document.write('<tr><td   id="main" class="main" background="'+ $target + '" style="background-repeat:no-repeat;background-position:center">');
		handle.document.write('<img id="img" src="' + $target + '" border="2" id="img" >');
		handle.document.write('</td></tr><tr><td><p class="center">');
		handle.document.write('<a class="dark" href="javascript:self.close()"><font size=3> Close </font></a></p>');
		handle.document.write('</td></tr></table>');
		handle.document.write('</body>');
		handle.document.close();
		
		//handle.document.getElementById('img').onload = function () { hwsResize(handle);};
		//setTimeout('hwsResize($passOn)','400');
		
		}
		
function hwspopup () {
	// define defaults:
	$target="#";
	$height=300;
	$width=300;
	$options='status=0, resizeable=0, scrollbar=0,toolbar=0,menubar=0,location=0';
	var i, args=hwspopup.arguments; //using args allows me to flex how many arguments we are passed
	$target=args[0];
	if (args.length > 1) {
		$height=args[1];
		}
	if (args.length > 2) {
		$width=args[2]; 
		}
	if (args.length > 3) {
		$options=''; //if we passed options, override the defaults
		for (i=3; i < args.length; i++) {
			$options+=(args[i] + ", ");
			}
		}
	$options+=(", height=" + $height + ", width=" + $width);	
	$handle=window.open("images/spacer.gif",'popup',$options);
	//window.open("",'popup',$options); 
	//calling window.open() with no URLstr returns a handle to the 
	// window with that name or opens a new window if none exists.
	if ($handle) {
		setTimeout('hwsWindow($handle)','100');
		setTimeout('$handle.focus()','500');
	}
	
} //end function hwspopup();	 	
// end script hiding -->
