try{window.captureEvents(Event.Click);}
catch(objException){}

function findPosX(obj){
    var curleft = 0;

    if (obj.offsetParent){
	    while (obj.offsetParent){
		    curleft += obj.offsetLeft
		    obj = obj.offsetParent;
	    }
    }else if (obj.x)
	    curleft += obj.x;
    	
    return curleft;
}

function findPosY(obj)
{
var curtop = 0;
if (obj.offsetParent)
{
	while (obj.offsetParent)
	{
		curtop += obj.offsetTop
		obj = obj.offsetParent;
	}
}
else if (obj.y)
	curtop += obj.y;

	
return curtop;
}

function CleanSmartTipText(text)
{
	while(text.indexOf("&quot;")>-1)
	{
		text = text.replace("&quot;","\"");
	}   
	return text;     
}

function showSmartTip(evt)
{
var posx = 0;
var posy = 0;
var obj;

var e	= (window.event) ? window.event	: evt;

if (window.event)
{
	e = window.event;
	srcObj = e.srcElement;
}
else
{
	srcObj = e.originalTarget;
}

if (e.pageX || e.pageY)
{
	posx = e.pageX;
	posy = e.pageY;
}
else if (e.clientX || e.clientY)
{
	posx = e.clientX + document.body.scrollLeft;
	posy = e.clientY + document.body.scrollTop;
	//Testing position
	//posy = 300;
}

try
{
	var smartTipWindow = document.getElementById("_pageSmartTip");
	var shiftY = 0;

	smartTipWindow.innerHTML = "";
	
	if (srcObj.smartTipHeader != "")
	{
		smartTipWindow.innerHTML += "<b>" + srcObj.smartTipHeader + "</b><br>";
	}
	smartTipWindow.innerHTML += CleanSmartTipText(srcObj.smartTip);
	
	var origin;
	var startYpoint;
	var hostHeight;
	var heightOfSmartTipInView;
	var heightOfSmartTip;
	var heightOfSmartTipHidden;
	var calculatedXOffset;
	var calculatedYOffset;				

	origin = document.body.scrollTop;
	startYpoint = findPosY(srcObj);
	hostHeight = document.body.clientHeight;
	heightOfSmartTip = smartTipWindow.clientHeight;

	calculatedXOffset = -330;
	calculatedYOffset = 30;

	if (srcObj.getAttribute("smartTipXOffset") != null)
	{
		calculatedXOffset = srcObj.getAttribute("smartTipXOffset");						
	}
	
	if (srcObj.getAttribute("smartTipYOffset") != null)
	{
		calculatedYOffset = srcObj.getAttribute("smartTipYOffset");						
	}				
	smartTipWindow.style.top = origin + "px";
	smartTipWindow.style.left = "3px";
	
		heightOfSmartTipInView = hostHeight - startYpoint + origin;
		heightOfSmartTipHidden = heightOfSmartTip - heightOfSmartTipInView + calculatedYOffset + 5;

			if (heightOfSmartTipHidden > 0 )
			{
				shiftY = heightOfSmartTipHidden;
			}

		smartTipWindow.style.top = startYpoint + parseInt(calculatedYOffset)	+ "px";


	smartTipWindow.style.left = posx + parseInt(calculatedXOffset) + "px";
	smartTipWindow.style.display = "inline";
}
catch(objException){}
}

function hideSmartTip(e)
{
try
{
var smartTipWindow = document.getElementById("_pageSmartTip");
smartTipWindow.style.display = "none";
}
catch(objException){}
}
        