var clientW, clientH, clientT, clientL;
function closeLinkToThis(id) 
{
	document.getElementById("linktothisdiv" + id).style.visibility = "hidden";
}
function linkToThisSelectText(id) 
{
	//document.getElementById("linktothistextarea" + id).focus();
	document.getElementById("linktothistextarea" + id).select();
}
function showLinkToThis(event, id) 
{
	getClientCoords();
    y = event.clientY - 200 + clientT;
    x = event.clientX - 300 + clientL;
    if (clientW != 0) 
    {
		if (clientT > y) y = clientT;
		if (clientL> x) x = clientL;
		// if client area width is smaller than 300 px then align the right side of the
		// link-to-this box with the client area so that the close button is visible
		if (clientW < 300) x = clientL + clientW - 300;
	}
	document.getElementById("linktothisdiv" + id).style.left = x + "px";
    document.getElementById("linktothisdiv" + id).style.top = y + "px";
    document.getElementById("linktothisdiv" + id).style.visibility = "visible";
    document.getElementById("linktothistextarea" + id).focus();
    document.getElementById("linktothistextarea" + id).select();                                    
}
function getClientCoords() 
{
	if (typeof (window.innerWidth) == "number") 
	{
    	//Non-IE
    	clientW = window.innerWidth;
    	clientH = window.innerHeight;
    	clientL = window.pageXOffset;
    	clientT = window.pageYOffset;
	} 
	else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) 
	{
		//IE 6+ in standards compliant mode
    	clientW = document.documentElement.clientWidth;
    	clientH = document.documentElement.clientHeight;
    	clientL = document.documentElement.scrollLeft;
    	clientT = document.documentElement.scrollTop;
	} 
	else if (document.body && (document.body.clientWidth || document.body.clientHeight)) 
	{
		//IE 4 compatible
    	clientW = document.body.clientWidth;
    	clientL = document.body.scrollLeft;
    	clientT = document.body.scrollTop;
    	clientH = document.body.clientHeight;
	} 
	else 
	{
	 	clientW = 0;
     	clientL = 0;
     	clientT = 0;
     	clientH = 0;
	}
}