/*******************************************************************************
PopupWindow Object
File:		Popup.js
Purpose:	Window popup
Author:		Kevin Yip Yuk Lap
Version:	1.1 (Apr 2001)
*******************************************************************************/
function PopupWindow(name, path, width, height)
{
	// Mandatory parameters
	this.name = (name==null) ?"popupWin" :name;
	this.path = path;
	this.width = width;
	this.height = height;

	// Optional parameters
	this.copyhistory = 1;
	this.directories = 'no';
	this.location = 0;
	this.menubar = 0;
	this.resizable = 1;
	this.scrollbars = 'no';
	this.status = 'no';
	this.toolbar = 'no';

	this.obj = 'PopupObject_' + this.name;
	eval(this.obj + '=this');
}

{
	// Object functions
	var pwp = PopupWindow.prototype;
	pwp.show = PopupWindowShow;
	pwp.buildAttStr = PopupBuildAttStr;
}

function PopupWindowShow()
{
	var attStr = this.buildAttStr();
	eval(this.name + ' = window.open("' + this.path + '", "' + this.name + '", "' + attStr + '");');
	eval(this.name + '.focus();');
//	if ((this.x != null) && (this.y != null))
//		eval(this.name + '.moveTo(' + this.x + ',' + this.y + ');');
}

function PopupBuildAttStr()
{
	var tempStr = '';
	tempStr += 'copyhistory=' + this.copyhistory + ',';
	tempStr += 'directories=' + this.directories + ',';
	tempStr += 'location=' + this.location + ',';
	tempStr += 'menubar=' + this.menubar + ',';
	tempStr += 'resizable=' + this.resizable + ',';
	tempStr += 'scrollbars=' + this.scrollbars + ',';
	tempStr += 'status=' + this.status + ',';
	tempStr += 'toolbar=' + this.toolbar + ',';

	if (this.x != null)
		tempStr += 'left=' + this.x + ',screenX=' + this.x + ',';
	if (this.y != null)
		tempStr += 'top=' + this.y + ',screenY=' + this.y + ',';

	tempStr += 'height=' + this.height + ',';
	tempStr += 'width=' + this.width;

	return tempStr;
}

