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