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