

var th=0;

var g_targaTooltips = "";

function targaAddTooltip(p_id, p_contents)
{
  g_targaTooltips += "<div class=\"tooltip\" id=\"" + p_id+ "\">" + p_contents + "</div>";
}

function targaWriteTooltips()
{
  document.write(g_targaTooltips);
}

function targaShowDiv(id)
{
  if (document.getElementById) 
    document.getElementById(''+id+'').style.visibility = "visible";
}

function targaToolTip(id,flag,e) {

  if (flag=="1")
  {
    if (e.clientX)
    {
      x = (e.clientX);
      y = (e.clientY);
    }
    
    if (e.pageX)
    {
      x = (e.pageX);
      y = (e.pageY);
    }
  
    scrollX=(document.body.scrollLeft);
    scrollY=(document.body.scrollTop);
    
    if (!self.pageYOffset)
    {
      y+=scrollY;
      x+=scrollX;
    }
    
    if (document.body.clientHeight)
    {
      windowheight=(document.body.clientHeight);
      windowwidth=(document.body.clientWidth);
    }
    else
    {
      windowheight=(self.innerHeight);
      windowwidth=(self.innerWidth);
    }
    
    if (document.getElementById)
    {
      if (x-scrollX>windowwidth/2)
        newleft = x-220;
      else
        newleft = x+20;
      if (y-scrollY>windowheight/2)
        newtop = y-40;
      else	
        newtop = y+20;
      
      document.getElementById(id).style.top = newtop + 'px';
      document.getElementById(id).style.left = newleft + 'px';
      
      if (th!=0)
        clearTimeout(th);
      
      th=setTimeout("targaShowDiv('"+id+"')",200);
    }
  }
  else
  if (flag=="0")
  {
    if (th!=0)
    {
      clearTimeout(th);
      th=0;
    }
    if (document.getElementById) document.getElementById(''+id+'').style.visibility = "hidden";
  }
}
