
// Funkcja pokazująca podpowiedzi w zaokrąglonych ramkach

function showtip(current,event,text) {
 //if (document.readyState=="complete"){ // nie działa w Firefox
  var s = '<table id="tttbl" border=0 cellspacing=0 cellpadding=0 class="tooltip2" style="FILTER: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=85);"><tr><td width=4 height=1 colspan=3><img border=0 src="/images/transdot.gif" width=4 height=1></td><td class="tooltip1" height=1><img border=0 src="/images/transdot.gif" width=1 height=1></td><td width=4 height=1 colspan=3><img border=0 src="/images/transdot.gif" width=4 height=1></td></tr><tr><td width=2 height=1 colspan=2><img border=0 src="/images/transdot.gif" width=2 height=1></td><td class="tooltip1" height=1 colspan=3><img border=0 src="/images/transdot.gif" width=1 height=1></td><td width=2 height=1 colspan=2><img border=0 src="/images/transdot.gif" width=2 height=1></td></tr><tr><td width=1 height=2><img border=0 src="/images/transdot.gif" width=1 height=2></td><td class="tooltip1" height=2 colspan=5><img border=0 src="/images/transdot.gif" width=1 height=2></td><td width=1 height=2><img border=0 src="/images/transdot.gif" width=1 height=2></td></tr><tr><td class="tooltip1" width=1><img border=0 src="/images/transdot.gif" width=1 height=1></td><td class="tooltip1" width=1><img border=0 src="/images/transdot.gif" width=1 height=1></td><td class="tooltip1" width=2><img border=0 src="/images/transdot.gif" width=2 height=1></td><td class="tooltip1">'+text+'</td><td class="tooltip1" width=2><img border=0 src="/images/transdot.gif" width=2 height=1></td><td class="tooltip1" width=1><img border=0 src="/images/transdot.gif" width=1 height=1></td><td class="tooltip1" width=1><img border=0 src="/images/transdot.gif" width=1 height=1></td></tr><tr><td width=1 height=2><img border=0 src="/images/transdot.gif" width=1 height=2></td><td class="tooltip1" height=2 colspan=5><img border=0 src="/images/transdot.gif" width=1 height=2></td><td width=1 height=2><img border=0 src="/images/transdot.gif" width=1 height=2></td></tr><tr><td width=2 height=1 colspan=2><img border=0 src="/images/transdot.gif" width=2 height=1></td><td class="tooltip1" height=1 colspan=3><img border=0 src="/images/transdot.gif" width=1 height=1></td><td width=2 height=1 colspan=2><img border=0 src="/images/transdot.gif" width=2 height=1></td></tr><tr><td width=4 height=1 colspan=3><img border=0 src="/images/transdot.gif" width=4 height=1></td><td class="tooltip1" height=1><img border=0 src="/images/transdot.gif" width=1 height=1></td><td width=4 height=1 colspan=3><img border=0 src="/images/transdot.gif" width=4 height=1></td></tr></table>';
  document.all.tooltip1.innerHTML=s.replace(/\/images/g, GetVirtDir() + 'images');
  s = '<table border=0 cellspacing=0 cellpadding=0 class="tooltip2"><tr><td width=4 height=1 colspan=3><img border=0 src="/images/transdot.gif" width=4 height=1></td><td class="tooltip2" height=1><img border=0 src="/images/transdot.gif" width=1 height=1></td><td width=4 height=1 colspan=3><img border=0 src="/images/transdot.gif" width=4 height=1></td></tr><tr><td width=2 height=1 colspan=2><img border=0 src="/images/transdot.gif" width=2 height=1></td><td class="tooltip2" height=1 colspan=3><img border=0 src="/images/transdot.gif" width=1 height=1></td><td width=2 height=1 colspan=2><img border=0 src="/images/transdot.gif" width=2 height=1></td></tr><tr><td width=1 height=2><img border=0 src="/images/transdot.gif" width=1 height=2></td><td class="tooltip2" height=2 colspan=5><img border=0 src="/images/transdot.gif" width=1 height=2></td><td width=1 height=2><img border=0 src="/images/transdot.gif" width=1 height=2></td></tr><tr><td class="tooltip2" width=1><img border=0 src="/images/transdot.gif" width=1 height=1></td><td class="tooltip2" width=1><img border=0 src="/images/transdot.gif" width=1 height=1></td><td class="tooltip2" width=2><img border=0 src="/images/transdot.gif" width=2 height=1></td><td class="tooltip2">'+text+'</td><td class="tooltip2" width=2><img border=0 src="/images/transdot.gif" width=2 height=1></td><td class="tooltip2" width=1><img border=0 src="/images/transdot.gif" width=1 height=1></td><td class="tooltip2" width=1><img border=0 src="/images/transdot.gif" width=1 height=1></td></tr><tr><td width=1 height=2><img border=0 src="/images/transdot.gif" width=1 height=2></td><td class="tooltip2" height=2 colspan=5><img border=0 src="/images/transdot.gif" width=1 height=2></td><td width=1 height=2><img border=0 src="/images/transdot.gif" width=1 height=2></td></tr><tr><td width=2 height=1 colspan=2><img border=0 src="/images/transdot.gif" width=2 height=1></td><td class="tooltip2" height=1 colspan=3><img border=0 src="/images/transdot.gif" width=1 height=1></td><td width=2 height=1 colspan=2><img border=0 src="/images/transdot.gif" width=2 height=1></td></tr><tr><td width=4 height=1 colspan=3><img border=0 src="/images/transdot.gif" width=4 height=1></td><td class="tooltip2" height=1><img border=0 src="/images/transdot.gif" width=1 height=1></td><td width=4 height=1 colspan=3><img border=0 src="/images/transdot.gif" width=4 height=1></td></tr></table>';
  document.all.tooltip2.innerHTML=s.replace(/\/images/g, GetVirtDir() + 'images');

  // to nie działa w Firefox
  //if(event.clientX<document.body.clientWidth/2) document.all.tooltip1.style.pixelLeft=event.clientX+document.body.scrollLeft+10
  //else document.all.tooltip1.style.pixelLeft=event.clientX+document.body.scrollLeft-document.all.tttbl.scrollWidth
  //if(event.clientY<document.body.clientHeight/2) document.all.tooltip1.style.pixelTop=event.clientY+document.body.scrollTop+10
  //else document.all.tooltip1.style.pixelTop=event.clientY+document.body.scrollTop-document.all.tttbl.scrollHeight

  var mc = mouseCoords(event);
  document.all.tooltip1.style.left = '' + (mc.x + 10) + 'px';
  document.all.tooltip1.style.top = '' + (mc.y + 10) + 'px';
  
  // nie wiem po co jest tooltip2
  //document.all.tooltip2.style.pixelLeft=document.all.tooltip1.style.pixelLeft
  //document.all.tooltip2.style.pixelTop=document.all.tooltip1.style.pixelTop
  document.all.tooltip1.style.visibility="visible"
  //document.all.tooltip2.style.visibility="visible"
 //}
}

function hidetip() {
 document.all.tooltip1.style.visibility="hidden"
 document.all.tooltip2.style.visibility="hidden"
}

function getPosition(e){
  var left = 0;
  var top  = 0;

  while (e.offsetParent){
    left += e.offsetLeft;
    top  += e.offsetTop;
    e     = e.offsetParent;
  }

  left += e.offsetLeft;
  top  += e.offsetTop;

  return {x:left, y:top};
}

// względem dokumentu, a nie okna (skrolowanego)
function mouseCoords(ev){
  if(ev.pageX || ev.pageY){
    return {x:ev.pageX, y:ev.pageY}; // Firefox
  }
  return {
    x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
    y:ev.clientY + document.body.scrollTop  - document.body.clientTop
  };
}
