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