  var topTip = false;
  var topTipShadow = false;
  var topTip_shadowSize = 0;
  var topTipMaxWidth = 200;
  var topTipMinWidth = 100;
  var topTip_iframe = false;
  var tooltip_is_msie = (navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('opera')==-1 && document.all)?true:false;
  function doTopTip(e,tooltipTxt)
  {

    var bodyWidth = Math.max(document.body.clientWidth,document.documentElement.clientWidth) - 20;

    if(!topTip){
      topTip = document.createElement('div');
      topTip.id = 'topTip';
      topTipShadow = document.createElement('div');
      topTipShadow.id = 'topTipShadow';

      document.body.appendChild(topTip);
      document.body.appendChild(topTipShadow);

      if(tooltip_is_msie){
        topTip_iframe = document.createElement('IFRAME');
        topTip_iframe.frameborder='0';
        topTip_iframe.style.backgroundColor='#FFFFFF';
        topTip_iframe.src = '#';
        topTip_iframe.style.zIndex = 100;
        topTip_iframe.style.position = 'absolute';
        document.body.appendChild(topTip_iframe);
      }
    }

    topTip.style.display='block';
    topTipShadow.style.display='block';
    if(tooltip_is_msie)topTip_iframe.style.display='block';

    var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
    if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0;
    var leftPos = e.clientX + 10;

    topTip.style.width = null;  // Reset style width if it's set
    topTip.innerHTML = tooltipTxt;
    topTip.style.left = leftPos + 'px';
    topTip.style.top = e.clientY + 10 + st + 'px';


    topTipShadow.style.left =  leftPos + topTip_shadowSize + 'px';
    topTipShadow.style.top = e.clientY + 10 + st + topTip_shadowSize + 'px';

    if(topTip.offsetWidth>topTipMaxWidth){  /* Exceeding max width of tooltip ? */
      topTip.style.width = topTipMaxWidth + 'px';
    }

    var tooltipWidth = topTip.offsetWidth;
    if(tooltipWidth<topTipMinWidth)tooltipWidth = topTipMinWidth;

    topTip.style.width = tooltipWidth + 'px';
    topTipShadow.style.width = topTip.offsetWidth + 'px';
    topTipShadow.style.height = topTip.offsetHeight + 'px';

    if((leftPos + tooltipWidth)>bodyWidth){
      topTip.style.left = (topTipShadow.style.left.replace('px','') - ((leftPos + tooltipWidth)-bodyWidth)) + 'px';
      topTipShadow.style.left = (topTipShadow.style.left.replace('px','') - ((leftPos + tooltipWidth)-bodyWidth) + topTip_shadowSize) + 'px';
    }

    if(tooltip_is_msie){
      topTip_iframe.style.left = topTip.style.left;
      topTip_iframe.style.top = topTip.style.top;
      topTip_iframe.style.width = topTip.offsetWidth + 'px';
      topTip_iframe.style.height = topTip.offsetHeight + 'px';

    }
  }

  function doNotTopTip()
  {
    topTip.style.display='none';
    topTipShadow.style.display='none';
    if(tooltip_is_msie)topTip_iframe.style.display='none';
  }

