(function(E){var I,H,G,D,F,J,C;E.fn.cluetip=function(K){var L=E.extend({},E.fn.cluetip.defaults,K);if(K&&K.ajaxSettings){E.extend(L.ajaxSettings,K.ajaxSettings);delete K.ajaxSettings}if(K&&K.hoverIntent){E.extend(L.hoverIntent,K.hoverIntent);delete K.hoverIntent}if(K&&K.fx){E.extend(L.fx,K.fx);delete K.fx}return this.each(function(h){var O=false;var Y=parseInt(L.cluezIndex,10)-1;var q=false,p=0;if(!I){H=E('<div id="cluetip-inner"></div>');D=E('<h3 id="cluetip-title"></h3>');G=E('<div id="cluetip-outer"></div>').append(H).prepend(D);I=E('<div id="cluetip"></div>').css({zIndex:L.cluezIndex}).append(G).append('<div id="cluetip-extra"></div>')[B](A).hide();E('<div id="cluetip-waitimage"></div>').css({position:"absolute",zIndex:Y-1}).insertBefore("#cluetip").hide();I.css({position:"absolute",zIndex:Y});G.css({position:"relative",zIndex:Y+1});F=E('<div id="cluetip-arrows" class="cluetip-arrows"></div>').css({zIndex:Y+1}).appendTo("#cluetip")}var g=(L.dropShadow)?+L.dropShadowSteps:0;if(!J){J=E([]);for(var t=0;t<g;t++){J=J.add(E("<div></div>").css({zIndex:Y-t-1,opacity:0.1,top:1+t,left:1+t}))}J.css({position:"absolute",backgroundColor:"#000"}).prependTo(I)}var U=E(this);var d=U.attr(L.attribute),R=L.cluetipClass;if(!d&&!L.splitTitle){return true}if(L.local&&L.hideLocal){E(d+":first").hide()}var e=parseInt(L.topOffset,10),a=parseInt(L.leftOffset,10);var Z,r;var W=isNaN(parseInt(L.height,10))?"auto":(/\D/g).test(L.height)?L.height:L.height+"px";var M,S,j,w,l,s;var X=isNaN(parseInt(L.width,10))?275:parseInt(L.width,10);var u=X+parseInt(I.css("paddingLeft"))+parseInt(I.css("paddingRight"))+g;var b=this.offsetWidth;var T,k,x,m,N;var o;var f=(L.attribute!="title")?U.attr(L.titleAttribute):"";if(L.splitTitle){if(f==undefined){f=""}o=f.split(L.splitTitle);f=o.shift()}var Q;var V=function(AC){if(!L.onActivate(U)){return false}q=true;I.removeClass().css({width:X});if(d==U.attr("href")){U.css("cursor",L.cursor)}U.attr("title","");if(L.hoverClass){U.addClass(L.hoverClass)}S=j=U.offset().top;T=U.offset().left;m=AC.pageX;l=AC.pageY;if(U[0].tagName.toLowerCase()!="area"){M=E(document).scrollTop();N=E(window).width()}if(L.positionBy=="fixed"){k=b+T+a;I.css({left:k})}else{k=(b>T&&T>u)||T+b+u+a>N?T-u-a:b+T+a;if(U[0].tagName.toLowerCase()=="area"||L.positionBy=="mouse"||b+u>N){if(m+20+u>N){I.addClass(" cluetip-"+R);k=(m-u-a)>=0?m-u-a-parseInt(I.css("marginLeft"),10)+parseInt(H.css("marginRight"),10):m-(u/2)}else{k=m+a}}var z=k<0?AC.pageY+e:AC.pageY;I.css({left:(k>0&&L.positionBy!="bottomTop")?k:(m+(u/2)>N)?N/2-u/2:Math.max(m-(u/2),0)})}r=E(window).height();if(o){var AA=o.length;for(var AB=0;AB<AA;AB++){if(AB==0){H.html(o[AB])}else{H.append('<div class="split-body">'+o[AB]+"</div>")}}n(z)}else{if(!L.local&&d.indexOf("#")!=0){if(O&&L.ajaxCache){H.html(O);n(z)}else{var AD=L.ajaxSettings;AD.url=d;AD.beforeSend=function(){G.children().empty();if(L.waitImage){E("#cluetip-waitimage").css({top:l+20,left:m+20}).show()}};AD.error=function(){if(q){H.html("<i>sorry, the contents could not be loaded</i>")}};AD.success=function(i){O=L.ajaxProcess(i);if(q){H.html(O)}};AD.complete=function(){C=E("#cluetip-inner img").length;if(C){E("#cluetip-inner img").load(function(){C--;if(C<1){E("#cluetip-waitimage").hide();if(q){n(z)}}})}else{E("#cluetip-waitimage").hide();if(q){n(z)}}};E.ajax(AD)}}else{if(L.local){var AE=E(d+":first");var y=E.fn.wrapInner?AE.wrapInner("<div></div>").children().clone(true):AE.html();E.fn.wrapInner?H.empty().append(y):H.html(y);n(z)}}}};var n=function(z){I.addClass("cluetip-"+R);if(L.truncate){var AA=H.text().slice(0,L.truncate)+"...";H.html(AA)}function i(){}f?D.show().html(f):(L.showTitle)?D.show().html("&nbsp;"):D.hide();if(L.sticky){var y=E('<div id="cluetip-close"><a href="#">'+L.closeText+"</a></div>");(L.closePosition=="bottom")?y.appendTo(H):(L.closePosition=="title")?y.prependTo(D):y.prependTo(H);y.click(function(){c();return false});if(L.mouseOutClose){if(E.fn.hoverIntent&&L.hoverIntent){I.hoverIntent({over:i,timeout:L.hoverIntent.timeout,out:function(){y.trigger("click")}})}else{I.hover(i,function(){y.trigger("click")})}}else{I.unbind("mouseout")}}var AB="";G.css({overflow:W=="auto"?"visible":"auto",height:W});Z=W=="auto"?I.outerHeight():parseInt(W,10);w=j;s=M+r;if(L.positionBy=="fixed"){w=j-L.dropShadowSteps+e}else{if((k<m&&Math.max(k,0)+u>m)||L.positionBy=="bottomTop"){if(j+Z+e>s&&l-M>Z+e){w=l-Z-e;AB="top"}else{w=l+e;AB="bottom"}}else{if(j+Z+e>s){w=(Z>=r)?M:s-Z-e}else{if(U.css("display")=="block"||U[0].tagName.toLowerCase()=="area"||L.positionBy=="mouse"){w=z-e}else{w=j-L.dropShadowSteps}}}}if(AB==""){k<T?AB="left":AB="right"}I.css({top:w+"px"}).removeClass().addClass("clue-"+AB+"-"+R).addClass(" cluetip-"+R);if(L.arrows){var AC=(j-w-L.dropShadowSteps);F.css({top:(/(left|right)/.test(AB)&&k>=0&&AC>0)?AC+"px":/(left|right)/.test(AB)?0:""}).show()}else{F.hide()}J.hide();I.hide()[L.fx.open](L.fx.open!="show"&&L.fx.openSpeed);if(L.dropShadow){J.css({height:Z,width:L.width}).show()}if(E.fn.bgiframe){I.bgiframe()}if(L.delayedClose>0){p=setTimeout(c,L.delayedClose)}L.onShow(I,H)};var v=function(){q=false;E("#cluetip-waitimage").hide();if(!L.sticky||(/click|toggle/).test(L.activation)){c();clearTimeout(p)}if(L.hoverClass){U.removeClass(L.hoverClass)}E(".cluetip-clicked").removeClass("cluetip-clicked")};var c=function(){G.parent().hide().removeClass().end().children().empty();if(f){U.attr("title",f)}U.css("cursor","");if(L.arrows){F.css({top:""})}};if((/click|toggle/).test(L.activation)){U.click(function(i){if(I.is(":hidden")||!U.is(".cluetip-clicked")){V(i);E(".cluetip-clicked").removeClass("cluetip-clicked");U.addClass("cluetip-clicked")}else{v(i)}this.blur();return false})}else{if(L.activation=="focus"){U.focus(function(i){V(i)});U.blur(function(i){v(i)})}else{U.click(function(){if(U.attr("href")&&U.attr("href")==d&&!L.clickThrough){return false}});var P=function(i){if(L.tracking==true){var z=k-i.pageX;var y=w?w-i.pageY:j-i.pageY;U.mousemove(function(AA){I.css({left:AA.pageX+z,top:AA.pageY+y})})}};if(E.fn.hoverIntent&&L.hoverIntent){U.mouseover(function(){U.attr("title","")}).hoverIntent({sensitivity:L.hoverIntent.sensitivity,interval:L.hoverIntent.interval,over:function(i){V(i);P(i)},timeout:L.hoverIntent.timeout,out:function(i){v(i);U.unbind("mousemove")}})}else{U.hover(function(i){V(i);P(i)},function(i){v(i);U.unbind("mousemove")})}}}})};E.fn.cluetip.defaults={width:275,height:"auto",cluezIndex:97,positionBy:"auto",topOffset:15,leftOffset:15,local:false,hideLocal:true,attribute:"rel",titleAttribute:"title",splitTitle:"",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(K){return true},onShow:function(K,L){},ajaxCache:true,ajaxProcess:function(K){K=K.replace(/<s(cript|tyle)(.|\s)*?\/s(cript|tyle)>/g,"").replace(/<(link|title)(.|\s)*?\/(link|title)>/g,"");return K},ajaxSettings:{dataType:"html"}};var B="appendTo",A="body";E.cluetip={};E.cluetip.setup=function(K){if(K&&K.insertionType&&(K.insertionType).match(/appendTo|prependTo|insertBefore|insertAfter/)){B=K.insertionType}if(K&&K.insertionElement){A=K.insertionElement}}})(jQuery);