var dynLayer_collection = new Array ();
var dynLayer_browser = new checkBrowser ();

function dynLayer ()
{
	//Properties
	this.instance = dynLayer_collection.length
	dynLayer_collection[this.instance] = this;
	this.name = "dynLayer" + this.instance;
	this.content = "";
	this.x = 0;
	this.y = 0;

	this.elDynLayerObj = void 0;
	this.cssDynLayerObj = void 0;
	
	// Methods
	this.setPosition = dynLayer_position;
	this.getHeight = dynLayer_getHeight;
	this.getWidth = dynLayer_getWidth;
	this.hide = dynLayer_hide;
	this.show = dynLayer_show;
	this.draw = dynLayer_draw;
	
	return (this);
}

function dynLayer_draw ()
{
	var html = "";

	if (dynLayer_browser.ns4)
	{
		html += "<layer name=\"" + this.name + "\" id=\"" + this.name + "\" visibility=\"hidden\">";
	}
	else
	{
		html += "<div name=\"" + this.name + "\" id=\"" + this.name + "\" style=\"visibility: hidden\">";
	}
	
	html += this.content;
	
	if (dynLayer_browser.ns4)
	{
		html += "</layer>";
	}
	else
	{
		html += "</div>";
	}
	
	document.open ();
	document.write (html);
	document.close ();

	if (dynLayer_browser.dom)
	{
		this.elDynLayerObj = document.getElementById(this.name);
		this.cssDynLayerObj = document.getElementById(this.name).style;
	}
	else if (dynLayer_browser.ie4)
	{
		this.elDynLayerObj = document.all[this.name];
		this.cssDynLayerObj = document.all[this.name].style;
	}
	else if (dynLayer_browser.ns4)
	{
		this.elDynLayerObj = eval ("document." + this.name);
		this.cssDynLayerObj = eval ("document." + this.name);
	}
	else
	{
		return (void 0);
	}
	
	this.cssDynLayerObj.position = "absolute";
	this.setPosition (this.x, this.y);
	this.show ();
	
	return (true);
}

function dynLayer_position (x, y)
{
	this.x = x;
	this.y = y;
	
	if (this.cssDynLayerObj != void 0)
	{
		this.cssDynLayerObj.left = this.x;
		this.cssDynLayerObj.top = this.y;
	}
	
	return (true);
}

function dynLayer_getHeight ()
{
	if ((this.cssDynLayerObj != void 0) && (this.elDynLayerObj != void 0))
	{
		if (dynLayer_browser.ns4)
		{
			return (this.cssContentArea.document.height);
		}
		else
		{
			return (this.elContentArea.offsetHeight);
		}
	}
	
	return (void 0);
}

function dynLayer_getWidth ()
{
	if ((this.cssDynLayerObj != void 0) && (this.elDynLayerObj != void 0))
	{
		if (dynLayer_browser.ns4)
		{
			return (this.cssContentArea.document.width);
		}
		else
		{
			return (this.elContentArea.offsetWidth);
		}
	}
	
	return (void 0);
}

function dynLayer_show ()
{
	if (this.cssDynLayerObj != void 0)
	{
		this.cssDynLayerObj.visibility = "visible";
	}
	
	return (true);
}

function dynLayer_hide ()
{
	if (this.cssDynLayerObj != void 0)
	{
		this.cssDynLayerObj.visibility = "hidden";
	}
	
	return (true);
}
