
//intialize Compornents

 

Util = {
	loaded : false,
	registedFunc : new Array(),
	mousePos : new Object,
	bodyHeight : 0,
	evElm : new Object(),
	scrollTimer : '',
	pageWidth : document.documentElement.clientWidth || document.body.clientWidth || document.body.scrollWidth,
	pageHeight : document.documentElement.clientHeight || document.body.clientHeight || document.body.scrollHeight,
	absPos : function(target){
			return 	new _GetPos(target, UA);
	},
	getScrollPosition : function(){
			var scroll = new Object();
			scroll.y = document.body.scrollTop || document.documentElement.scrollTop;
			scroll.x = document.body.scrollLeft || document.documentElement.scrollLeft;
			return scroll;
	},
	getmousePos : function(eObj){
			var eObj = eObj;
			var sc = Util.getScrollPosition();
			var mObj = {};
			if (UA.IE) {
				mObj.x = eObj.x + sc.x;
				mObj.y = eObj.y + sc.y;
			}
			else {
				mObj.x = eObj.pageX;
				mObj.y = eObj.pageY;
			}
			Util.mousePos = mObj;
		},
	getBodyHeight : function(){
			CodeIgniterbaseClass.setEvent(window, 'load', function(){
				Util.bodyHeight = document.body.offsetHeight;
				Util.loaded = true;
			});
		},
	getEventElement : function(eObj)
		{
			var eObj = eObj;
			if(UA.IE)
			{
				Util.evElm =  eObj.srcElement;
			} 
			else
			{
				Util.evElm =  eObj.target;
			}
		}	
}

	
	function _GetPos(elm, br){

		this.br = br;
		this.targetElm = elm;
		this.position = new function(){
			this.x = 0;
			this.y = 0;
		}
		while (this.targetElm) {
			this.position.x += this.targetElm.offsetLeft;
			this.position.y += this.targetElm.offsetTop;
			this.targetElm = this.targetElm.offsetParent;
			if ((this.targetElm) && this.br.is_ie8 || this.br.is_ie7 || this.br.is_ie6) {
				this.position.x += (parseInt(this.getStyle(this.targetElm, 'borderLeftWidth', 'border-left-width') || 0));
				this.position.y += (parseInt(this.getStyle(this.targetElm, 'borderTopWidth', 'border-top-width')) || 0);
			}
		}
		if (UA.Firefox) {
			var body = document.getElementsByTagName('body')[0];
			this.position.x += 2 * (parseInt(this.getStyle(body, 'borderLeftWidth', 'border-left-width')) || 0);
			this.position.y += 2 * (parseInt(this.getStyle(body, 'borderTopWidth', 'border-top-width')) || 0);
		}
		return this.position;
	}
	
		_GetPos.prototype.getStyle = function(targetElm, property_IE, property_CSS){
		var elm = targetElm;
		if (elm.currentStyle) {
			return elm.currentStyle[property_IE];
		}
		else 
			if (window.getComputedStyle) {
				var nowStyle = window.getComputedStyle(elm, '');
				return nowStyle.getPropertyValue(property_CSS);
			}
		}	

