self.Frame = function()
{
	Frame.CENTER = "center";
	Frame.TOP = "top";
	Frame.BOTTOM = "bottom";
	Frame.LEFT = "left";
	Frame.RIGHT = "right";
	
	var IE = (window.ActiveXObject !== undefined);
	var OPACITY = 0.5;
	var PADDING = 2;
	
	var _screenWidth;
	var _screenHeight;
	var _placeHolder;
	var _frame;
	var _content;
	var _title;
	var _btClose;
	var _blocker;
	var _x;
	var _y;
	var _blockerDisplay;
	
	var init = function()
	{
		_x = _y = 0;
		_placeHolder = document.body;
		_screenWidth = (IE) ? _placeHolder.clientWidth : window.innerWidth;
		_screenHeight = (IE) ? _placeHolder.clientHeight : window.innerHeight;
		_blockerDisplay = false;
		
		_blocker = document.createElement("div");
		_blocker.style.display = "none";
		_blocker.style.position = "absolute";
		_blocker.style.left = "0";
		_blocker.style.top = "0";
		_blocker.style.width = _screenWidth + "px";
		_blocker.style.height = _screenHeight + "px";
		_blocker.style.backgroundColor = "#FFF";
		
		if (IE) _blocker.style.filter = "alpha(opacity=" + (OPACITY * 100) + ")";
		else _blocker.style.opacity = OPACITY;
		
		_frame = document.createElement("div");
		_frame.style.display = "none";
		_frame.style.position = "absolute";
		_frame.style.border = "2px solid #bca67b";
		_frame.style.backgroundColor = "#FFF";
		
		_title = document.createElement("div");
		_title.style.width = "100%";
		_title.style.height = "16px";
		_title.style.backgroundColor = "#DDD";
		_title.style.margin = PADDING + "px";
		_title.style.textAlign = "right";
		
		_title.onmousedown = function(e)
		{
			if (IE) e = event;
			
			this.difX = e.clientX - parseInt(_frame.style.left.match(/\d+/), 10);
			this.difY = e.clientY - parseInt(_frame.style.top.match(/\d+/), 10);
			
			document.onmousemove = function(e)
			{
				if (IE) e = event;
				
				_frame.style.left = (e.clientX - _title.difX) + "px";
				_frame.style.top = (e.clientY - _title.difY) + "px";
			};
		};
		
		document.onmouseup = function()
		{
			this.onmousemove = null;
		};
		
		_btClose = document.createElement("div");
		
		if (!IE)
		{
			_btClose.style.position = "absolute";
			_btClose.style.top = (PADDING / 2) + "px";
		}
		
		_btClose.style.width = (IE) ? "8px" : "10px";
		_btClose.style.height = (IE) ? "8px" : "12px";
		_btClose.style.fontFamily = "verdana, tahoma, arial, helvetica";
		_btClose.style.fontSize = "10px";
		_btClose.style.color = "#666";
		_btClose.style.backgroundColor = "#FFF";
		_btClose.style.border = "1px solid #999";
		_btClose.style.cursor = "pointer";
		_btClose.style.padding = (IE) ? "0 2px 0 2px" : "0 2px 0 0";
		_btClose.style.margin = PADDING + "px";
		_btClose.style.right = "0";
		_btClose.title = "Fechar";
		_btClose.innerHTML = "&times;";
		
		_btClose.onclick = function(e)
		{
			setVisible(false);
		};
		
		_content = document.createElement("div");
		_content.style.overflowY = "auto";
		_content.style.overflowX = "hidden";
		_content.style.margin = PADDING + "px";
		
		_title.appendChild(_btClose);
		_frame.appendChild(_title);
		_frame.appendChild(_content);
		_placeHolder.appendChild(_blocker);
		_placeHolder.appendChild(_frame);
	};
	
	var update = function()
	{
		var x, y;
		
		_screenWidth = (IE) ? _placeHolder.clientWidth : window.innerWidth;
		_screenHeight = (IE) ? _placeHolder.clientHeight : window.innerHeight;
		_blocker.style.width = _screenWidth + "px";
		_blocker.style.height = _screenHeight + "px";
		
		switch (_x)
		{
			case "center":
				x = _screenWidth / 2 - _frame.offsetWidth / 2;
				break;
			case "left":
				x = 0;
				break;
			case "right":
				x = _screenWidth - _frame.offsetWidth;
				break;
			default:
				x = _x;
		}
		
		switch (_y)
		{
			case "center":
				y = _screenHeight / 2 - _frame.offsetHeight / 2;
				break;
			case "top":
				y = 0;
				break;
			case "bottom":
				y = _screenHeight - _frame.offsetHeight;
				break;
			default:
				y = _y
		}
		
		_frame.style.left = Math.round(x) + "px";
		_frame.style.top = Math.round(y) + "px";
	};
	
	var setVisible = function(state)
	{
		_frame.style.display = (state) ? "block" : "none";
		_blocker.style.display = (_blockerDisplay && state) ? "block" : "none";
		
		update();
	};
	
	this.setContent = function(content)
	{
		_content.innerHTML = content;
		
		update();
	};
	
	this.setSize = function(width, height)
	{
		if (width !== null)
		{
			_frame.style.width = width + "px";
			_content.style.width = (width - PADDING * 2) + "px";
		}
		else
		{
			_content.style.width = "";
			_title.style.width = "";
			_frame.style.width = "";
		}
		
		if (height !== null)
		{
			var h = height + parseInt(_title.style.height.match(/\d+/), 10);
			
			_frame.style.height = h + "px";
			_content.style.height = (h - (PADDING * 3 + 16)) + "px";
		}
		else
		{
			_content.style.height = "";
			_frame.style.height = "";
		}
		
		_title.style.width = _content.style.width;
		
		update();
	};
	
	this.setPosition = function(x, y)
	{
		_x = x;
		_y = y;
		
		update();
	};
	
	this.setVisible = function(state)
	{
		setVisible(state);
	};
	
	this.setLocked = function(state)
	{
		if (_frame.style.display == "block")
		{
			_blocker.style.display = (_blockerDisplay = state) ? "block" : "none";
			
			update();
		}
		else _blockerDisplay = state;
	};
	
	this.getContent = function()
	{
		return _content;
	};
	
	this.destroy = function()
	{
		_placeHolder.removeChild(_blocker);
		_placeHolder.removeChild(_frame);
	};
	
	init();
};