function ElementFunctions(elementID){

}
ElementFunctions.prototype.getElement = function(elementID){
	return document.getElementById(elementID);
}

ElementFunctions.prototype.clearContent = function(element){
	var element = this.getElement(element);
	while (element.hasChildNodes()){
	  element.removeChild(element.lastChild); 
	}
}

ElementFunctions.prototype.createElement = function(type){
	return document.createElement(type);
}

ElementFunctions.prototype.createHref = function(url,childElement){
	var element = this.createElement("a");
        element.href = url; 
        element.appendChild( childElement );
	return element;
}

// Takes imgSrc, altTag, class
ElementFunctions.prototype.createImg = function(){
	var args = arguments;
	for ( var i = args.length ; 4 < i; i++ ){
		args[i] = '';
	}

	var element = this.createElement("img");
		element.setAttribute('src', args[0]);
		element.setAttribute('alt', args[1]);
		element.setAttribute('border', args[2]);
		element.setAttribute('className', args[3])

	return element;
}

ElementFunctions.prototype.createText = function(text){
	return document.createTextNode(text);	

}

ElementFunctions.prototype.getElementPosition = function(id,styleProp){
	var element = this.getElement(id);

	var x =  parseFloat(this.getElementStyle(id,styleProp) || 0);
	if (!(x) || isNaN(x)){
		x = 0;
	}
	return x;	
}

ElementFunctions.prototype.getElementPositionAbsolute = function(id){
	var element = this.getElement(id);
	var coords = {x: 0, y: 0};
  
	do {
    	coords.x += element.offsetLeft;
    	coords.y += element.offsetTop;
  	}
  	while ((element = element.offsetParent)); 

	return coords;
}


ElementFunctions.prototype.getElementStyle = function(id,styleProp){
	var element = this.getElement(id);

   if (window.getComputedStyle) {
     	return window.getComputedStyle(element,null).getPropertyValue(styleProp);
   } else if (element.currentStyle) {
		return eval('element.currentStyle.' + styleProp); 
   }
}

ElementFunctions.prototype.getElementHierarchy = function(id){
	var element = this.getElement(id);

	recursiveTest = function(element){
		var str = element.tagName;
		if (element.childNode){
			str += recursiveTest(element.childNode);
		}
		
		return str;
	}

	alert ( recursiveTest(element) ); 

}


ElementFunctions.prototype.moveElement = function(id,type,x,y){
	var element = this.getElement(id);
	element.style.position = type;
	element.style.left = x.toString() + "px";	
	element.style.top  = y.toString() + "px";	
	//element.style.left = "500px";	
	//element.style.top  = "500px";	
}

ElementFunctions.prototype.setElementStyle = function(id,styleProp,value){
	var element = this.getElement(id);
	
	if (element.style){
	  var test = 'element.style.' + styleProp + ' = "' + value + '";';
	  eval(test); 

	}else if (window.getComputedStyle) {
     	window.getComputedStyle(element,null).setProperty(styleProp,value);
   } else if (element.currentStyle) {
	    var style = eval('element.currentStyle.' + styleProp); 
		style = value;
		alert("currentStyle");
   }
}

// 1 = show --- 2 = hide
ElementFunctions.prototype.setVisibility = function(id,state){
	var element = this.getElement(id);
	element.style.visibility = state ? "visible" : "hidden";
}

ElementFunctions.prototype.setVisibilityBlock = function(id,state){
	var element = this.getElement(id);
	element.style.display = state ? "" : "none";
}


