function xstooltipFindPosX( 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 xstooltipFindPosY(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;
}


var xPos;
var yPos;

function xstooltipShow( tooltipId, parentId, posX, posY )
{
    it = document.getElementById( tooltipId );
//    	document.write( tooltipId + " " + parentId );
//		document.write( posX, " ", posY );
    
    if ((it.style.top == '' || it.style.top == 0) 
        && (it.style.left == '' || it.style.left == 0))
    {
	//		document.write( (it.style.top + 1), (it.style.top + 1) );
        // need to fixate default size (MSIE problem)
//        it.style.width = it.offsetWidth + 'px';
//        it.style.height = it.offsetHeight + 'px';
//        it.style.width = 200 + 'px';
//        it.style.height = 100 + 'px';

//			xPos = evt.clientX;
//			yPos = evt.clientY;
//			document.write( "inside" + posX + posY );
			//var toolTip = document.GetElementById( tooltipId ); 
//			it.innerHTML = "<h2>"+"Patron"+"</h2>"+"<br /><p>member who gives</p>";
//			it.style.top = parseInt(yPos)+2 + "px";
//			it.style.left = parseInt(xPos)+2 + "px";
//		   it.style.visibility = "visible";
        img = document.getElementById( parentId ); 
    
        // if tooltip is too wide, shift left to be within parent 
        if (posX + it.offsetWidth > img.offsetWidth) posX = img.offsetWidth - it.offsetWidth;
        if (posX < 0 ) posX = 0; 
        
        x = posX; //xstooltipFindPosX(img) + posX;
        y = posY; //xstooltipFindPosY(img) + posY;
        x = 560;
        y = 20 // 0;
//        document.write( x, " ", y );
        
        it.style.top = y + 'px';
        it.style.left = x + 'px';
    }
    
    it.style.visibility = 'visible'; //document.write( it.style.visibility );
    //alert( "Show" );
    //alert( "Trying to show this div" );
//    it.style.opacity = '.99';
//    it.style.MozOpacity = '.99';
//    it.style.filter = 'alpha.opacity=99';
}


function xstooltipHide( id )
{
//	document.write( id );
    it = document.getElementById( id ); 
    it.style.visibility = 'hidden'; 
}
