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