// JavaScript Document <<< CoreWeb Effects v0.1.0 >>>

function CWElement() {
	var element = null;
	this.offsetLeft = null;
	this.offsetRight = null;
	this.stle = null;
}

CWElement.prototype.getElementById = function (theID) {
	element = document.getElementById(theID);
	this.offsetLeft = element.offsetLeft;
	this.offsetRight = element.offsetRight;
	this.style = element.style;
}

CWElement.prototype.getElementByClass = function (theClass) {
	var allHTMLTags = new Array();
	//Create Array of All HTML Tags
	var allHTMLTags=document.getElementsByTagName("*");
	//Loop through all tags using a for loop
	for (var i=0; i<allHTMLTags.length; i++) {
		//Get all tags with the specified class name.
		if (allHTMLTags[i].className==theClass) {
			element = allHTMLTags[i];
		}
	}
	
	this.offsetLeft = element.offsetLeft;
	this.offsetRight = element.offsetRight;
	this.style = element.style;
}

CWElement.prototype.setOpacity = function(percentage) {
	if (element == null) return;
	element.style.opacity = percentage;
}

CWElement.prototype.setPosition = function(position, x, y) {
	if (element == null) return;
	element.style.position = position;
	element.style.left = x + 'px';
	element.style.top = y + 'px';
	
	this.offsetLeft = element.offsetLeft;
	this.offsetRight = element.offsetRight;
	
}


CWElement.prototype.offsetLeft = function() {
	if (element == null) return;
	return element.offsetLeft;
}

CWElement.prototype.offsetTop = function() {
	if (element == null) return;
	return element.offsetTop;
}


