MooTools.More={version:"1.4.0.1",build:"a4244edf2aa97ac8a196fc96082dd35af1abab87"};
(function(){this.Tips=new Class({Implements:[Events,Options],options:{onShow:function(){this.tip.setStyle("display","block")},onHide:function(){this.tip.setStyle("display","none")},title:"title",text:function(a){return a.get("rel")||a.get("href")},showDelay:100,hideDelay:100,className:"tip-wrap",offset:{x:16,y:16},windowPadding:{x:0,y:0},fixed:false,waiAria:true},initialize:function(){var a=Array.link(arguments,{options:Type.isObject,elements:function(b){return b!=null}});this.setOptions(a.options);
a.elements&&this.attach(a.elements);this.container=new Element("div",{"class":"tip"});this.options.id&&(this.container.set("id",this.options.id),this.options.waiAria&&this.attachWaiAria())},toElement:function(){return this.tip?this.tip:this.tip=(new Element("div",{"class":this.options.className,styles:{position:"absolute",top:0,left:0}})).adopt(new Element("div",{"class":"tip-top"}),this.container,new Element("div",{"class":"tip-bottom"}))},attachWaiAria:function(){var a=this.options.id;this.container.set("role",
"tooltip");if(!this.waiAria)this.waiAria={show:function(b){a&&b.set("aria-describedby",a);this.container.set("aria-hidden","false")},hide:function(b){a&&b.erase("aria-describedby");this.container.set("aria-hidden","true")}};this.addEvents(this.waiAria)},detachWaiAria:function(){this.waiAria&&(this.container.erase("role"),this.container.erase("aria-hidden"),this.removeEvents(this.waiAria))},attach:function(a){$$(a).each(function(b){var a=this.options.title?typeOf(this.options.title)=="function"?(0,this.options.title)(b):
b.get(this.options.title):"",c=this.options.text?typeOf(this.options.text)=="function"?(0,this.options.text)(b):b.get(this.options.text):"";b.set("title","").store("tip:native",a).retrieve("tip:title",a);b.retrieve("tip:text",c);this.fireEvent("attach",[b]);a=["enter","leave"];this.options.fixed||a.push("move");a.each(function(a){var c=b.retrieve("tip:"+a);c||(c=function(c){this["element"+a.capitalize()].apply(this,[c,b])}.bind(this));b.store("tip:"+a,c).addEvent("mouse"+a,c)},this)},this);return this},
detach:function(a){$$(a).each(function(a){["enter","leave","move"].each(function(c){a.removeEvent("mouse"+c,a.retrieve("tip:"+c)).eliminate("tip:"+c)});this.fireEvent("detach",[a]);if(this.options.title=="title"){var g=a.retrieve("tip:native");g&&a.set("title",g)}},this);return this},elementEnter:function(a,b){clearTimeout(this.timer);this.timer=function(){this.container.empty();["title","text"].each(function(a){var c=b.retrieve("tip:"+a),a=this["_"+a+"Element"]=(new Element("div",{"class":"tip-"+
a})).inject(this.container);c&&this.fill(a,c)},this);this.show(b);this.position(this.options.fixed?{page:b.getPosition()}:a)}.delay(this.options.showDelay,this)},elementLeave:function(a,b){clearTimeout(this.timer);this.timer=this.hide.delay(this.options.hideDelay,this,b);this.fireForParent(a,b)},setTitle:function(a){this._titleElement&&(this._titleElement.empty(),this.fill(this._titleElement,a));return this},setText:function(a){this._textElement&&(this._textElement.empty(),this.fill(this._textElement,
a));return this},fireForParent:function(a,b){(b=b.getParent())&&b!=document.body&&(b.retrieve("tip:enter")?b.fireEvent("mouseenter",a):this.fireForParent(a,b))},elementMove:function(a){this.position(a)},position:function(a){this.tip||document.id(this);var b=window.getSize(),g=window.getScroll(),c={x:this.tip.offsetWidth,y:this.tip.offsetHeight},e={x:"left",y:"top"},h={y:false,x2:false,y2:false,x:false},f={},d;for(d in e)f[e[d]]=a.page[d]+this.options.offset[d],f[e[d]]<0&&(h[d]=true),f[e[d]]+c[d]-
g[d]>b[d]-this.options.windowPadding[d]&&(f[e[d]]=a.page[d]-this.options.offset[d]-c[d],h[d+"2"]=true);this.fireEvent("bound",h);this.tip.setStyles(f)},fill:function(a,b){typeof b=="string"?a.set("html",b):a.adopt(b)},show:function(a){this.tip||document.id(this);this.tip.getParent()||this.tip.inject(document.body);this.fireEvent("show",[this.tip,a])},hide:function(a){this.tip||document.id(this);this.fireEvent("hide",[this.tip,a])}})})();

