function getGlossaryData(e,catchWord){
  if($("#glossarDescriptionWrapper").is(":hidden")){
    $.get("fileadmin/template/scripts/ajax_getGlossaryDescription.php", {word: catchWord},
      function(data){
        showGlossaryTooltip(e,data);
      },"json");
  };
};

function showGlossaryTooltip(e,data){
  var offset = $(e).offset();
  var tooltipWidth = 263;
  var tooltipHeight = 209;
  var left = offset.left+50;
  var top = offset.top-tooltipHeight;

  if((tooltipWidth+offset.left) >= screen.width){
    left = (offset.left-tooltipWidth);
   $("#glossarDescriptionHeader").attr("class","glossarTooltipHeader_right");
   $("#glossarDescriptionContent").attr("class","glossarTooltipContent_right");
   $("#glossarDescriptionFooter").attr("class","glossarTooltipFooter_right");
   $("#glossarDescription").attr("class","glossarDescription_right");
   $("#closeImage").attr("class","closeImage_right");
  }else{
    left = (offset.left+$(e).width());
   $("#glossarDescriptionHeader").attr("class","glossarTooltipHeader_left");
   $("#glossarDescriptionContent").attr("class","glossarTooltipContent_left");
   $("#glossarDescriptionFooter").attr("class","glossarTooltipFooter_left");
   $("#glossarDescription").attr("class","glossarDescription_left");
   $("#closeImage").attr("class","closeImage_left"); 
  };
  
  $("#glossarDescription").html(data);
  $("#glossarDescriptionWrapper").css({display : 'block', top : top, left : left});
};

function closeTooltip(){
  $("#glossarDescriptionWrapper").hide();
};
