function showTooltip(link) {
  var tooltip = document.getElementById('tooltip');
  tooltip.style.display = "block";
  tooltip.innerHTML = '<div id="tooltip_headline">' + link.innerHTML + '</div><img src="' + link.href + '"/>';
  tooltip.style.top = getY(link) + 20 + "px";
  tooltip.style.left = getX(link) + 10 + "px";
}

function hideTooltip() {
  var tooltip = document.getElementById('tooltip');
  tooltip.style.display = "none";
}

function processTooltipLinks() {
  for(i=0; i<document.links.length; i++) {
    if (document.links[i].rel != "tooltip") continue;
    document.links[i].onmouseover = new Function('showTooltip(document.links[' + i + '])');
    document.links[i].onmouseout = hideTooltip;
    document.links[i].onclick = function() { return false; };
    var img = new Image(); img.src = document.links[i].href;
  }
  document.writeln('<div id="tooltip" style="display: none; position: absolute; z-index: 100;"></div>');
}

function getY(oElement) {
  var iReturnValue = 0;
  while( oElement != null ) {
    iReturnValue += oElement.offsetTop;
    oElement = oElement.offsetParent;
  }
  return iReturnValue;
}

function getX(oElement) {
  var iReturnValue = 0;
  while( oElement != null ) {
    iReturnValue += oElement.offsetLeft;
    oElement = oElement.offsetParent;
  }
  return iReturnValue;
}

function slideonlyone(thechosenone) {
     $('div[class|="elternbrief"]').each(function(index) {
          if ($(this).attr("id") == thechosenone) {
               $(this).slideDown(200);
          }
          else {
               $(this).slideUp(200);
          }
     });
}

function show_hide_div(id) {
    var element = document.getElementById(id);
    if(element.style.display=="none")
        element.style.display="inline";
    else
        element.style.display="none";
}
