// element

//---------------------------------------------------------
function Element(o){
	// get the parent - if none specified, make it the document
	if (o.parent == undefined) o.parent = document.getElementsByTagName("body")[0];
	this.elem = document.createElement(o.elemType);
	this.SetAttribs(o);
	o.parent.appendChild(this.elem);
	}

//---------------------------------------------------------
Element.prototype.SetAttribs = function(o)
	{
	if (o.id != undefined) this.elem.id = o.id;
	if (o.name != undefined) this.elem.name = o.name;

	// set the elements style attributes
	var s = this.elem.style;
	s.position = "absolute";
	if (o.zIndex != undefined) 
		s.zIndex = o.zIndex;
	
	// set the dimensions
	if (o.top != undefined) s.top = o.top;
	if (o.left != undefined) s.left = o.left;
	if (o.height != undefined) s.height = o.height;
	if (o.width != undefined) s.width = o.width;
		
	// set background properties
	if (o.background != undefined) s.background = o.background;
	if (o.backgroundAttachment != undefined) s.backgroundAttachment = o.backgroundAttachment;//fixed
	if (o.backgroundColor != undefined) s.backgroundColor = o.backgroundColor;
	if (o.backgroundImage != undefined) s.backgroundImage = o.backgroundImage;
	if (o.backgroundPosition != undefined) s.backgroundPosition = o.backgroundPosition;
	if (o.backgroundPositionX != undefined) s.backgroundPositionX = o.backgroundPositionX;
	if (o.backgroundPositionY != undefined) s.backgroundPositionY = o.backgroundPositionY;
	if (o.backgroundRepeat != undefined) s.backgroundRepeat = o.backgroundRepeat;

	// set the borders
	if (o.border != undefined) s.border = o.border;
	if (o.borderColor != undefined) s.borderColor = o.borderColor;
	if (o.borderStyle != undefined) s.borderStyle = o.borderStyle;
	if (o.borderWth != undefined) s.borderWth = o.borderWth;
	
	if (o.borderBottom != undefined) s.borderBottom = o.borderBottom;
	if (o.borderBottomColor != undefined) s.borderBottomColor = o.borderBottomColor;
	if (o.borderBottomStyle != undefined) s.borderBottomStyle = o.borderBottomStyle;
	if (o.borderBottomWth != undefined) s.borderBottomWth = o.borderBottomWth;

	if (o.borderLeft != undefined) s.borderLeft = o.borderLeft;
	if (o.borderLeftColor != undefined) s.borderLeftColor = o.borderLeftColor;
	if (o.borderLeftStyle != undefined) s.borderLeftStyle = o.borderLeftStyle;
	if (o.borderLeftWth != undefined) s.borderLeftWth = o.borderLeftWth;

	if (o.borderRight != undefined) s.borderRight = o.borderRight;
	if (o.borderRightColor != undefined) s.borderRightColor = o.borderRightColor;
	if (o.borderRightStyle != undefined) s.borderRightStyle = o.borderRightStyle;
	if (o.borderRightWth != undefined) s.borderRightWth = o.borderRightWth;

	if (o.borderTop != undefined) s.borderTop = o.borderTop;
	if (o.borderTopColor != undefined) s.borderTopColor = o.borderTopColor;
	if (o.borderTopStyle != undefined) s.borderTopStyle = o.borderTopStyle;
	if (o.borderTopWth != undefined) s.borderTopWth = o.borderTopWth;

	if (o.margin != undefined) s.margin = o.margin;
	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.marginTop != undefined) s.marginTop = o.marginTop;

	if (o.outline != undefined) s.outline = o.outline;	
	if (o.outlineColor != undefined) s.outlineColor = o.outlineColor;	
	if (o.outlineStyle != undefined) s.outlineStyle = o.outlineStyle;	
	if (o.outlineWth != undefined) s.outlineWth = o.outlineWth;	
	if (o.padding != undefined) s.padding = o.padding;	
	if (o.paddingBottom != undefined) s.paddingBottom = o.paddingBottom;	
	if (o.paddingLeft != undefined) s.paddingLeft = o.paddingLeft;	
	if (o.paddingRight != undefined) s.paddingRight = o.paddingRight;	
	if (o.paddingTop != undefined) s.paddingTop = o.paddingTop;	
	
	if (o.overflow != undefined) s.overflow = o.overflow;
	}
