var tTip = null;
var tTipTout;

function loadTooltip()
{
	toolTipArr = document.getElementsByTagName("img");
	
	for(i = 0; i < toolTipArr.length; i++)
	{
		if(toolTipArr[i].getAttribute("tooltip") != null)
		{
			toolTipArr[i].oDiv = document.createElement("DIV");
			toolTipArr[i].oDiv.className = 'tip-box';
			
			toolTipArr[i].oDiv.style.width = '300px';
			toolTipArr[i].oDiv.style.zIndex = 1000;
			
			if(toolTipArr[i].getAttribute("tooltip_width") != null)
			{
				toolTipArr[i].oDiv.style.width = toolTipArr[i].getAttribute("tooltip_width") + 'px';
			}
			toolTipArr[i].style.cursor = 'pointer';

			toolTipArr[i].oDiv.innerHTML = toolTipArr[i].getAttribute("tooltip");

			document.body.appendChild(toolTipArr[i].oDiv);

			toolTipArr[i].onmouseover = function()
			{
				this.oDiv.style.left = ((findPos(this).x - parseInt(parseInt(this.oDiv.style.width)/2)) + parseInt(this.offsetWidth/2)) + "px";
				if( (parseInt(this.oDiv.style.left) + parseInt(this.oDiv.style.width)) > document.body.clientWidth )
					this.oDiv.style.left = (document.body.clientWidth - parseInt(this.oDiv.style.width) - 10) + 'px';
				if( parseInt(this.oDiv.style.left) < 0 )
					this.oDiv.style.left = '1px';
				this.oDiv.style.top = (findPos(this).y + this.offsetHeight + 13) + "px";
				this.oDiv.style.display = 'block';
			}
			
			toolTipArr[i].onmouseout = function()
			{
				this.oDiv.style.display = 'none';
			}
		}
	}
}
