icore={}

//get Element Y Position

icore.getElYPos=function (oElement) {
	var iReturnValue = 0;
	while( oElement != null ) {
		iReturnValue += oElement.offsetTop;
		oElement = oElement.offsetParent;
	}
	return iReturnValue;
} 

//get Element X Position
icore.getElXPos=function (oElement) {
	var iReturnValue = 0;
	while( oElement != null ) {
		iReturnValue += oElement.offsetLeft;
		oElement = oElement.offsetParent;
	}
	return iReturnValue; 
}

//get Element width
icore.getElWidth=function (oElement) {
	return oElement.offsetWidth;
}

//get Element Height

icore.getElHeight=function (oElement) {
	return oElement.offsetHeight;
}

//toggle visibility
icore.togglevisibility=function (id) {
	document.getElementById(id).style.display=(document.getElementById(id).style.display=='') ? 'none':'';
}

icore.createElement=function (e, obj) {
	var element=document.createElement(e);
	for (prop in obj)	{
		element[prop]=obj[prop];
	}
	return element;
}

icore.appendChild=function () {
	if (this.appendChild.arguments.length>1) {
		var a=this.appendChild.arguments[0];
		for(i=1;i<this.appendChild.arguments.length;i++) {
			if (this.appendChild.arguments[i]) {
				a.appendChild(this.appendChild.arguments[i]);
			}
		}
	} else {
		return null;
	}
}

icore.removeChildren=function() {
	if (node==null) {
		return;
	}
	
	while(node.hasChildNodes()) {
		node.removeChild(node.firstChild);
	}
}

icore.addListener=function (obj, evname, listener) {
	if (obj.attachEvent) {
		obj.attachEvent('on'+evname, listener);
	} else if (obj.addEventListener) {
		obj.addEventListener(evname, listener, false);
	} else {
		return false;
	}
	return true;
}

icore.removeListener=function (obj, evname, listener) {
	if (obj.detachEvent) {
		obj.detachEvent('on'+evname, listener);
	} else if (obj.removeEventListener) {
		obj.removeEventListener(evname, listener, false);
	} else {
		return false;
	}
	return true;
}

icore.changeOpacity=function (id, opac) {
	var obj=id.style;
	obj.opacity=(opac/100);
	obj.MozOpacity=(opac/100);
	obj.KhtmlOpacity=(opac/100);
	obj.filter='alpha(opacity='+opac+')';
}

