function DynamicElement(idOrElement)
{
	if(idOrElement)
	{
		if(typeof idOrElement == "string")
			this.elm = document.getElementById(idOrElement);
		else
			this.elm = idOrElement;
			
/*
		if(!this.elm)
			alert("Dynamic element " + idOrElement + " was not found.");
*/
	}
	else
		this.elm = document.createElement("DIV");
		
//	this.hide();
}

DynamicElement.prototype.setPosition = function(x, y)
{
	this.elm.style.position = "absolute";
	this.elm.style.left = x + "px";
	this.elm.style.top = y + "px";
}			

DynamicElement.prototype.setSize = function(width, height)
{
	this.elm.style.width = width + "px";
	this.elm.style.height = height + "px";
}

DynamicElement.prototype.show = function()
{
	this.elm.style.display = "block";
}

DynamicElement.prototype.hide = function()
{
	this.elm.style.display = "none";
}

DynamicElement.prototype.setHtml = function(html)
{
	this.elm.innerHTML = html;
}

DynamicElement.prototype.getElement = function()
{
	return this.elm;
}

DynamicElement.prototype.getSize = function()
{
	return {width: this.elm.offsetWidth, height: this.elm.offsetHeight};
}

DynamicElement.prototype.getPosition = function()
{
	return {x: this.elm.offsetLeft, y: this.elm.offsetTop};
}

DynamicElement.prototype.appendChild = function(childDynamicElement)
{
	this.elm.appendChild(childDynamicElement.getElement());
	return childDynamicElement;
}

DynamicElement.prototype.setStyle = function(key, value)
{
	this.elm.style[key] = value;
}

