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