
function Layer_(URL, Variable, Top, Left)
{
	this.LayerTop = Top;
	this.LayerLeft = Left;
	this.LayerObject = null;
	this.Ajax = new XMLHTTPObject_();


	this.Show = function()
	{
		this.LayerObject.style.display = "block";
	}

	this.Hide = function()
	{
		this.LayerObject.style.display = "none";
	}

	this.UnLoad = function()
	{
		this.Hide();
		General.EventHandlerRemove(window, "scroll", this.Move.bind(this));
		General.EventHandlerRemove(window, "resize", this.Move.bind(this));
		this.LayerObject.parentNode.removeChild(this.LayerObject);
	}

	this.Move = function()
	{
		var PositionTop = this.LayerTop.split(":");
		var PositionLeft = this.LayerLeft.split(":");

		if (typeof(PositionTop[1])=="undefined")
			PositionTop[1] = 0;
		if (typeof(PositionLeft[1])=="undefined")
			PositionLeft[1] = 0;

		if (this.LayerObject.style.display=="block")
		{
			switch(PositionTop[0].toLowerCase())
			{
				case "center":
					this.LayerObject.style.top = parseInt(General.GetBrowserScrollPositionY()+(General.GetBrowserInnerHeight() / 2)-(this.LayerObject.offsetHeight / 2))+parseInt(PositionTop[1])+"px";
					break;

				case "top":
					this.LayerObject.style.top = parseInt(General.GetBrowserScrollPositionY())+parseInt(PositionTop[1])+"px";
					break;

				case "bottom":
					this.LayerObject.style.top = parseInt(General.GetBrowserScrollPositionY()+General.GetBrowserInnerHeight()-this.LayerObject.offsetHeight)+parseInt(PositionTop[1])+"px";
					break;

				case "absolute":
					this.LayerObject.style.top = parseInt(PositionTop[1])+"px";
					break;
			}

			switch(PositionLeft[0].toLowerCase())
			{
				case "center":
					this.LayerObject.style.left = parseInt(General.GetBrowserScrollPositionX()+(General.GetBrowserInnerWidth() / 2)-(this.LayerObject.offsetWidth / 2))+parseInt(PositionLeft[1])+"px";
					break;

				case "left":
					this.LayerObject.style.left = parseInt(General.GetBrowserScrollPositionX())+parseInt(PositionLeft[1])+"px";
					break;

				case "right":
					this.LayerObject.style.left = parseInt(General.GetBrowserScrollPositionX()+General.GetBrowserInnerWidth()-this.LayerObject.offsetWidth)+parseInt(PositionLeft[1])+"px";
					break;

				case "absolute":
					this.LayerObject.style.left = parseInt(PositionLeft[1])+"px";
					break;
			}
		}
	}

	this.DisplayContent = function(Data)
	{
		General.DOMInsertHTML(this.LayerObject, Data);
		Form.Initialize();
		this.Show();
		this.Move();
	}

	this.LoadContent = function(URL, Variable)
	{
		this.Ajax.CallBack(this, this.DisplayContent);
		this.Ajax.Request("POST", URL, Variable);
	}



	Div = document.createElement("div");
	Div.style.display = "none";
	Div.style.position = "absolute";
	Div.style.zIndex = 250000;
	this.LayerObject = Div;
	document.body.appendChild(Div);

	General.EventHandlerAdd(window, "scroll", this.Move.bind(this));
	General.EventHandlerAdd(window, "resize", this.Move.bind(this));

	this.LoadContent(URL, Variable);

}

