
/* ----------------------------------------------------------------------------

   $RCSfile: popup.js,v $ $Name:  $
   $Date: 2006/09/05 22:15:57 $ $Revision: 1.2 $
   ============================================================================
   When        Who        What
   ----------------------------------------------------------------------------
   2006-01-20  amm        Popup constructor created
   ============================================================================

   Notes:

		- Popup window object

   Usage:

		<script>

		// Prepare the preview popup
		var preview = new Popup();
		preview.window_name = "preview_popup";
		preview.url = "/ecard_preview.asp";
		preview.width = "500";
		preview.height = "300";

		</script>

		<img src="/images/preview.gif" onclick="preview.pop(); return false;">

   ------------------------------------------------------------------------  */

function Popup(url, window_name, width, height, scrollbars, resize, toolbar, status, left, top)
{
	// variables
	var parent_obj = this;  // for reference in sub-functions

	// properties
	this.name = "Popup";
	this.url = (arguments.length > 0) ? url : '';
	this.window_name = (arguments.length > 1) ? window_name : 'popup';
	this.width = (arguments.length > 2) ? width : '640';
	this.height = (arguments.length > 3) ? height : '480';
	this.scrollbars = (arguments.length > 4) ? scrollbars : 'no';
	this.resize = (arguments.length > 5) ? resize : 'yes';
	this.toolbar = (arguments.length > 6) ? toolbar : 'no';
	this.left = (arguments.length > 7) ? left : '300';
	this.top = (arguments.length > 8) ? top : '200';

	// pop: make the window popup
	this.pop = function()
	{
		window.open(
					this.url, 
					this.window_name, 
					'toolbar=' + this.toolbar + ',' + 
					'width=' + this.width + ',' + 
					'height=' + this.height + ',' + 
					'left=' + this.left + ',' + 
					'top=' + this.top + ',' + 
					'status=' + this.status + ',' + 
					'scrollbars=' + this.scrollbars + ',' + 
					'resize=' + this.resize
					);
	}
}
