this.jtip = function()
{
  $('.jtip').unbind().

  hover(
  /* mouseenter */
  function(e)
  {
    this.title_temp = this.title;
    this.title = '';

    /* $('body').append('<div id="jtip"><div id="jtip_arrow_up">&nbsp;</div><div id="jtip_content">'+ this.title_temp +'</div><div id="jtip_arrow_down">&nbsp;</div></div>'); */
    $('body').append('<div id="jtip"><div id="jtip_content">'+ this.title_temp +'</div></div>');


    /* Behandlung der VERTIKALEN Achse der Info-BOX */
    x = e.pageX - Math.floor($('#jtip').width() / 2);

    if(x < 10)
    {
      x = 10;
    }
    else if(($(window).width()+$(window).scrollLeft()) < (x + $('#jtip').width() + 10))
    {
      x = ($(window).width()+$(window).scrollLeft()) - $('#jtip').width() - 10;
    }

    /* Behandlung der HORIZONTALEN Achse der Info-BOX */
    y = e.pageY + 10;

    if(y < 10)
    {
      y = 10;
    }
    else if(($(window).height()+$(window).scrollTop()) < (y + $('#jtip').height()))
    {
      y = e.pageY - $('#jtip').height() - 10;
    }

    $('#jtip').
      css('left', x +'px').
      css('top', y +'px').
      fadeIn('slow');
  },

  /* mouseleave */
  function(e)
  {
    this.title = this.title_temp;

    $('#jtip').
      fadeOut('slow').
      remove();
  }).

  mousemove(
  function(e)
  {
    /* Behandlung der VERTIKALEN Achse der Info-BOX */
    x = e.pageX - Math.floor($('#jtip').width() / 2);

    if(x < 10)
    {
      x = 10;
    }
    else if(($(window).width()+$(window).scrollLeft()) < (x + $('#jtip').width() + 10))
    {
      x = ($(window).width()+$(window).scrollLeft()) - $('#jtip').width() - 10;
    }

    /* Behandlung der HORIZONTALEN Achse der Info-BOX */
    y = e.pageY + 10;

    if(y < 10)
    {
      y = 10;
    }
    else if(($(window).height()+$(window).scrollTop()) < (y + $('#jtip').height()))
    {
      y = e.pageY - $('#jtip').height() - 10;
    }

    /* Zeige und positioniere den Pfeil korrekt */
    // $('#jtip_arrow_up').show();

    $('#jtip').
      css('left', x +'px').
      css('top', y +'px');
  });
};

jQuery(document).ready(function($)
{
  jtip();
}) 