/*
Class: ElementWrapper 
Abstract base class
An object that represents any page element: div, li, iframe, etc.
Do not instantiate!  Use GenericElement class instead (see below).
The pElement property is a reference to the HTML element that will be drawn
*/
var ElementWrapper = function(){
	//DO NOT add code to this Constructor!
}

ElementWrapper.prototype.init = function(tagName, id){
	this.pElement = document.createElement(tagName);
	this.pElement.id = id;
	this.pElement.owner = this;
}

ElementWrapper.prototype.assignElement = function(element){
	this.pElement = element;
	this.pElement.owner = this;
}

ElementWrapper.prototype.appendTo = function(targetElement){
	targetElement.appendChild(this.pElement);		
}

ElementWrapper.prototype.setText = function(text){
	this.pElement.appendChild(document.createTextNode(text));
}

ElementWrapper.prototype.setStyle = function(name, value){
	this.pElement.style[name] = value;	
}

ElementWrapper.prototype.setClass = function(value){
	this.pElement.className = value;
}

/*
Class: GenericElement 
This is a version of ElementWrapper that can be instantiated.
Extends ElementWrapper.  
*/
var GenericElement = function(tagName, id, content){
	this.init(tagName, id);
	if(content){
		this.pElement.innerHTML = content;
	}
}

GenericElement.prototype = new ElementWrapper;
