MooTools.More={version:"1.2.4.2",build:"bd5a93c0913cce25917c48cbdacde568e15e02ef"};Element.implement({measure:function(l){var n=function(a){return !!(!a||a.offsetHeight||a.offsetWidth);};if(n(this)){return l.apply(this);}var k=this.getParent(),m=[],i=[];while(!n(k)&&k!=document.body){i.push(k.expose());k=k.getParent();}var j=this.expose();var h=l.apply(this);j();i.each(function(a){a();});return h;},expose:function(){if(this.getStyle("display")!="none"){return $empty;}var b=this.style.cssText;this.setStyles({display:"block",position:"absolute",visibility:"hidden"});return function(){this.style.cssText=b;}.bind(this);},getDimensions:function(g){g=$merge({computeSize:false},g);var e={};var j=function(a,b){return(b.computeSize)?a.getComputedSize(b):a.getSize();};var h=this.getParent("body");if(h&&this.getStyle("display")=="none"){e=this.measure(function(){return j(this,g);});}else{if(h){try{e=j(this,g);}catch(i){}}else{e={x:0,y:0};}}return $chk(e.x)?$extend(e,{width:e.x,height:e.y}):$extend(e,{x:e.width,y:e.height});},getComputedSize:function(f){f=$merge({styles:["padding","border"],plains:{height:["top","bottom"],width:["left","right"]},mode:"both"},f);var h={width:0,height:0};switch(f.mode){case"vertical":delete h.width;delete f.plains.width;break;case"horizontal":delete h.height;delete f.plains.height;break;}var g=[];$each(f.plains,function(a,b){a.each(function(c){f.styles.each(function(d){g.push((d=="border")?d+"-"+c+"-width":d+"-"+c);});});});var j={};g.each(function(a){j[a]=this.getComputedStyle(a);},this);var i=[];$each(f.plains,function(b,a){var c=a.capitalize();h["total"+c]=h["computed"+c]=0;b.each(function(d){h["computed"+d.capitalize()]=0;g.each(function(e,l){if(e.test(d)){j[e]=j[e].toInt()||0;h["total"+c]=h["total"+c]+j[e];h["computed"+d.capitalize()]=h["computed"+d.capitalize()]+j[e];}if(e.test(d)&&a!=e&&(e.test("border")||e.test("padding"))&&!i.contains(e)){i.push(e);h["computed"+c]=h["computed"+c]-j[e];}});});});["Width","Height"].each(function(a){var b=a.toLowerCase();if(!$chk(h[b])){return;}h[b]=h[b]+this["offset"+a]+h["computed"+a];h["total"+a]=h[b]+h["total"+a];delete h["computed"+a];},this);return $extend(j,h);}});Element.implement({isDisplayed:function(){return this.getStyle("display")!="none";},isVisible:function(){var c=this.offsetWidth,d=this.offsetHeight;return(c==0&&d==0)?false:(c>0&&d>0)?true:this.isDisplayed();},toggle:function(){return this[this.isDisplayed()?"hide":"show"]();},hide:function(){var d;try{if((d=this.getStyle("display"))=="none"){d=null;}}catch(c){}return this.store("originalDisplay",d||"block").setStyle("display","none");},show:function(b){return this.setStyle("display",b||this.retrieve("originalDisplay")||"block");},swapClass:function(c,d){return this.removeClass(c).addClass(d);}});Fx.Reveal=new Class({Extends:Fx.Morph,options:{link:"cancel",styles:["padding","border","margin"],transitionOpacity:!Browser.Engine.trident4,mode:"vertical",display:"block",hideInputs:Browser.Engine.trident?"select, input, textarea, object, embed":false},dissolve:function(){try{if(!this.hiding&&!this.showing){if(this.element.getStyle("display")!="none"){this.hiding=true;this.showing=false;this.hidden=true;this.cssText=this.element.style.cssText;var h=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode});this.element.setStyle("display","block");if(this.options.transitionOpacity){h.opacity=1;}var f={};$each(h,function(b,a){f[a]=[b,0];},this);this.element.setStyle("overflow","hidden");var e=this.options.hideInputs?this.element.getElements(this.options.hideInputs):null;this.$chain.unshift(function(){if(this.hidden){this.hiding=false;$each(h,function(b,a){h[a]=b;},this);this.element.style.cssText=this.cssText;this.element.setStyle("display","none");if(e){e.setStyle("visibility","visible");}}this.fireEvent("hide",this.element);this.callChain();}.bind(this));if(e){e.setStyle("visibility","hidden");}this.start(f);}else{this.callChain.delay(10,this);this.fireEvent("complete",this.element);this.fireEvent("hide",this.element);}}else{if(this.options.link=="chain"){this.chain(this.dissolve.bind(this));}else{if(this.options.link=="cancel"&&!this.hiding){this.cancel();this.dissolve();}}}}catch(g){this.hiding=false;this.element.setStyle("display","none");this.callChain.delay(10,this);this.fireEvent("complete",this.element);this.fireEvent("hide",this.element);}return this;},reveal:function(){try{if(!this.showing&&!this.hiding){if(this.element.getStyle("display")=="none"||this.element.getStyle("visiblity")=="hidden"||this.element.getStyle("opacity")==0){this.showing=true;this.hiding=this.hidden=false;var h;this.cssText=this.element.style.cssText;this.element.measure(function(){h=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode});}.bind(this));$each(h,function(b,a){h[a]=b;});if($chk(this.options.heightOverride)){h.height=this.options.heightOverride.toInt();}if($chk(this.options.widthOverride)){h.width=this.options.widthOverride.toInt();}if(this.options.transitionOpacity){this.element.setStyle("opacity",0);h.opacity=1;}var f={height:0,display:this.options.display};$each(h,function(b,a){f[a]=0;});this.element.setStyles($merge(f,{overflow:"hidden"}));var e=this.options.hideInputs?this.element.getElements(this.options.hideInputs):null;if(e){e.setStyle("visibility","hidden");}this.start(h);this.$chain.unshift(function(){this.element.style.cssText=this.cssText;this.element.setStyle("display",this.options.display);if(!this.hidden){this.showing=false;}if(e){e.setStyle("visibility","visible");}this.callChain();this.fireEvent("show",this.element);}.bind(this));}else{this.callChain();this.fireEvent("complete",this.element);this.fireEvent("show",this.element);}}else{if(this.options.link=="chain"){this.chain(this.reveal.bind(this));}else{if(this.options.link=="cancel"&&!this.showing){this.cancel();this.reveal();}}}}catch(g){this.element.setStyles({display:this.options.display,visiblity:"visible",opacity:1});this.showing=false;this.callChain.delay(10,this);this.fireEvent("complete",this.element);this.fireEvent("show",this.element);}return this;},toggle:function(){if(this.element.getStyle("display")=="none"||this.element.getStyle("visiblity")=="hidden"||this.element.getStyle("opacity")==0){this.reveal();}else{this.dissolve();}return this;},cancel:function(){this.parent.apply(this,arguments);this.element.style.cssText=this.cssText;this.hidding=false;this.showing=false;}});Element.Properties.reveal={set:function(c){var d=this.retrieve("reveal");if(d){d.cancel();}return this.eliminate("reveal").store("reveal:options",c);},get:function(b){if(b||!this.retrieve("reveal")){if(b||!this.retrieve("reveal:options")){this.set("reveal",b);}this.store("reveal",new Fx.Reveal(this,this.retrieve("reveal:options")));}return this.retrieve("reveal");}};Element.Properties.dissolve=Element.Properties.reveal;Element.implement({reveal:function(b){this.get("reveal",b).reveal();return this;},dissolve:function(b){this.get("reveal",b).dissolve();return this;},nix:function(){var b=Array.link(arguments,{destroy:Boolean.type,options:Object.type});this.get("reveal",b.options).dissolve().chain(function(){this[b.destroy?"destroy":"dispose"]();}.bind(this));return this;},wink:function(){var d=Array.link(arguments,{duration:Number.type,options:Object.type});var c=this.get("reveal",d.options);c.reveal().chain(function(){(function(){c.dissolve();}).delay(d.duration||2000);});}});Fx.Slide=new Class({Extends:Fx,options:{mode:"vertical",hideOverflow:true},initialize:function(f,e){this.addEvent("complete",function(){this.open=(this.wrapper["offset"+this.layout.capitalize()]!=0);if(this.open&&Browser.Engine.webkit419){this.element.dispose().inject(this.wrapper);}},true);this.element=this.subject=document.id(f);this.parent(e);var h=this.element.retrieve("wrapper");var g=this.element.getStyles("margin","position","overflow");if(this.options.hideOverflow){g=$extend(g,{overflow:"hidden"});}this.wrapper=h||new Element("div",{styles:g}).wraps(this.element);this.element.store("wrapper",this.wrapper).setStyle("margin",0);this.now=[];this.open=true;},vertical:function(){this.margin="margin-top";this.layout="height";this.offset=this.element.offsetHeight;},horizontal:function(){this.margin="margin-left";this.layout="width";this.offset=this.element.offsetWidth;},set:function(b){this.element.setStyle(this.margin,b[0]);this.wrapper.setStyle(this.layout,b[1]);return this;},compute:function(f,e,d){return[0,1].map(function(a){return Fx.compute(f[a],e[a],d);});},start:function(i,l){if(!this.check(i,l)){return this;}this[l||this.options.mode]();var k=this.element.getStyle(this.margin).toInt();var j=this.wrapper.getStyle(this.layout).toInt();var h=[[k,j],[0,this.offset]];var n=[[k,j],[-this.offset,0]];var m;switch(i){case"in":m=h;break;case"out":m=n;break;case"toggle":m=(j==0)?h:n;}return this.parent(m[0],m[1]);},slideIn:function(b){return this.start("in",b);},slideOut:function(b){return this.start("out",b);},hide:function(b){this[b||this.options.mode]();this.open=false;return this.set([-this.offset,0]);},show:function(b){this[b||this.options.mode]();this.open=true;return this.set([0,this.offset]);},toggle:function(b){return this.start("toggle",b);}});Element.Properties.slide={set:function(d){var c=this.retrieve("slide");if(c){c.cancel();}return this.eliminate("slide").store("slide:options",$extend({link:"cancel"},d));},get:function(b){if(b||!this.retrieve("slide")){if(b||!this.retrieve("slide:options")){this.set("slide",b);}this.store("slide",new Fx.Slide(this,this.retrieve("slide:options")));}return this.retrieve("slide");}};Element.implement({slide:function(i,j){i=i||"toggle";var g=this.get("slide"),f;switch(i){case"hide":g.hide(j);break;case"show":g.show(j);break;case"toggle":var h=this.retrieve("slide:flag",g.open);g[h?"slideOut":"slideIn"](j);this.store("slide:flag",!h);f=true;break;default:g.start(i,j);}if(!f){this.eliminate("slide:flag");}return this;}});var Asset={javascript:function(m,k){k=$extend({onload:$empty,document:document,check:$lambda(true)},k);var i=new Element("script",{src:m,type:"text/javascript"});var l=k.onload.bind(i),h=k.check,n=k.document;delete k.onload;delete k.check;delete k.document;i.addEvents({load:l,readystatechange:function(){if(["loaded","complete"].contains(this.readyState)){l();}}}).set(k);if(Browser.Engine.webkit419){var j=(function(){if(!$try(h)){return;}$clear(j);l();}).periodical(50);}return i.inject(n.head);},css:function(d,c){return new Element("link",$merge({rel:"stylesheet",media:"screen",type:"text/css",href:d},c)).inject(document.head);},image:function(g,f){f=$merge({onload:$empty,onabort:$empty,onerror:$empty},f);var h=new Image();var e=document.id(h)||new Element("img");["load","abort","error"].each(function(c){var a="on"+c;var b=f[a];delete f[a];h[a]=function(){if(!h){return;}if(!e.parentNode){e.width=h.width;e.height=h.height;}h=h.onload=h.onabort=h.onerror=null;b.delay(1,e,e);e.fireEvent(c,e,1);};});h.src=e.src=g;if(h&&h.complete){h.onload.delay(1);}return e.set(f);},images:function(h,g){g=$merge({onComplete:$empty,onProgress:$empty,onError:$empty,properties:{}},g);h=$splat(h);var e=[];var f=0;return new Elements(h.map(function(a){return Asset.image(a,$extend(g.properties,{onload:function(){g.onProgress.call(this,f,h.indexOf(a));f++;if(f==h.length){g.onComplete();}},onerror:function(){g.onError.call(this,f,h.indexOf(a));f++;if(f==h.length){g.onComplete();}}}));}));}};(function(){var b=function(d,a){return(d)?($type(d)=="function"?d(a):a.get(d)):"";};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},fixed:false},initialize:function(){var a=Array.link(arguments,{options:Object.type,elements:$defined});this.setOptions(a.options);document.id(this);if(a.elements){this.attach(a.elements);}},toElement:function(){if(this.tip){return this.tip;}this.container=new Element("div",{"class":"tip"});return 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"})).inject(document.body);},attach:function(a){$$(a).each(function(i){var g=b(this.options.title,i),j=b(this.options.text,i);i.erase("title").store("tip:native",g).retrieve("tip:title",g);i.retrieve("tip:text",j);this.fireEvent("attach",[i]);var h=["enter","leave"];if(!this.options.fixed){h.push("move");}h.each(function(c){var d=i.retrieve("tip:"+c);if(!d){d=this["element"+c.capitalize()].bindWithEvent(this,i);}i.store("tip:"+c,d).addEvent("mouse"+c,d);},this);},this);return this;},detach:function(a){$$(a).each(function(e){["enter","leave","move"].each(function(c){e.removeEvent("mouse"+c,e.retrieve("tip:"+c)).eliminate("tip:"+c);});this.fireEvent("detach",[e]);if(this.options.title=="title"){var f=e.retrieve("tip:native");if(f){e.set("title",f);}}},this);return this;},elementEnter:function(d,a){this.container.empty();["title","text"].each(function(f){var c=a.retrieve("tip:"+f);if(c){this.fill(new Element("div",{"class":"tip-"+f}).inject(this.container),c);}},this);$clear(this.timer);this.timer=this.show.delay(this.options.showDelay,this,a);this.position((this.options.fixed)?{page:a.getPosition()}:d);},elementLeave:function(d,a){$clear(this.timer);this.timer=this.hide.delay(this.options.hideDelay,this,a);this.fireForParent(d,a);},fireForParent:function(d,a){if(!a){return;}parentNode=a.getParent();if(parentNode==document.body){return;}if(parentNode.retrieve("tip:enter")){parentNode.fireEvent("mouseenter",d);}else{this.fireForParent(d,parentNode);}},elementMove:function(d,a){this.position(d);},position:function(l){var j=window.getSize(),i=window.getScroll(),m={x:this.tip.offsetWidth,y:this.tip.offsetHeight},k={x:"left",y:"top"},n={};for(var a in k){n[k[a]]=l.page[a]+this.options.offset[a];if((n[k[a]]+m[a]-i[a])>j[a]){n[k[a]]=l.page[a]-this.options.offset[a]-m[a];}}this.tip.setStyles(n);},fill:function(a,d){if(typeof d=="string"){a.set("html",d);}else{a.adopt(d);}},show:function(a){this.fireEvent("show",[this.tip,a]);},hide:function(a){this.fireEvent("hide",[this.tip,a]);}});})();
