var Popup = new Class({

	elementID: '',
	width: 100,
	height: 100,
	
	initialize: function(id, title, height, width) {
		this.height = height;
		this.width = width;
		this.elementID = id;
		this.title = title;
		this._buildSkeleton();
	},
	
	_buildSkeleton: function() {
		var _obj = this;
		var popup = (new Element("div",{"class": "popup-wrapper", id: _obj.elementID, styles: {height: _obj.height+"px", width: _obj.width+"px", "margin-left": "-"+(parseInt(_obj.width) / 2)+"px"}})).adopt(
			(new Element("div", {"class": "popup-header"})).adopt(
				new Element("span", {"class": "popup-title", html: _obj.title}),
				(new Element("span", {"class": "popup-close"})).adopt(
					(new Element("a", {href: "javascript:void(0);", html: "X"})).addEvent("click", _obj.closePopup.bind(_obj))
				)
			),
			(new Element("div", {"class": "popup-spacer"})).adopt(
				new Element("hr")
			),
			new Element("div", {"class": "popup-body"})
		);
		document.body.grab(popup);
	},
	
	closePopup: function(){
		var _obj = this;
		$(_obj.elementID).dispose();
	},
	
	showPopup: function(){
		var _obj = this;
		$(_obj.elementID).setStyle("display","block");
	},
	
	populateBody: function(data) {
		var _obj = this;
		$(_obj.elementID).getElement(".popup-body").set("html", data);
	},
	
	injectBody: function(el) {
		var _obj = this;
		$(_obj.elementID).getElement(".popup-body").adopt(el);
	}


});