var tipwidth='500px' // default tooltip width
var tipbgcolor='#EFEFEF'  // tooltip bgcolor
var disappeardelay=250  // tooltip disappear speed onMouseout (in miliseconds)
var vertical_offset="0px" // horizontal offset of tooltip from anchor link
var horizontal_offset="-3px" // horizontal offset of tooltip from anchor link
var xMousePos = 0; // Horizontal position of the mouse on the screen
var yMousePos = 0; // Vertical position of the mouse on the screen
var tooltip_class = true;
$(document).ready(function() {
  $().mousemove(function(e){
    xMousePos = e.pageX;
    yMousePos = e.pageY;
    yMousePosWindow = yMousePos - $(window).scrollTop();
  });
})
document.write('<div id="fixedtipdiv" style="display:none;width:'+tipwidth+';background-color:'+tipbgcolor+';border:none;" ></div>');
function fixedtooltip(menucontents, obj, e, tipwidth){
  $("#fixedtipdiv").css("padding", "0");
  $("#fixedtipdiv").css("width", tipwidth);
  var html_content = "<div";
  if (tooltip_class) html_content += " class=\"tooltip_class\"";
  html_content += ">"+menucontents+"</div>";
  $("#fixedtipdiv").html(html_content);
  var switchWidth = false;
  var switchHeight = false;
  tipwidth_number = parseInt(tipwidth.replace('px', ''));
  if (($(window).width() - (xMousePos + 10)) <= (tipwidth_number + 20)) {
    switchWidth = true;
  }
  if ((($(window).height() - (yMousePosWindow + 10)) <= ($('#fixedtipdiv').height() + 20))) {
    switchHeight = true;
  }
  if (switchWidth) {
    $("#fixedtipdiv").css("left", (xMousePos - tipwidth_number - 10));
  } else {
    $("#fixedtipdiv").css("left", xMousePos + 10);
  }
  if (switchHeight) {
    $("#fixedtipdiv").css("top", (yMousePos - $('#fixedtipdiv').height() - 10));
  } else {
    $("#fixedtipdiv").css("top", yMousePos + 10);
  }
  $("#fixedtipdiv").show();
}
function delayhidetip() { $("#fixedtipdiv").hide(); }
// Code jquery incompatible with actual version --> use this one when complete this ticket http://www.proz.com/ticket/115339
function show(id) {
  $("#"+id).show();
}
function hide(id) {
  $("#"+id).hide();
}