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