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