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

