/*
  * tooltips.js : Ripe Tooltips
  *
  * von ]
  *
  * Changelog:  2007-03-04  angepasst auf deutsche SpecialPageNames; regExp-Match verbessert
  */
 
 // <nowiki>
 function initmtt(){
  document.write("<style type='text/css'>.mytooltip {position: absolute;display: none;background-color: #FFFFFF;");
  document.write("z-index: 99; border-width: 1px;border-style: solid;border-color: #000000;padding: 1px;}</style>");
  document.write("<div class='mytooltip' id='mytooltip'><a id='mtt_ripe' href='#'>R</a><br><div id='mtt_nr'> </div></div>");
 }
 
 var mtt  = null;
 var mttt = null;
 var mttp = false;
 
 function ipcontribs() {
   for (var i=0; aNode = document.getElementsByTagName("a"); i++) {
      if (( hr = aNode.getAttribute("href") )  && ( hr.search(/Spezial:Beitr%C3%A4ge/) != -1 )) {
         ip = hr.slice(hr.lastIndexOf("/") + 1);
         if ( ip.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/) != null) {
            aNode.setAttribute("onMouseOver","showMTT('"+ip+"')");
         } 
      }
   }
   document.onmousemove = updateMTT;
 }
 
 function updateMTT(e) {
   if (mtt && mttp) {
      x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
      y = (document.all) ? window.event.y + document.body.scrollTop  : e.pageY;
      mtt.style.left = (x - 4) + "px";
      mtt.style.top  = (y + 6) + "px";
      mttp = false;
   }
 }
 
 function showMTT(ip) {
   hideMTT();
   mtt = document.getElementById("mytooltip");
   mtt.style.display = "block";
   if (mttt == null) mttt = window.setTimeout("hideMTT()", 3000);
   document.getElementById("mtt_ripe").href='http://www.ripe.net/fcgi-bin/whois?form_type=simple&full_query_string=&&do_search=Search&searchtext='+ip;
   document.getElementById("mtt_ripe").firstChild.data = 'Ripe:'+ip;
   // document.getElementById("mtt_nr").firstChild.data = anz+' weitere Edits auf dieser Seite';
   mttp = true;
 }
 
 function hideMTT() {
   mttp = false;
   window.clearTimeout(mttt);
   mttt = null;
   if (mtt) mtt.style.display = "none";
 }
 
 $(document).ready(initmtt);
 $(document).ready(ipcontribs);
 // </nowiki>