// button.js

//---------------------------------------------------------
function Button(o){
	if (o.parent == undefined) o.parent = document.getElementsByTagName("body")[0];
	
	elem = this.elem = document.createElement("input");
	
	elem.type = "button";
	if (o.name != undefined) elem.name = o.name;
	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.image != undefined) s.backgroundImage = "url("+o.image+")";
	
	o.parent.appendChild(elem);
}	

