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