function pxWindow() {
	var el = document.createElement('div');
	Element.extend(el);
	el.hide();
	el.pxWindow = this;
	el.addClassName('px-window');
	el.identify();
	
	this._mainframe = el;
	
	document.body.appendChild(this._mainframe);
}

pxWindow._mainframe;

pxWindow.prototype.showWindow = function() {
	var screenWidth = 2 * $('main').cumulativeOffset().left + $('main').getWidth(); //document.viewport.getWidth();
	var screenHeight = document.viewport.getHeight();
	var w = this._mainframe.getWidth();
	var h = this._mainframe.getHeight();
	
	if (w < screenWidth) var x = Math.round((screenWidth - w) / 2 + document.viewport.getScrollOffsets().left);
	if (h < screenHeight) var y = Math.round((screenHeight - h) / 2 + document.viewport.getScrollOffsets().top);
	
	this._mainframe.appear({duration: 0.3});
	
	if (this._mainframe.visible()) {
		new Effect.Move(this._mainframe, {duration: 0.5, x: x, y: y, mode: 'absolute'});
	} else {
		this._mainframe.style.left = x + 'px';
		this._mainframe.style.top = y + 'px';
	}
}

pxWindow.prototype.updater = function(url, parameters) {
	var pxW = this;
	
	new Ajax.Updater(this._mainframe, url, {
		method: 'post',
		parameters: parameters,
		evalScripts: true,
		onComplete: function(transport) {
			pxW.showWindow();
		}
	});
}

pxWindow.prototype.getId = function() {
	return this._mainframe.identify();
}

pxWindow.prototype.close = function() {
	this._mainframe.fade({duration: 0.3});
}