//TOOLTIP

var tooltipelements = new Array("a", "div", "span", "img");

function tooltip(d,E,b,i,a){
  d=document;E=d.documentElement;b=d.body;if(!E)return;
  for (j in tooltipelements)
  {
    for(i=0;a=b.getElementsByTagName(tooltipelements[j])[i];i++){
      if(a.title){
        with(a.t=d.createElement("div")){
          id="tooltip"
          innerHTML=a.title.replace(/\|/g,"<br />")
        }
        a.onmouseover=function(e){
          with(this){title="";onmousemove(e)}
          b.appendChild(this.t)
        }
        a.onmouseout=function(x){
          with(this){title=t.innerHTML.replace(/<br \/>/g,"\|")}
          if(x=d.getElementById("tooltip"))b.removeChild(x)
        }
        a.onmousemove=function(e){
          e=e||event;with(this.t.style){
//            left=e.clientX+(E.scrollLeft||b.scrollLeft)+"px"
//            top=e.clientY+(E.scrollTop||b.scrollTop)+"px"
            left=e.clientX+(E.scrollLeft||b.scrollLeft) - Math.max(0, 0-((E.clientWidth||b.parentNode.clientWidth)-e.clientX-this.t.offsetWidth)) +"px"
            top=e.clientY+(E.scrollTop||b.scrollTop) - Math.max(0, 20-((E.clientHeight||b.parentNode.clientHeight)-e.clientY-this.t.offsetHeight)) +"px"
          }
        }
      }
    }
  }
}

addEvent(window,'load',tooltip);

// #sub linkek átírása
function sublink(d,E,b,i,a)
{

  d=document;E=d.documentElement;b=d.body;if(!E)return;
  var w = window.location + '';
  w = w.replace(/^(.*)#.*$/i, "$1");
  for(i=0;a=b.getElementsByTagName("a")[i];i++)
  {
    if (a.href && a.href.match(/#/))
    {
      a.href = a.href.replace(/^.*#(.*)?$/i, w + "#$1")
    }
  }
}
addEvent(window, 'load', sublink);
