All pastes #763549 Raw Edit

Stuff

public text v1 · immutable
·published 2007-11-06 15:36 UTC
rendered paste body
function PopUpJavaScriptCode($Width, $Height, $Top, $Left, $Extras = "resizable=1,status=0,menubar=0,toolbar=0,scrollbars=1,location=0,directories=0")
{
	// Outputs the needed Javascript functions to create pop-up windows
	// $WidthPercent : The pop-up window will be this percentage of the total width of the clients screen
	// $HeightPercent: The pop-up window will be this percentage of the total height of the clients screen
	
	$Width = intval($Width);
	$Height = intval($Height);
	$Top = intval($Top);
	$Left = intval($Left);
	
	if ($Extras) $Extras = "," . $Extras;
	
	?>
	<SCRIPT language="JavaScript" type="text/javascript">
		var newwindow = '';
		var width = <? print $Width; ?>;
		var height = <? print $Height; ?>;

		function popup(url)
		{
			newwindow=window.open(url,'PopUpWindow','width='+width+',height='+height+',top=<? print $Top; ?>,left=<? print $Left; ?><? print $Extras; ?>');
			newwindow.focus();
			if (newwindow.opener == null) newwindow.opener = self;
		}

		function tidy()
		{
			if (newwindow.location && !newwindow.closed)
			{ 
				newwindow.close();
			}
		}
	</SCRIPT>
	<BODY onUnload="tidy()">
	<?
}