function ToolTip(text)
{	
	
	// ToolTip
	this.tooltip = document.createElement("div");
	this.tooltip.className="toolTip";
	this.tooltip.style.left="0px";
	var newText= document.createTextNode(text);
	this.tooltip.appendChild(newText);
	document.body.appendChild(this.tooltip);

	this.show = function(x,y){
		var t = this.tooltip;
		t.style.display="block";
		t.style.visibility="hidden";
		if(y+t.clientHeight+20 > dom.getViewportHeight()+dom.getDocumentScrollTop())
		{
			t.style.top=(y-20-t.clientHeight)+"px";
		
		}
		else
		{
			t.style.top=y+"px";
		}
		if (x+t.clientWidth > dom.getViewportWidth()+dom.getDocumentScrollLeft()) {
			t.style.left=(x+5-t.clientWidth)+"px";
		} else {
			t.style.left=x+5+"px";
		}			
			
		t.style.visibility = "visible";
	}
	this.hide = function(){
		this.tooltip.style.display="none";
	}

}
function showToolTip(e)
{
	var origin = document.all?e["srcElement"]:e["target"];
	origin.toolTip.show(e.clientX+document.body.scrollLeft, e.clientY+document.body.scrollTop);
}
function hideToolTip(e)
{
	var origin = document.all?e["srcElement"]:e["target"];
	origin.toolTip.hide();
}

function attachToolTip(text)
{
	this.toolTip = new ToolTip(text);

	if(document.all){
		this.attachEvent("onmouseover", showToolTip);
		this.attachEvent("onmouseout", hideToolTip);
    }else{
		this.addEventListener("mouseover",showToolTip,false);
		this.addEventListener("mouseout",hideToolTip,false);
    }
	
}
