WUNDER.registerNameSpace("WUNDER.HTML");

WUNDER.HTML.PopUp = function(windowId) {
	var that = this;
	
	this.windowId = windowId;
	
	this.URL = "";
	this.toolbar = 0;
	this.scrollbars = 0;
	this.location = 0;
	this.statusbar = 0;
	this.menubar = 0;
	this.resizable = 0;
	this.width = 500;
	this.height = 450;
	this.left = 0;			/* center(true,whatever); will overright left */
	this.top = 0;			/* center(whatever,true); will overright top */

	this.center = function(horizontal, vertical) {
		if (that.width <= 0) {
			that.width = 500;
		}
		
		if (that.height <= 0) {
			that.height = 450;
		}
		
		if (document.all) {
		  	var w = screen.availWidth;
		  	var h = screen.availHeight;
		} else {
		    var w = screen.width;
		    var	h = screen.height;
		}
		
		if (horizontal) {
			that.left = .5*w - .5*that.width;
		}
		
		if (vertical) {
			that.top = .5*h - .5*that.height;
		}
		
		return true;
	};

	this.pop = function(URL) {
		var result = window.open(URL || that.URL,
			that.windowId,
			"'toolbar=" + that.toolbar +
			",scrollbars=" + that.scrollbars +
			",location=" + that.location +
			",statusbar=" + that.statusbar +
			",menubar=" + that.menubar +
			",resizable=" + that.resizable +
			",width=" + that.width +
			",height=" + that.height +
			",left=" + that.left +
			",top=" + that.top + "'"
		);
		
		return false;
	};
}