(function(d){d.tools=d.tools||{version:"1.2.5"};d.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,g,f){c[e]=[g,f]}};var c={toggle:[function(e){var f=this.getConf(),g=this.getTip(),h=f.opacity;if(h<1){g.css({opacity:h})}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)}]};function b(g,i,f){var k=f.relative?g.position().top:g.offset().top,j=f.relative?g.position().left:g.offset().left,l=f.position[0];k-=i.outerHeight()-f.offset[0];j+=g.outerWidth()+f.offset[1];if(/iPad/i.test(navigator.userAgent)){k-=d(window).scrollTop()}var e=i.outerHeight()+g.outerHeight();if(l=="center"){k+=e/2}if(l=="bottom"){k+=e}l=f.position[1];var h=i.outerWidth()+g.outerWidth();if(l=="center"){j-=h/2}if(l=="left"){j-=h}return{top:k,left:j}}function a(h,j){var r=this,g=h.add(r),o,f=0,q=0,m=h.attr("title"),i=h.attr("data-tooltip"),s=c[j.effect],n,l=h.is(":input"),e=l&&h.is(":checkbox, :radio, select, :button, :submit"),k=h.attr("type"),p=j.events[k]||j.events[l?(e?"widget":"input"):"def"];if(!s){throw'Nonexistent effect "'+j.effect+'"'}p=p.split(/,\s*/);if(p.length!=2){throw"Tooltip: bad events configuration for "+k}h.bind(p[0],function(t){clearTimeout(f);if(j.predelay){q=setTimeout(function(){r.show(t)},j.predelay)}else{r.show(t)}}).bind(p[1],function(t){clearTimeout(q);if(j.delay){f=setTimeout(function(){r.hide(t)},j.delay)}else{r.hide(t)}});if(m&&j.cancelDefault){h.removeAttr("title");h.data("title",m)}d.extend(r,{show:function(u){if(!o){if(i){o=d(i)}else{if(j.tip){o=d(j.tip).eq(0)}else{if(m){o=d(j.layout).addClass(j.tipClass).appendTo(document.body).hide().append(m)}else{o=h.next();if(!o.length){o=h.parent().next()}}}}if(!o.length){throw"Cannot find tooltip for "+h}}if(r.isShown()){return r}o.stop(true,true);var v=b(h,o,j);if(j.tip){o.html(h.data("title"))}u=u||d.Event();u.type="onBeforeShow";g.trigger(u,[v]);if(u.isDefaultPrevented()){return r}v=b(h,o,j);o.css({position:"absolute",top:v.top,left:v.left});n=true;s[0].call(r,function(){u.type="onShow";n="full";g.trigger(u)});var t=j.events.tooltip.split(/,\s*/);if(!o.data("__set")){o.bind(t[0],function(){clearTimeout(f);clearTimeout(q)});if(t[1]&&!h.is("input:not(:checkbox, :radio), textarea")){o.bind(t[1],function(w){if(w.relatedTarget!=h[0]){h.trigger(p[1].split(" ")[0])}})}o.data("__set",true)}return r},hide:function(t){if(!o||!r.isShown()){return r}t=t||d.Event();t.type="onBeforeHide";g.trigger(t);if(t.isDefaultPrevented()){return}n=false;c[j.effect][1].call(r,function(){t.type="onHide";g.trigger(t)});return r},isShown:function(t){return t?n=="full":n},getConf:function(){return j},getTip:function(){return o},getTrigger:function(){return h}});d.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(u,t){if(d.isFunction(j[t])){d(r).bind(t,j[t])}r[t]=function(v){if(v){d(r).bind(t,v)}return r}})}d.fn.tooltip=function(e){var f=this.data("tooltip");if(f){return f}e=d.extend(true,{},d.tools.tooltip.conf,e);if(typeof e.position=="string"){e.position=e.position.split(/,?\s/)}this.each(function(){f=new a(d(this),e);d(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(d){var f=this.getConf(),g=this.getTip(),h=f.slideFade?{opacity:f.opacity}:{},e=c[f.direction]||c.up;h[e[1]]=e[0]+"="+f.slideOffset;if(f.slideFade){g.css({opacity:0})}g.show().animate(h,f.slideInSpeed,d)},function(e){var g=this.getConf(),i=g.slideOffset,h=g.slideFade?{opacity:0}:{},f=c[g.direction]||c.up;var d=""+f[0];if(g.bounce){d=d=="+"?"-":"+"}h[f[1]]=d+"="+i;this.getTip().animate(h,g.slideOutSpeed,function(){b(this).hide();e.call()})})})(jQuery);(function(d){var c=d.tools.tooltip;c.dynamic={conf:{classNames:"top right bottom left"}};function b(h){var e=d(window);var g=e.width()+e.scrollLeft();var f=e.height()+e.scrollTop();return[h.offset().top<=e.scrollTop(),g<=h.offset().left+h.width(),f<=h.offset().top+h.height(),e.scrollLeft()>=h.offset().left]}function a(f){var e=f.length;while(e--){if(f[e]){return false}}return true}d.fn.dynamic=function(f){if(typeof f=="number"){f={speed:f}}f=d.extend({},c.dynamic.conf,f);var e=f.classNames.split(/\s/),g;this.each(function(){var h=d(this).tooltip().onBeforeShow(function(l,m){var k=this.getTip(),j=this.getConf();if(!g){g=[j.position[0],j.position[1],j.offset[0],j.offset[1],d.extend({},j)]}d.extend(j,g[4]);j.position=[g[0],g[1]];j.offset=[g[2],g[3]];k.css({visibility:"hidden",position:"absolute",top:m.top,left:m.left}).show();var i=b(k);if(!a(i)){if(i[2]){d.extend(j,f.top);j.position[0]="top";k.addClass(e[0]);k.children(".top").show()}if(i[3]){d.extend(j,f.right);j.position[1]="right";k.addClass(e[1])}if(i[0]){d.extend(j,f.bottom);j.position[0]="bottom";k.addClass(e[2]);k.children(".bottom").show()}if(i[1]){d.extend(j,f.left);j.position[1]="left";k.addClass(e[3])}if(i[0]||i[2]){j.offset[0]*=-1}if(i[1]||i[3]){j.offset[1]*=-1}}else{k.children(".top").show()}k.css({visibility:"visible"}).hide()});h.onBeforeShow(function(){var j=this.getConf(),i=this.getTip();setTimeout(function(){j.position=[g[0],g[1]];j.offset=[g[2],g[3]]},0)});h.onHide(function(){var i=this.getTip();i.removeClass(f.classNames);i.children(".top").hide();i.children(".bottom").hide()});ret=h});return f.api?ret:this}})(jQuery);
