function ToolTip(id, msg, elDiv) {
	this.el = go2webGetElementWithId(id);
	if (this.el) {
		this.el.msg = msg;
		this.el.elDiv = elDiv;
		this.el.obj = this;
		var that = this
		this.addHandler(that);
	}
}
ToolTip.prototype = {
	addHandler : function(that) {
		this.el.onmouseover = this.showToolTip;
		this.el.onmouseout = this.hideToolTip;
	},
	setToolTipPosition : function(element) {
		var selectedPosX = 0;
		var selectedPosY = 0;
		var el = element;
		if (!el) return;
		var elHeight = el.offsetHeight;
		var elWidth = el.offsetWidth;
		
		while(el != null) {
			selectedPosX += el.offsetLeft;
			selectedPosY += el.offsetTop;
			el = el.offsetParent;
		}
		xPosElement = this.setToolTip(element, selectedPosX + elWidth + 4, selectedPosY + elHeight);
		if (xPosElement) {
			xPosElement.style.display = "block";
			xPosElement.onmouseout = null;
			xPosElement.onmouseover = null;
		}
		return xPosElement;
	},
	showToolTip : function(e) {
		var elm = null;
		if (window.event) {
			elm = window.event.srcElement;
		} else {
			elm = e.target;
		}
		var tooltip = elm.obj.setToolTipPosition(elm);
		var text = document.createTextNode(elm.msg);
		tooltip.text = text;
		tooltip.appendChild(text);
	},
	setToolTip : function(elm,x,y) {
		if (!elm) {
			;
		} else if (elm.elDiv.style) {
			if (typeof(elm.elDiv.style.left) == 'number') {
				elm.elDiv.style.left = x;
				elm.elDiv.style.top  = y;
			} else {
				elm.elDiv.style.left = x + 'px';
				elm.elDiv.style.top  = y + 'px';
			}
		} else if (typeof(elm.left) == 'number') {
			elm.elDiv.left = x;
			elm.elDiv.top  = y;
		}
		return elm.elDiv;
	},
	hideToolTip : function(e) {
		var tooltip = go2webGetElementWithId("toolTip");
		tooltip.style.display = "none";
		tooltip.removeChild(tooltip.text);
	}
}
