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