/*
	VERSION 1.10

	Last updated: Friday, September 14, 2001 12:56 PM

	Handles creation of all popupwindows
*/
function popupWindow(width, height) {
		
	// PROPERTIES
	this.alwaysCentered = false;
	this.scrollbars = "yes";
	this.width = width;
	this.height = height;
	this.x = parseInt((screen.availWidth-this.width)/2);
	this.y =	parseInt((screen.availHeight-this.height)/2);
	this.url = null;
	this.thePopup = null;
	this.name = 'popupwindow';
	
	// METHODS
	this.setUrl = setUrl;
	this.setWidth = setWidth;
	this.setHeight = setHeight;
	this.setScrollbar = setScrollbar;
	this.setName = setName;
	this.alwaysCenter = alwaysCenter;
	this.show = show;
	this.getOptions = getOptions;
}

function alwaysCenter(value) {
	if (value == true) {
		this.alwaysCentered = true;
	}
	else {
		this.alwaysCentered = false;
	}
}

function setUrl(url) {
	this.url = url;
}

function setWidth(width) {
	this.width = width;
}

function setHeight(height) {
	this.height = height;
}

function setScrollbar(value) {
	this.scrollbars = value;
}

function setName(name) {
	this.name = name;
}

function getOptions() {
	return "toolbar=no,location=no,status=no,menubar=no,scrollbars="+this.scrollbars+",resizable,alwaysRaised=no,titlebar=no,width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y;
}

function show() {
	if (arguments.length > 0) {
		var url = arguments[0];
	}
	else {
		var url = this.url;
	}

	if (arguments.length == 3) {
		this.width = arguments[1];
		this.height = arguments[2];
	}

	if (this.thePopup == null) {
		this.thePopup = window.open(url, this.name, this.getOptions());
		this.thePopup.focus();
		this.thePopup.moveTo(this.x,this.y);
	}
	else {
		this.thePopup = window.open(url, this.name, this.getOptions());
		//this.thePopup.resizeTo(this.width, this.height);
		this.thePopup.focus();
	}

	if (this.alwaysCentered) {
		var x = parseInt((screen.availWidth-this.width)/2);
		var y = parseInt((screen.availHeight-this.height)/2);
		this.thePopup.moveTo(x,y);
	}
}
