(function(b){b.cluetip={version:"1.2.4",template:'<div><div class="cluetip-outer"><h3 class="cluetip-title"></h3><div class="cluetip-inner"></div></div><div class="cluetip-extra"></div><div class="cluetip-arrows"></div></div>',setup:{insertionType:"appendTo",insertionElement:"body"},defaults:{multiple:!1,width:275,height:"auto",cluezIndex:97,positionBy:"auto",topOffset:15,leftOffset:15,local:!1,localPrefix:null,localIdSuffix:null,hideLocal:!0,attribute:"rel",titleAttribute:"title",splitTitle:"",escapeTitle:!1,
showTitle:!0,cluetipClass:"default",hoverClass:"",waitImage:!0,cursor:"help",arrows:!1,dropShadow:!0,dropShadowSteps:6,sticky:!1,mouseOutClose:!1,activation:"hover",clickThrough:!0,tracking:!1,delayedClose:0,closePosition:"top",closeText:"Close",truncate:0,fx:{open:"show",openSpeed:""},hoverIntent:{sensitivity:3,interval:50,timeout:0},onActivate:function(){return!0},onShow:function(){},onHide:function(){},ajaxCache:!0,ajaxProcess:function(b){return b=b.replace(/<(script|style|title)[^<]+<\/(script|style|title)>/gm,
"").replace(/<(link|meta)[^>]+>/g,"")},ajaxSettings:{dataType:"html"},debug:!1}};var m,B=0,L=0;b.fn.attrProp=b.fn.prop||b.fn.attr;b.fn.cluetip=function(h,l){function $(d,e,g){g="";e=e.dropShadow&&e.dropShadowSteps?+e.dropShadowSteps:0;if(b.support.boxShadow)return e&&(g="1px 1px "+e+"px rgba(0,0,0,0.5)"),d.css(b.support.boxShadow,g),!1;g=d.find(".cluetip-drop-shadow");if(e==g.length)return g;g.remove();for(var g=[],c=0;c<e;)g[c++]='<div style="top:'+c+"px;left:"+c+'px;"></div>';return g=b(g.join("")).css({position:"absolute",
backgroundColor:"#000",zIndex:O-1,opacity:0.1}).addClass("cluetip-drop-shadow").prependTo(d)}var d,e,r,z,t,U;"object"==typeof h&&(l=h,h=null);if("destroy"==h){var C=this.data("cluetip");if(C)return b(C.selector).remove(),b.removeData(this,"title"),b.removeData(this,"cluetip"),b(document).unbind(".cluetip"),this.unbind(".cluetip")}l=b.extend(!0,{},b.cluetip.defaults,l||{});B++;var C=b.cluetip.backCompat||!l.multiple?"cluetip":"cluetip-"+B,V="#"+C,v=b.cluetip.backCompat?"#":".",F=b.cluetip.setup.insertionType,
aa=b.cluetip.setup.insertionElement||"body",F=/appendTo|prependTo|insertBefore|insertAfter/.test(F)?F:"appendTo";d=b(V);if(!d.length){d=b(b.cluetip.template)[F](aa).attr("id",C).css({position:"absolute",display:"none"});var O=+l.cluezIndex;r=d.find(v+"cluetip-outer").css({position:"relative",zIndex:O});e=d.find(v+"cluetip-inner");z=d.find(v+"cluetip-title")}m=b("#cluetip-waitimage");m.length||(m=b("<div></div>").attr("id","cluetip-waitimage").css({position:"absolute"}));m.insertBefore(d).hide();var ba=
(parseInt(d.css("paddingLeft"),10)||0)+(parseInt(d.css("paddingRight"),10)||0);this.each(function(C){function F(){return!1}var g=this,c=b(this),a=b.extend(!0,{},l,b.metadata?c.metadata():b.meta?c.data():c.data("cluetip")||{}),G=!1,H=!1,B=0,n=a[a.attribute]||c.attrProp(a.attribute)||c.attr(a.attribute),M=a.cluetipClass;O=+a.cluezIndex;c.data("cluetip",{title:g.title,zIndex:O,selector:V});if(!n&&!a.splitTitle&&!h)return!0;a.local&&a.localPrefix&&(n=a.localPrefix+n);a.local&&a.hideLocal&&n&&b(n+":first").hide();
var u=parseInt(a.topOffset,10),A=parseInt(a.leftOffset,10),s,W,P=isNaN(parseInt(a.height,10))?"auto":/\D/g.test(a.height)?a.height:a.height+"px",Q,w,o,I,R,X=parseInt(a.width,10)||275,p=X+ba+a.dropShadowSteps,D=this.offsetWidth,x,k,q,J,E,y="title"!=a.attribute?c.attrProp(a.titleAttribute)||"":"";a.splitTitle&&(E=y.split(a.splitTitle),y=a.showTitle||""===E[0]?E.shift():"");a.escapeTitle&&(y=y.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;"));var S=function(f){var i;if(!1===a.onActivate(c))return!1;
H=!0;d=b(V).css({position:"absolute"});r=d.find(v+"cluetip-outer");e=d.find(v+"cluetip-inner");z=d.find(v+"cluetip-title");t=d.find(v+"cluetip-arrows");d.removeClass().css({width:X});n==c.attr("href")&&c.css("cursor",a.cursor);a.hoverClass&&c.addClass(a.hoverClass);w=c.offset().top;x=c.offset().left;D=c.innerWidth();f.type==focus?(q=x+D/2+A,d.css({left:k}),I=w+u):(q=f.pageX,I=f.pageY);"area"!=g.tagName.toLowerCase()&&(Q=b(document).scrollTop(),J=b(window).width());if("fixed"==a.positionBy)k=D+x+A,
d.css({left:k});else{k=D>x&&x>p||x+D+p+A>J?x-p-A:D+x+A;if("area"==g.tagName.toLowerCase()||"mouse"==a.positionBy||D+p>J)q+20+p>J?(d.addClass("cluetip-"+M),k=0<=q-p-A?q-p-A-parseInt(d.css("marginLeft"),10)+parseInt(e.css("marginRight"),10):q-p/2):k=q+A;i=0>k?f.pageY+u:f.pageY;if(0>k||"bottomTop"==a.positionBy)k=q+p/2>J?J/2-p/2:Math.max(q-p/2,0)}t.css({zIndex:c.data("cluetip").zIndex+1});d.css({left:k,zIndex:c.data("cluetip").zIndex});W=b(window).height();if(h)"function"==typeof h&&(h=h.call(g)),e.html(h),
K(i);else if(E){f=E.length;e.html(f?E[0]:"");if(1<f)for(var j=1;j<f;j++)e.append('<div class="split-body">'+E[j]+"</div>");K(i)}else if(!a.local&&0!==n.indexOf("#"))if(/\.(jpe?g|tiff?|gif|png)(?:\?.*)?$/i.test(n))e.html('<img src="'+n+'" alt="'+y+'" />'),K(i);else{var Y=a.ajaxSettings.beforeSend,l=a.ajaxSettings.error,o=a.ajaxSettings.success,s=a.ajaxSettings.complete,f=b.extend(!0,{},a.ajaxSettings,{cache:a.ajaxCache,url:n,beforeSend:function(b,f){Y&&Y.call(g,b,d,e,f);r.children().empty();a.waitImage&&
m.css({top:I+20,left:q+20,zIndex:c.data("cluetip").zIndex-1}).show()},error:function(a,b){H&&(l?l.call(g,a,b,d,e):e.html(""))},success:function(f,c){G=a.ajaxProcess.call(g,f);if(b.isPlainObject(G))y=G.title,G=G.content;H&&(o&&o.call(g,f,c,d,e),e.html(G))},complete:function(a,f){s&&s.call(g,a,f,d,e);var c=e[0].getElementsByTagName("img");L=c.length;for(var j=0,k=c.length;j<k;j++)c[j].complete&&L--;L&&!b.browser.opera?b(c).bind("load error",function(){L--;1>L&&(m.hide(),H&&K(i))}):(m.hide(),H&&K(i))}});
b.ajax(f)}else a.local&&(f=b(n+(/^#\S+$/.test(n)?"":":eq("+C+")")).clone(!0).show(),a.localIdSuffix&&f.attr("id",f[0].id+a.localIdSuffix),e.html(f),K(i))},K=function(f){var i,j;i=y||a.showTitle&&"&nbsp;";var h="";j="";d.addClass("cluetip-"+M);if(a.truncate){var l=e.text().slice(0,a.truncate)+"...";e.html(l)}i?z.show().html(i):z.hide();a.sticky&&(i=b('<div class="cluetip-close"><a href="#">'+a.closeText+"</a></div>"),"bottom"==a.closePosition?i.appendTo(e):"title"==a.closePosition?i.prependTo(z):i.prependTo(e),
i.bind("click.cluetip",function(){N();return!1}),a.mouseOutClose?d.bind("mouseleave.cluetip",function(){N()}):d.unbind("mouseleave.cluetip"));r.css({zIndex:c.data("cluetip").zIndex,overflow:"auto"==P?"visible":"auto",height:P});s="auto"==P?Math.max(d.outerHeight(),d.height()):parseInt(P,10);o=w;R=Q+W;"fixed"==a.positionBy?o=w-a.dropShadowSteps+u:k<q&&Math.max(k,0)+p>q||"bottomTop"==a.positionBy?w+s+u>R&&I-Q>s+u?(o=I-s-u,j="top"):(o=I+u,j="bottom"):o=w+s+u>R?s>=W?Q:R-s-u:"block"==c.css("display")||
"area"==g.tagName.toLowerCase()||"mouse"==a.positionBy?f-u:w-a.dropShadowSteps;""===j&&(j=k<x?"left":"right");i=" clue-"+j+"-"+M+" cluetip-"+M;"rounded"==M&&(i+=" ui-corner-all");d.css({top:o+"px"}).attrProp({className:"cluetip"+i});a.arrows?(/(left|right)/.test(j)&&(j=d.height()-t.height(),h=0<=k&&0<f?w-o-a.dropShadowSteps:0,h=(j>h?h:j)+"px"),t.css({top:h}).show()):t.hide();(U=$(d,a))&&U.length&&U.hide().css({height:s,width:X,zIndex:c.data("cluetip").zIndex-1}).show();d.hide()[a.fx.open](a.fx.openSpeed||
0);b.fn.bgiframe&&d.bgiframe();0<a.delayedClose&&(B=setTimeout(N,a.delayedClose));a.onShow.call(g,d,e)},T=function(){H=!1;m.hide();if(!a.sticky||/click|toggle/.test(a.activation))N(),clearTimeout(B);a.hoverClass&&c.removeClass(a.hoverClass)},N=function(f){var f=f&&f.data("cluetip")?f:c,d=f.data("cluetip")&&f.data("cluetip").selector,e=b(d||"div.cluetip"),g=e.find(v+"cluetip-inner"),h=e.find(v+"cluetip-arrows");e.hide().removeClass();a.onHide.call(f[0],e,g);d&&(f.removeClass("cluetip-clicked"),f.css("cursor",
""));d&&y&&f.attrProp(a.titleAttribute,y);a.arrows&&h.css({top:""})};b(document).unbind("hideCluetip.cluetip").bind("hideCluetip.cluetip",function(a){N(b(a.target))});if(/click|toggle/.test(a.activation))c.bind("click.cluetip",function(a){d.is(":hidden")||!c.is(".cluetip-clicked")?(S(a),b(".cluetip-clicked").removeClass("cluetip-clicked"),c.addClass("cluetip-clicked")):T(a);return!1});else if("focus"==a.activation)c.bind("focus.cluetip",function(a){c.attrProp("title","");S(a)}),c.bind("blur.cluetip",
function(a){c.attrProp("title",c.data("cluetip").title);T(a)});else{c[a.clickThrough?"unbind":"bind"]("click.cluetip",F);var Z=function(b){if(a.tracking){var e=k-b.pageX,g=o?o-b.pageY:w-b.pageY;c.bind("mousemove.cluetip",function(a){d.css({left:a.pageX+e,top:a.pageY+g})})}};b.fn.hoverIntent&&a.hoverIntent?c.hoverIntent({sensitivity:a.hoverIntent.sensitivity,interval:a.hoverIntent.interval,over:function(a){S(a);Z(a)},timeout:a.hoverIntent.timeout,out:function(a){T(a);c.unbind("mousemove.cluetip")}}):
c.bind("mouseenter.cluetip",function(a){S(a);Z(a)}).bind("mouseleave.cluetip",function(a){T(a);c.unbind("mousemove.cluetip")});c.bind("mouseover.cluetip",function(){c.attrProp("title","")}).bind("mouseleave.cluetip",function(){c.attrProp("title",c.data("cluetip").title)})}});return this};(function(){b.support=b.support||{};for(var h=document.createElement("div").style,l=["boxShadow"],m=["moz","Moz","webkit","o"],d=0,e=l.length;d<e;d++){var r=l[d],z=r.charAt(0).toUpperCase()+r.slice(1);if("undefined"!==
typeof h[r])b.support[r]=r;else for(var t=0,B=m.length;t<B;t++)if("undefined"!==typeof h[m[t]+z]){b.support[r]=m[t]+z;break}}})();b.fn.cluetip.defaults=b.cluetip.defaults})(jQuery);
