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