Fx.Slide=new Class({Extends:Fx,options:{mode:"vertical"},initialize:function(A,C){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=$(A);this.parent(C);var B=this.element.retrieve("wrapper");this.wrapper=B||new Element("div",{styles:$extend(this.element.getStyles("margin","position"),{overflow:"hidden"})}).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(A){this.element.setStyle(this.margin,A[0]);this.wrapper.setStyle(this.layout,A[1]);return this},compute:function(D,C,B){var A=[];var E=2;E.times(function(F){A[F]=Fx.compute(D[F],C[F],B)});return A},start:function(F,B){if(!this.check(arguments.callee,F,B)){return this}this[B||this.options.mode]();var A=this.element.getStyle(this.margin).toInt();var G=this.wrapper.getStyle(this.layout).toInt();var E=[[A,G],[0,this.offset]];var D=[[A,G],[-this.offset,0]];var C;switch(F){case"in":C=E;break;case"out":C=D;break;case"toggle":C=(this.wrapper["offset"+this.layout.capitalize()]==0)?E:D}return this.parent(C[0],C[1])},slideIn:function(A){return this.start("in",A)},slideOut:function(A){return this.start("out",A)},hide:function(A){this[A||this.options.mode]();this.open=false;return this.set([-this.offset,0])},show:function(A){this[A||this.options.mode]();this.open=true;return this.set([0,this.offset])},toggle:function(A){return this.start("toggle",A)}});Element.Properties.slide={set:function(A){var B=this.retrieve("slide");if(B){B.cancel()}return this.eliminate("slide").store("slide:options",$extend({link:"cancel"},A))},get:function(A){if(A||!this.retrieve("slide")){if(A||!this.retrieve("slide:options")){this.set("slide",A)}this.store("slide",new Fx.Slide(this,this.retrieve("slide:options")))}return this.retrieve("slide")}};Element.implement({slide:function(C,D){C=C||"toggle";var A=this.get("slide"),E;switch(C){case"hide":A.hide(D);break;case"show":A.show(D);break;case"toggle":var B=this.retrieve("slide:flag",A.open);A[(B)?"slideOut":"slideIn"](D);this.store("slide:flag",!B);E=true;break;default:A.start(C,D)}if(!E){this.eliminate("slide:flag")}return this}});Fx.Scroll=new Class({Extends:Fx,options:{offset:{x:0,y:0},wheelStops:true},initialize:function(A,D){this.element=this.subject=$(A);this.parent(D);var C=this.cancel.bind(this,false);if($type(this.element)!="element"){this.element=$(this.element.getDocument().body)}var B=this.element;if(this.options.wheelStops){this.addEvent("start",function(){B.addEvent("mousewheel",C)},true);this.addEvent("complete",function(){B.removeEvent("mousewheel",C)},true)}},set:function(){var A=Array.flatten(arguments);this.element.scrollTo(A[0],A[1])},compute:function(D,C,B){var A=[];var E=2;E.times(function(F){A.push(Fx.compute(D[F],C[F],B))});return A},start:function(F,C){if(!this.check(arguments.callee,F,C)){return this}var H=this.element.getSize(),A=this.element.getScrollSize();var E=this.element.getScroll(),G={x:F,y:C};for(var B in G){var D=A[B]-H[B];if($chk(G[B])){G[B]=($type(G[B])=="number")?G[B].limit(0,D):D}else{G[B]=E[B]}G[B]+=this.options.offset[B]}return this.parent([E.x,E.y],[G.x,G.y])},toTop:function(){return this.start(false,0)},toLeft:function(){return this.start(0,false)},toRight:function(){return this.start("right",false)},toBottom:function(){return this.start(false,"bottom")},toElement:function(A){var B=$(A).getPosition(this.element);return this.start(B.x,B.y)}});Fx.Elements=new Class({Extends:Fx.CSS,initialize:function(A,B){this.elements=this.subject=$$(A);this.parent(B)},compute:function(C,D,E){var H={};for(var I in C){var F=C[I],A=D[I],B=H[I]={};for(var G in F){B[G]=this.parent(F[G],A[G],E)}}return H},set:function(A){for(var B in A){var D=A[B];for(var C in D){this.render(this.elements[B],C,D[C],this.options.unit)}}return this},start:function(H){if(!this.check(arguments.callee,H)){return this}var D={},E={};for(var I in H){var B=H[I],F=D[I]={},C=E[I]={};for(var G in B){var A=this.prepare(this.elements[I],G,B[G]);F[G]=A.from;C[G]=A.to}}return this.parent(D,E)}});var Tips=new Class({Implements:[Events,Options],options:{onShow:function(A){A.setStyle("visibility","visible")},onHide:function(A){A.setStyle("visibility","hidden")},showDelay:100,hideDelay:100,className:null,offsets:{x:16,y:16},fixed:false},initialize:function(){var B=Array.link(arguments,{options:Object.type,elements:$defined});this.setOptions(B.options||null);this.tip=new Element("div").inject(document.body);if(this.options.className){this.tip.addClass(this.options.className)}var A=new Element("div",{"class":"tip-top"}).inject(this.tip);this.container=new Element("div",{"class":"tip"}).inject(this.tip);var C=new Element("div",{"class":"tip-bottom"}).inject(this.tip);this.tip.setStyles({position:"absolute",top:0,left:0,visibility:"hidden"});if(B.elements){this.attach(B.elements)}},attach:function(A){$$(A).each(function(E){var C=E.retrieve("tip:title",E.get("title"));var G=E.retrieve("tip:text",E.get("rel")||E.get("href"));var F=E.retrieve("tip:enter",this.elementEnter.bindWithEvent(this,E));var D=E.retrieve("tip:leave",this.elementLeave.bindWithEvent(this,E));E.addEvents({mouseenter:F,mouseleave:D});if(!this.options.fixed){var B=E.retrieve("tip:move",this.elementMove.bindWithEvent(this,E));E.addEvent("mousemove",B)}E.store("tip:native",E.get("title"));E.erase("title")},this);return this},detach:function(A){$$(A).each(function(B){B.removeEvent("mouseenter",B.retrieve("tip:enter")||$empty);B.removeEvent("mouseleave",B.retrieve("tip:leave")||$empty);B.removeEvent("mousemove",B.retrieve("tip:move")||$empty);B.eliminate("tip:enter").eliminate("tip:leave").eliminate("tip:move");var C=B.retrieve("tip:native");if(C){B.set("title",C)}});return this},elementEnter:function(A,D){$A(this.container.childNodes).each(Element.dispose);var C=D.retrieve("tip:title");if(C){this.titleElement=new Element("div",{"class":"tip-title"}).inject(this.container);this.fill(this.titleElement,C)}var B=D.retrieve("tip:text");if(B){this.textElement=new Element("div",{"class":"tip-text"}).inject(this.container);this.fill(this.textElement,B)}this.timer=$clear(this.timer);this.timer=this.show.delay(this.options.showDelay,this);this.position((!this.options.fixed)?A:{page:D.getPosition()})},elementLeave:function(A){$clear(this.timer);this.timer=this.hide.delay(this.options.hideDelay,this)},elementMove:function(A){this.position(A)},position:function(A){var F=window.getSize(),E=window.getScroll();var B={x:this.tip.offsetWidth,y:this.tip.offsetHeight};var G={x:"left",y:"top"};for(var C in G){var D=A.page[C]+this.options.offsets[C];if((D+B[C]-E[C])>F[C]){D=A.page[C]-this.options.offsets[C]-B[C]}this.tip.setStyle(G[C],D)}},fill:function(B,A){(typeof A=="string")?B.set("html",A):B.adopt(A)},show:function(){this.fireEvent("show",this.tip)},hide:function(){this.fireEvent("hide",this.tip)}});