var NS4=(document.layers)?true:false;
var ttIE5=(document.all)?true:false;
var ttIE4=(navigator.userAgent.indexOf('MSIE 4') > 0)?true:false;


function showToolTip( toolTipContent, toolTipClass, e )
{
  toolTipClass = (NS4 && typeof(toolTipClass) != "undefined") ? (" class=\"" + toolTipClass + "\"") : ("");
  toolTipMessage = "<div" + toolTipClass + ">" + toolTipContent + "</div>";

  writelayer( "tip", toolTipMessage );

  px = (e.clientX)?(e.clientX):((e.x) ? e.x : e.pageX);

  px = (ttIE5 && !ttIE4) ? (px+document.body.scrollLeft) : (px+getpagescrollx());
  x = (px + 0);
  if( x < 0 )
  {
    x = 0;
  }

  py = (e.clientY)?(e.clientY):((e.y) ? e.y : e.pageY);

  py = (ttIE5 && !ttIE4) ? (py+document.body.scrollTop) : (py+getpagescrolly());

  y = py+10;
  if( y < 0 )
  {
    y = 0;
  }

  $("#tip").show();

  // if layer won't fit on right or bottom of page,
  // move layer to left or top of mouse respectively
  if( x + getlayerwidth( "tip" ) - getpagescrollx() >= getwindowwidth() )
  {
    x = px - getlayerwidth( "tip" );
  }
  if( y + getlayerheight( "tip" ) - getpagescrolly() >= getwindowheight() )
  {
    y = py - getlayerheight( "tip" );
  }

  movelayer( "tip", x, y );
  return true;
}

function hideToolTip()
{
  $("#tip").hide();
  movelayer( "tip", 0, 0 );
}
