(function(a){function d(k,l,m){var e=m.relative?k.position().top:k.offset().top,n=m.relative?k.position().left:k.offset().left,f=m.position[0];e-=l.outerHeight()-m.offset[0];n+=k.outerWidth()+m.offset[1];if(/iPad/i.test(navigator.userAgent)){e-=a(window).scrollTop()}var g=l.outerHeight()+k.outerHeight();if(f=="center"){e+=g/2}if(f=="bottom"){e+=g}f=m.position[1];k=l.outerWidth()+k.outerWidth();if(f=="center"){n-=k/2}if(f=="left"){n-=k}return{top:e,left:n}}function b(A,B){var C=this,p=A.add(C),D,u=0,w=0,z=A.attr("title"),e=A.attr("data-tooltip"),f=c[B.effect],y,g=A.is(":input"),o=g&&A.is(":checkbox, :radio, select, :button, :submit"),n=A.attr("type"),x=B.events[n]||B.events[g?o?"widget":"input":"def"];if(!f){throw'Nonexistent effect "'+B.effect+'"'}x=x.split(/,\s*/);if(x.length!=2){throw"Tooltip: bad events configuration for "+n}A.bind(x[0],function(h){clearTimeout(u);if(B.predelay){w=setTimeout(function(){C.show(h)},B.predelay)}else{C.show(h)}}).bind(x[1],function(h){clearTimeout(w);if(B.delay){u=setTimeout(function(){C.hide(h)},B.delay)}else{C.hide(h)}});if(z&&B.cancelDefault){A.removeAttr("title");A.data("title",z)}a.extend(C,{show:function(i){if(!D){if(e){D=a(e)}else{if(B.tip){D=a(B.tip).eq(0)}else{if(z){D=a(B.layout).addClass(B.tipClass).appendTo(document.body).hide().append(z)}else{D=A.next();D.length||(D=A.parent().next())}}}if(!D.length){throw"Cannot find tooltip for "+A}}if(C.isShown()){return C}D.stop(true,true);var h=d(A,D,B);B.tip&&D.html(A.data("title"));i=i||a.Event();i.type="onBeforeShow";p.trigger(i,[h]);if(i.isDefaultPrevented()){return C}h=d(A,D,B);D.css({position:"absolute",top:h.top,left:h.left});y=true;f[0].call(C,function(){i.type="onShow";y="full";p.trigger(i)});h=B.events.tooltip.split(/,\s*/);if(!D.data("__set")){D.bind(h[0],function(){clearTimeout(u);clearTimeout(w)});h[1]&&!A.is("input:not(:checkbox, :radio), textarea")&&D.bind(h[1],function(j){j.relatedTarget!=A[0]&&A.trigger(x[1].split(" ")[0])});D.data("__set",true)}return C},hide:function(h){if(!D||!C.isShown()){return C}h=h||a.Event();h.type="onBeforeHide";p.trigger(h);if(!h.isDefaultPrevented()){y=false;c[B.effect][1].call(C,function(){h.type="onHide";p.trigger(h)});return C}},isShown:function(h){return h?y=="full":y},getConf:function(){return B},getTip:function(){return D},getTrigger:function(){return A}});a.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(i,h){a.isFunction(B[h])&&a(C).bind(h,B[h]);C[h]=function(j){j&&a(C).bind(h,j);return C}})}a.tools=a.tools||{version:"1.2.5"};a.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,position:["top","center"],offset:[0,0],relative:false,cancelDefault:true,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(e,f,g){c[e]=[f,g]}};var c={toggle:[function(e){var f=this.getConf(),g=this.getTip();f=f.opacity;f<1&&g.css({opacity:f});g.show();e.call()},function(e){this.getTip().hide();e.call()}],fade:[function(e){var f=this.getConf();this.getTip().fadeTo(f.fadeInSpeed,f.opacity,e)},function(e){this.getTip().fadeOut(this.getConf().fadeOutSpeed,e)}]};a.fn.tooltip=function(e){var f=this.data("tooltip");if(f){return f}e=a.extend(true,{},a.tools.tooltip.conf,e);if(typeof e.position=="string"){e.position=e.position.split(/,?\s/)}this.each(function(){f=new b(a(this),e);a(this).data("tooltip",f)});return e.api?f:this}})(jQuery);(function(b){var a=b.tools.tooltip;b.extend(a.conf,{direction:"up",bounce:false,slideOffset:10,slideInSpeed:200,slideOutSpeed:200,slideFade:!b.browser.msie});var c={up:["-","top"],down:["+","top"],left:["-","left"],right:["+","left"]};a.addEffect("slide",function(e){var h=this.getConf(),d=this.getTip(),i=h.slideFade?{opacity:h.opacity}:{},j=c[h.direction]||c.up;i[j[1]]=j[0]+"="+h.slideOffset;h.slideFade&&d.css({opacity:0});d.show().animate(i,h.slideInSpeed,e)},function(l){var e=this.getConf(),k=e.slideOffset,i=e.slideFade?{opacity:0}:{},j=c[e.direction]||c.up,d=""+j[0];if(e.bounce){d=d=="+"?"-":"+"}i[j[1]]=d+"="+k;this.getTip().animate(i,e.slideOutSpeed,function(){b(this).hide();l.call()})})})(jQuery);
