/*!
 * jQuery clueTip plugin v1.2.5
 *
 * Date: Sun Jun 10 17:51:13 2012 EDT
 * Requires: jQuery v1.3+
 *
 * Copyright 2012, Karl Swedberg
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 *
 * Examples can be found at http://plugins.learningjquery.com/cluetip/demo/
 *
*/
(function(c){c.cluetip={version:"1.2.5",template:'<div><div class="cluetip-outer"><h3 class="cluetip-title ui-widget-header ui-cluetip-header"></h3><div class="cluetip-inner ui-widget-content ui-cluetip-content"></div></div><div class="cluetip-extra"></div><div class="cluetip-arrows ui-state-default"></div></div>',setup:{insertionType:"appendTo",insertionElement:"body"},defaults:{multiple:false,width:275,height:"auto",cluezIndex:97,positionBy:"auto",topOffset:15,leftOffset:15,local:false,localPrefix:null,
localIdSuffix: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(){return true},onShow:function(){},
onHide:function(){},ajaxCache:true,ajaxProcess:function(l){return l=l.replace(/<(script|style|title)[^<]+<\/(script|style|title)>/gm,"").replace(/<(link|meta)[^>]+>/g,"")},ajaxSettings:{dataType:"html"},debug:false}};var B,L={},ia=0,R=0;c.fn.attrProp=c.fn.prop||c.fn.attr;c.fn.cluetip=function(l,r){function S(E,j){var k=E||"";j=j||"";if(typeof j=="object")c.each(j,function(i,d){k+="-"+i+"-"+d});else if(typeof j=="string")k+=j;return k}function T(E,j,k){k="";j=j.dropShadow&&j.dropShadowSteps?+j.dropShadowSteps:
0;if(c.support.boxShadow){if(j)k="1px 1px "+j+"px rgba(0,0,0,0.5)";E.css(c.support.boxShadow,k);return false}k=E.find(".cluetip-drop-shadow");if(j==k.length)return k;k.remove();k=[];for(var i=0;i<j;)k[i++]='<div style="top:'+i+"px;left:"+i+'px;"></div>';return k=c(k.join("")).css({position:"absolute",backgroundColor:"#000",zIndex:U-1,opacity:0.1}).addClass("cluetip-drop-shadow").prependTo(E)}var e,h,F,s,G,da;if(typeof l=="object"){r=l;l=null}if(l=="destroy"){var V=this.data("cluetip");if(V){c(V.selector).remove();
c.removeData(this,"title");c.removeData(this,"cluetip")}c(document).unbind(".cluetip");return this.unbind(".cluetip")}r=c.extend(true,{},c.cluetip.defaults,r||{});ia++;var U;V=c.cluetip.backCompat||!r.multiple?"cluetip":"cluetip-"+ia;var ea="#"+V,v=c.cluetip.backCompat?"#":".",Y=c.cluetip.setup.insertionType,oa=c.cluetip.setup.insertionElement||"body";Y=/appendTo|prependTo|insertBefore|insertAfter/.test(Y)?Y:"appendTo";e=c(ea);if(!e.length){e=c(c.cluetip.template)[Y](oa).attr("id",V).css({position:"absolute",
display:"none"});U=+r.cluezIndex;F=e.find(v+"cluetip-outer").css({position:"relative",zIndex:U});h=e.find(v+"cluetip-inner");s=e.find(v+"cluetip-title")}B=c("#cluetip-waitimage");B.length||(B=c("<div></div>").attr("id","cluetip-waitimage").css({position:"absolute"}));B.insertBefore(e).hide();var pa=(parseInt(e.css("paddingLeft"),10)||0)+(parseInt(e.css("paddingRight"),10)||0);this.each(function(E){function j(){return false}function k(b,f){var g=b.status;f.beforeSend(b.xhr,f);if(g=="error")f[g](b.xhr,
b.textStatus);else g=="success"&&f[g](b.data,b.textStatus,b.xhr);f.complete(b.xhr,f.textStatus)}var i=this,d=c(this),a=c.extend(true,{},r,c.metadata?d.metadata():c.meta?d.data():d.data("cluetip")||{}),H=false,M=false,ja=0,o=a[a.attribute]||(a.attribute=="href"?d.attr(a.attribute):d.attrProp(a.attribute)||d.attr(a.attribute)),W=a.cluetipClass;U=+a.cluezIndex;d.data("cluetip",{title:i.title,zIndex:U,selector:ea});if(!o&&!a.splitTitle&&!l)return true;if(a.local&&a.localPrefix)o=a.localPrefix+o;a.local&&
a.hideLocal&&o&&c(o+":first").hide();var t=parseInt(a.topOffset,10),C=parseInt(a.leftOffset,10),D,fa,Z=isNaN(parseInt(a.height,10))?"auto":/\D/g.test(a.height)?a.height:a.height+"px",$,w,x,N,aa,ga=parseInt(a.width,10)||275,p=ga+pa+a.dropShadowSteps,I=this.offsetWidth,y,m,q,O,J,z=a.attribute!="title"?d.attrProp(a.titleAttribute)||"":"";if(a.splitTitle){J=z.split(a.splitTitle);z=a.showTitle||J[0]===""?J.shift():""}if(a.escapeTitle)z=z.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;");
var ba=function(b){var f,g;if(a.onActivate.call(i,b)===false)return false;M=true;e=c(ea).css({position:"absolute"});F=e.find(v+"cluetip-outer");h=e.find(v+"cluetip-inner");s=e.find(v+"cluetip-title");G=e.find(v+"cluetip-arrows");e.removeClass().css({width:ga});o==d.attr("href")&&d.css("cursor",a.cursor);a.hoverClass&&d.addClass(a.hoverClass);w=d.offset().top;y=d.offset().left;I=d.innerWidth();if(b.type==focus){q=y+I/2+C;e.css({left:m});N=w+t}else{q=b.pageX;N=b.pageY}if(i.tagName.toLowerCase()!="area"){$=
c(document).scrollTop();O=c(window).width()}if(a.positionBy=="fixed"){m=I+y+C;e.css({left:m})}else{m=I>y&&y>p||y+I+p+C>O?y-p-C:I+y+C;if(i.tagName.toLowerCase()=="area"||a.positionBy=="mouse"||I+p>O)if(q+20+p>O){e.addClass("cluetip-"+W);m=q-p-C>=0?q-p-C-parseInt(e.css("marginLeft"),10)+parseInt(h.css("marginRight"),10):q-p/2}else m=q+C;f=m<0?b.pageY+t:b.pageY;if(m<0||a.positionBy=="bottomTop")m=q+p/2>O?O/2-p/2:Math.max(q-p/2,0)}G.css({zIndex:d.data("cluetip").zIndex+1});e.css({left:m,zIndex:d.data("cluetip").zIndex});
fa=c(window).height();if(l){if(typeof l=="function")l=l.call(i);h.html(l);P(f)}else if(J){b=J.length;h.html(b?J[0]:"");if(b>1)for(var n=1;n<b;n++)h.append('<div class="split-body">'+J[n]+"</div>");P(f)}else if(!a.local&&o.indexOf("#")!==0)if(/\.(jpe?g|tiff?|gif|png)(?:\?.*)?$/i.test(o)){h.html('<img src="'+o+'" alt="'+z+'" />');P(f)}else{var Q=a.ajaxSettings.beforeSend,ka=a.ajaxSettings.error,la=a.ajaxSettings.success,ma=a.ajaxSettings.complete;g=S(o,a.ajaxSettings.data);b=c.extend(true,{},a.ajaxSettings,
{cache:a.ajaxCache,url:o,beforeSend:function(u,A){Q&&Q.call(i,u,e,h,A);F.children().empty();a.waitImage&&B.css({top:N+20,left:q+20,zIndex:d.data("cluetip").zIndex-1}).show()},error:function(u,A){if(r.ajaxCache&&!L[g])L[g]={status:"error",textStatus:A,xhr:u};if(M)ka?ka.call(i,u,A,e,h):h.html("<i>sorry, the contents could not be loaded</i>")},success:function(u,A,K){if(r.ajaxCache&&!L[g])L[g]={status:"success",data:u,textStatus:A,xhr:K};H=a.ajaxProcess.call(i,u);if(typeof H=="object"&&H!==null){z=H.title;
H=H.content}if(M){la&&la.call(i,u,A,e,h);h.html(H)}},complete:function(u,A){ma&&ma.call(i,u,A,e,h);var K=h[0].getElementsByTagName("img");R=K.length;for(var ha=0,qa=K.length;ha<qa;ha++)K[ha].complete&&R--;if(R&&!c.browser.opera)c(K).bind("load.ct error.ct",function(){R--;if(R===0){B.hide();c(K).unbind(".ct");M&&P(f)}});else{B.hide();M&&P(f)}}});L[g]?k(L[g],b):c.ajax(b)}else if(a.local){b=c(o+(/^#\S+$/.test(o)?"":":eq("+E+")")).clone(true).show();a.localIdSuffix&&b.attr("id",b[0].id+a.localIdSuffix);
h.html(b);P(f)}},P=function(b){var f,g;f=z||a.showTitle&&"&nbsp;";var n="";g="";e.addClass("cluetip-"+W);if(a.truncate){var Q=h.text().slice(0,a.truncate)+"...";h.html(Q)}f?s.show().html(f):s.hide();if(a.sticky){f=c('<div class="cluetip-close"><a href="#">'+a.closeText+"</a></div>");a.closePosition=="bottom"?f.appendTo(h):a.closePosition=="title"?f.prependTo(s):f.prependTo(h);f.bind("click.cluetip",function(){X();return false});a.mouseOutClose?e.bind("mouseleave.cluetip",function(){X()}):e.unbind("mouseleave.cluetip")}F.css({zIndex:d.data("cluetip").zIndex,
overflow:Z=="auto"?"visible":"auto",height:Z});D=Z=="auto"?Math.max(e.outerHeight(),e.height()):parseInt(Z,10);x=w;aa=$+fa;if(a.positionBy=="fixed")x=w-a.dropShadowSteps+t;else if(m<q&&Math.max(m,0)+p>q||a.positionBy=="bottomTop")if(w+D+t>aa&&N-$>D+t){x=N-D-t;g="top"}else{x=N+t;g="bottom"}else x=w+D+t>aa?D>=fa?$:aa-D-t:d.css("display")=="block"||i.tagName.toLowerCase()=="area"||a.positionBy=="mouse"?b-t:w-a.dropShadowSteps;if(g==="")g=m<y?"left":"right";f=" clue-"+g+"-"+W+" cluetip-"+W;if(W=="rounded")f+=
" ui-corner-all";e.css({top:x+"px"}).attrProp({className:"cluetip ui-widget ui-widget-content ui-cluetip"+f});if(a.arrows){if(/(left|right)/.test(g)){g=e.height()-G.height();n=m>=0&&b>0?w-x-a.dropShadowSteps:0;n=g>n?n:g;n+="px"}G.css({top:n}).show()}else G.hide();(da=T(e,a))&&da.length&&da.hide().css({height:D,width:ga,zIndex:d.data("cluetip").zIndex-1}).show();e.hide()[a.fx.open](a.fx.openSpeed||0);c.fn.bgiframe&&e.bgiframe();if(a.delayedClose>0)ja=setTimeout(X,a.delayedClose);a.onShow.call(i,e,
h)},ca=function(){M=false;B.hide();if(!a.sticky||/click|toggle/.test(a.activation)){X();clearTimeout(ja)}a.hoverClass&&d.removeClass(a.hoverClass)},X=function(b){b=b&&b.data("cluetip")?b:d;var f=b.data("cluetip")&&b.data("cluetip").selector,g=c(f||"div.cluetip"),n=g.find(v+"cluetip-inner"),Q=g.find(v+"cluetip-arrows");g.hide().removeClass();a.onHide.call(b[0],g,n);if(f){b.removeClass("cluetip-clicked");b.css("cursor","")}f&&z&&b.attrProp(a.titleAttribute,z);a.arrows&&Q.css({top:""})};c(document).unbind("hideCluetip.cluetip").bind("hideCluetip.cluetip",
function(b){X(c(b.target))});if(/click|toggle/.test(a.activation))d.bind("click.cluetip",function(b){if(e.is(":hidden")||!d.is(".cluetip-clicked")){ba(b);c(".cluetip-clicked").removeClass("cluetip-clicked");d.addClass("cluetip-clicked")}else ca(b);return false});else if(a.activation=="focus"){d.bind("focus.cluetip",function(b){d.attrProp("title","");ba(b)});d.bind("blur.cluetip",function(b){d.attrProp("title",d.data("cluetip").title);ca(b)})}else{d[a.clickThrough?"unbind":"bind"]("click.cluetip",
j);var na=function(b){if(a.tracking){var f=m-b.pageX,g=x?x-b.pageY:w-b.pageY;d.bind("mousemove.cluetip",function(n){e.css({left:n.pageX+f,top:n.pageY+g})})}};c.fn.hoverIntent&&a.hoverIntent?d.hoverIntent({sensitivity:a.hoverIntent.sensitivity,interval:a.hoverIntent.interval,over:function(b){ba(b);na(b)},timeout:a.hoverIntent.timeout,out:function(b){ca(b);d.unbind("mousemove.cluetip")}}):d.bind("mouseenter.cluetip",function(b){ba(b);na(b)}).bind("mouseleave.cluetip",function(b){ca(b);d.unbind("mousemove.cluetip")});
d.bind("mouseover.cluetip",function(){d.attrProp("title","")}).bind("mouseleave.cluetip",function(){d.attrProp("title",d.data("cluetip").title)})}});return this};(function(){c.support=c.support||{};for(var l=document.createElement("div").style,r=["boxShadow"],S=["moz","Moz","webkit","o"],T=0,e=r.length;T<e;T++){var h=r[T],F=h.charAt(0).toUpperCase()+h.slice(1);if(typeof l[h]!=="undefined")c.support[h]=h;else for(var s=0,G=S.length;s<G;s++)if(typeof l[S[s]+F]!=="undefined"){c.support[h]=S[s]+F;break}}})();
c.fn.cluetip.defaults=c.cluetip.defaults})(jQuery);(function(c){c.extend(true,c.fn.cluetip,{backCompat:true,template:'<div id="cluetip"><div id="cluetip-outer" class="cluetip-outer"><h3 id="cluetip-title" class="cluetip-title ui-widget-header ui-cluetip-header"></h3><div id="cluetip-inner" class="cluetip-inner ui-widget-content ui-cluetip-content"></div></div><div id="cluetip-extra"></div><div id="cluetip-arrows" class="cluetip-arrows"></div></div>'})})(jQuery);