$(function (){
  jQuery.fn.extend({
    tlShow:function(){this.removeClass("hide");return this},
    tlHide:function(){this.addClass("hide");return this},
    isTlHidden:function(){return this.hasClass("hide")},
    tlClose:function(){this.tlHide().removeAttr('style');return this}
  });

  var b = $('.divPayCreditPrice');
  var p = $('#creditTooltip');
  var c = $('#creditTooltipClose');
  var bp = undefined;

  b.click(function(){
    if (p.isTlHidden && p.attr('style') == undefined) {
      bp = $(this).offset();
      p.slideDown('fast',function(){p.tlShow()});
      p.offset({ top: bp.top + b.height() + 10, left : bp.left - 65});
    }
    return false;
  });

  c.click(function(){p.tlClose()});
});
