// text_edit.js

//---------------------------------------------------------
function TextEdit(o){
	if (o.parent == undefined) o.parent = document.getElementsByTagName("body")[0];
	
	elem = this.elem = document.createElement("input");
	
	elem.type = "text";
	if (o.value != undefined) elem.value = o.value;
	if (o.onclick != undefined) elem.onclick = o.onclick;
	if (o.onmousedown != undefined) elem.onmousedown = o.onmousedown;
	if (o.onmouseover != undefined) elem.onmouseover = o.onmouseover;

	var s = this.elem.style;
	
	s.position = "absolute";
	s.top = o.top;
	s.left = o.left;
	if (o.height != undefined) s.height = o.height;
	if (o.width != undefined) s.width = o.width;	
	if (o.color != undefined) s.color = o.color;
	if (o.fontFamily != undefined) s.fontFamily = o.fontFamily;
	if (o.fontSize != undefined) s.fontSize = o.fontSize;
	if (o.fontWeight != undefined) s.fontWeight = o.fontWeight; // (100-900) 400 is normal
	if (o.textAlign != undefined) s.textAlign = o.textAlign;
	if (o.cursor != undefined) s.cursor = o.cursor;
	if (o.backgroundColor != undefined) s.backgroundColor = o.backgroundColor;
	if (o.margin != undefined) s.margin = o.margin;
	if (o.marginTop != undefined) s.marginTop = o.marginTop;
	if (o.marginBottom != undefined) s.marginBottom = o.marginBottom;
	if (o.marginLeft != undefined) s.marginLeft = o.marginLeft;
	if (o.marginRight != undefined) s.marginRight = o.marginRight;
	if (o.padding != undefined) s.padding = o.padding;
	
	o.parent.appendChild(this.elem);
}	

