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