Fx.Slide=new Class({Extends:Fx,options:{mode:"vertical"},initialize:function(F,D){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=$(F);this.parent(D);var E=this.element.retrieve("wrapper");this.wrapper=E||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(B){this.element.setStyle(this.margin,B[0]);this.wrapper.setStyle(this.layout,B[1]);return this},compute:function(G,H,I){var J=[];var F=2;F.times(function(A){J[A]=Fx.compute(G[A],H[A],I)});return J},start:function(N,K){if(!this.check(arguments.callee,N,K)){return this}this[K||this.options.mode]();var L=this.element.getStyle(this.margin).toInt();var M=this.wrapper.getStyle(this.layout).toInt();var H=[[L,M],[0,this.offset]];var I=[[L,M],[-this.offset,0]];var J;switch(N){case"in":J=H;break;case"out":J=I;break;case"toggle":J=(this.wrapper["offset"+this.layout.capitalize()]==0)?H:I}return this.parent(J[0],J[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(H,G){H=H||"toggle";var J=this.get("slide"),F;switch(H){case"hide":J.hide(G);break;case"show":J.show(G);break;case"toggle":var I=this.retrieve("slide:flag",J.open);J[(I)?"slideOut":"slideIn"](G);this.store("slide:flag",!I);F=true;break;default:J.start(H,G)}if(!F){this.eliminate("slide:flag")}return this}});Fx.Scroll=new Class({Extends:Fx,options:{offset:{x:0,y:0},wheelStops:true},initialize:function(H,E){this.element=this.subject=$(H);this.parent(E);var F=this.cancel.bind(this,false);if($type(this.element)!="element"){this.element=$(this.element.getDocument().body)}var G=this.element;if(this.options.wheelStops){this.addEvent("start",function(){G.addEvent("mousewheel",F)},true);this.addEvent("complete",function(){G.removeEvent("mousewheel",F)},true)}},set:function(){var B=Array.flatten(arguments);this.element.scrollTo(B[0],B[1])},compute:function(G,H,I){var J=[];var F=2;F.times(function(A){J.push(Fx.compute(G[A],H[A],I))});return J},start:function(O,J){if(!this.check(arguments.callee,O,J)){return this}var M=this.element.getSize(),L=this.element.getScrollSize();var P=this.element.getScroll(),N={x:O,y:J};for(var K in N){var I=L[K]-M[K];if($chk(N[K])){N[K]=($type(N[K])=="number")?N[K].limit(0,I):I}else{N[K]=P[K]}N[K]+=this.options.offset[K]}return this.parent([P.x,P.y],[N.x,N.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(D){var C=$(D).getPosition(this.element);return this.start(C.x,C.y)}});Fx.Elements=new Class({Extends:Fx.CSS,initialize:function(D,C){this.elements=this.subject=$$(D);this.parent(C)},compute:function(P,O,N){var K={};for(var J in P){var M=P[J],R=O[J],Q=K[J]={};for(var L in M){Q[L]=this.parent(M[L],R[L],N)}}return K},set:function(H){for(var G in H){var E=H[G];for(var F in E){this.render(this.elements[G],F,E[F],this.options.unit)}}return this},start:function(K){if(!this.check(arguments.callee,K)){return this}var O={},N={};for(var J in K){var Q=K[J],M=O[J]={},P=N[J]={};for(var L in Q){var R=this.prepare(this.elements[J],L,Q[L]);M[L]=R.from;P[L]=R.to}}return this.parent(O,N)}});var Drag=new Class({Implements:[Events,Options],options:{snap:6,unit:"px",grid:false,style:true,limit:false,handle:false,invert:false,preventDefault:false,modifiers:{x:"left",y:"top"}},initialize:function(){var D=Array.link(arguments,{options:Object.type,element:$defined});this.element=$(D.element);this.document=this.element.getDocument();this.setOptions(D.options||{});var C=$type(this.options.handle);this.handles=(C=="array"||C=="collection")?$$(this.options.handle):$(this.options.handle)||this.element;this.mouse={now:{},pos:{}};this.value={start:{},now:{}};this.selection=(Browser.Engine.trident)?"selectstart":"mousedown";this.bound={start:this.start.bind(this),check:this.check.bind(this),drag:this.drag.bind(this),stop:this.stop.bind(this),cancel:this.cancel.bind(this),eventStop:$lambda(false)};this.attach()},attach:function(){this.handles.addEvent("mousedown",this.bound.start);return this},detach:function(){this.handles.removeEvent("mousedown",this.bound.start);return this},start:function(G){if(this.options.preventDefault){G.preventDefault()}this.fireEvent("beforeStart",this.element);this.mouse.start=G.page;var E=this.options.limit;this.limit={x:[],y:[]};for(var F in this.options.modifiers){if(!this.options.modifiers[F]){continue}if(this.options.style){this.value.now[F]=this.element.getStyle(this.options.modifiers[F]).toInt()}else{this.value.now[F]=this.element[this.options.modifiers[F]]}if(this.options.invert){this.value.now[F]*=-1}this.mouse.pos[F]=G.page[F]-this.value.now[F];if(E&&E[F]){for(var H=2;H--;H){if($chk(E[F][H])){this.limit[F][H]=$lambda(E[F][H])()}}}}if($type(this.options.grid)=="number"){this.options.grid={x:this.options.grid,y:this.options.grid}}this.document.addEvents({mousemove:this.bound.check,mouseup:this.bound.cancel});this.document.addEvent(this.selection,this.bound.eventStop)},check:function(C){if(this.options.preventDefault){C.preventDefault()}var D=Math.round(Math.sqrt(Math.pow(C.page.x-this.mouse.start.x,2)+Math.pow(C.page.y-this.mouse.start.y,2)));if(D>this.options.snap){this.cancel();this.document.addEvents({mousemove:this.bound.drag,mouseup:this.bound.stop});this.fireEvent("start",this.element).fireEvent("snap",this.element)}},drag:function(C){if(this.options.preventDefault){C.preventDefault()}this.mouse.now=C.page;for(var D in this.options.modifiers){if(!this.options.modifiers[D]){continue}this.value.now[D]=this.mouse.now[D]-this.mouse.pos[D];if(this.options.invert){this.value.now[D]*=-1}if(this.options.limit&&this.limit[D]){if($chk(this.limit[D][1])&&(this.value.now[D]>this.limit[D][1])){this.value.now[D]=this.limit[D][1]}else{if($chk(this.limit[D][0])&&(this.value.now[D]<this.limit[D][0])){this.value.now[D]=this.limit[D][0]}}}if(this.options.grid[D]){this.value.now[D]-=(this.value.now[D]%this.options.grid[D])}if(this.options.style){this.element.setStyle(this.options.modifiers[D],this.value.now[D]+this.options.unit)}else{this.element[this.options.modifiers[D]]=this.value.now[D]}}this.fireEvent("drag",this.element)},cancel:function(B){this.document.removeEvent("mousemove",this.bound.check);this.document.removeEvent("mouseup",this.bound.cancel);if(B){this.document.removeEvent(this.selection,this.bound.eventStop);this.fireEvent("cancel",this.element)}},stop:function(B){this.document.removeEvent(this.selection,this.bound.eventStop);this.document.removeEvent("mousemove",this.bound.drag);this.document.removeEvent("mouseup",this.bound.stop);if(B){this.fireEvent("complete",this.element)}}});Element.implement({makeResizable:function(B){return new Drag(this,$merge({modifiers:{x:"width",y:"height"}},B))}});Drag.Move=new Class({Extends:Drag,options:{droppables:[],container:false},initialize:function(G,H){this.parent(G,H);this.droppables=$$(this.options.droppables);this.container=$(this.options.container);if(this.container&&$type(this.container)!="element"){this.container=$(this.container.getDocument().body)}G=this.element;var F=G.getStyle("position");var E=(F!="static")?F:"absolute";if(G.getStyle("left")=="auto"||G.getStyle("top")=="auto"){G.position(G.getPosition(G.offsetParent))}G.setStyle("position",E);this.addEvent("start",function(){this.checkDroppables()},true)},start:function(M){if(this.container){var K=this.element,O=this.container,T=O.getCoordinates(K.offsetParent),S={},N={};["top","right","bottom","left"].each(function(A){S[A]=O.getStyle("padding-"+A).toInt();N[A]=K.getStyle("margin-"+A).toInt()},this);var L=K.offsetWidth+N.left+N.right,P=K.offsetHeight+N.top+N.bottom;var Q=[T.left+S.left,T.right-S.right-L];var R=[T.top+S.top,T.bottom-S.bottom-P];this.options.limit={x:Q,y:R}}this.parent(M)},checkAgainst:function(D){D=D.getCoordinates();var C=this.mouse.now;return(C.x>D.left&&C.x<D.right&&C.y<D.bottom&&C.y>D.top)},checkDroppables:function(){var B=this.droppables.filter(this.checkAgainst,this).getLast();if(this.overed!=B){if(this.overed){this.fireEvent("leave",[this.element,this.overed])}if(B){this.overed=B;this.fireEvent("enter",[this.element,B])}else{this.overed=null}}},drag:function(B){this.parent(B);if(this.droppables.length){this.checkDroppables()}},stop:function(B){this.checkDroppables();this.fireEvent("drop",[this.element,this.overed]);this.overed=null;return this.parent(B)}});Element.implement({makeDraggable:function(B){return new Drag.Move(this,B)}});Hash.Cookie=new Class({Extends:Cookie,options:{autoSave:true},initialize:function(D,C){this.parent(D,C);this.load()},save:function(){var B=JSON.encode(this.hash);if(!B||B.length>4096){return false}if(B=="{}"){this.dispose()}else{this.write(B)}return true},load:function(){this.hash=new Hash(JSON.decode(this.read(),true));return this}});Hash.Cookie.implement((function(){var B={};Hash.each(Hash.prototype,function(A,D){B[D]=function(){var C=A.apply(this.hash,arguments);if(this.options.autoSave){this.save()}return C}});return B})());var Color=new Native({initialize:function(F,E){if(arguments.length>=3){E="rgb";F=Array.slice(arguments,0,3)}else{if(typeof F=="string"){if(F.match(/rgb/)){F=F.rgbToHex().hexToRgb(true)}else{if(F.match(/hsb/)){F=F.hsbToRgb()}else{F=F.hexToRgb(true)}}}}E=E||"rgb";switch(E){case"hsb":var D=F;F=F.hsbToRgb();F.hsb=D;break;case"hex":F=F.hexToRgb(true);break}F.rgb=F.slice(0,3);F.hsb=F.hsb||F.rgbToHsb();F.hex=F.rgbToHex();return $extend(F,this)}});Color.implement({mix:function(){var D=Array.slice(arguments);var E=($type(D.getLast())=="number")?D.pop():50;var F=this.slice();D.each(function(B){B=new Color(B);for(var A=0;A<3;A++){F[A]=Math.round((F[A]/100*(100-E))+(B[A]/100*E))}});return new Color(F,"rgb")},invert:function(){return new Color(this.map(function(B){return 255-B}))},setHue:function(B){return new Color([B,this.hsb[1],this.hsb[2]],"hsb")},setSaturation:function(B){return new Color([this.hsb[0],B,this.hsb[2]],"hsb")},setBrightness:function(B){return new Color([this.hsb[0],this.hsb[1],B],"hsb")}});function $RGB(E,F,D){return new Color([E,F,D],"rgb")}function $HSB(E,F,D){return new Color([E,F,D],"hsb")}function $HEX(B){return new Color(B,"hex")}Array.implement({rgbToHsb:function(){var O=this[0],N=this[1],S=this[2];var V,W,U;var T=Math.max(O,N,S),X=Math.min(O,N,S);var R=T-X;U=T/255;W=(T!=0)?R/T:0;if(W==0){V=0}else{var M=(T-O)/R;var P=(T-N)/R;var Q=(T-S)/R;if(O==T){V=Q-P}else{if(N==T){V=2+M-Q}else{V=4+P-M}}V/=6;if(V<0){V++}}return[Math.round(V*360),Math.round(W*100),Math.round(U*100)]},hsbToRgb:function(){var K=Math.round(this[2]/100*255);if(this[1]==0){return[K,K,K]}else{var G=this[0]%360;var I=G%60;var H=Math.round((this[2]*(100-this[1]))/10000*255);var J=Math.round((this[2]*(6000-this[1]*I))/600000*255);var L=Math.round((this[2]*(6000-this[1]*(60-I)))/600000*255);switch(Math.floor(G/60)){case 0:return[K,L,H];case 1:return[J,K,H];case 2:return[H,K,L];case 3:return[H,J,K];case 4:return[L,H,K];case 5:return[K,H,J]}}return false}});String.implement({rgbToHsb:function(){var B=this.match(/\d{1,3}/g);return(B)?hsb.rgbToHsb():null},hsbToRgb:function(){var B=this.match(/\d{1,3}/g);return(B)?B.hsbToRgb():null}});var Group=new Class({initialize:function(){this.instances=Array.flatten(arguments);this.events={};this.checker={}},addEvent:function(D,C){this.checker[D]=this.checker[D]||{};this.events[D]=this.events[D]||[];if(this.events[D].contains(C)){return false}else{this.events[D].push(C)}this.instances.each(function(B,A){B.addEvent(D,this.check.bind(this,[D,B,A]))},this);return this},check:function(G,E,H){this.checker[G][H]=true;var F=this.instances.every(function(A,B){return this.checker[G][B]||false},this);if(!F){return }this.checker[G]={};this.events[G].each(function(A){A.call(this,this.instances,E)},this)}});var Asset=new Hash({javascript:function(J,L){L=$extend({onload:$empty,document:document,check:$lambda(true)},L);var N=new Element("script",{src:J,type:"text/javascript"});var K=L.onload.bind(N),H=L.check,I=L.document;delete L.onload;delete L.check;delete L.document;N.addEvents({load:K,readystatechange:function(){if(["loaded","complete"].contains(this.readyState)){K()}}}).setProperties(L);if(Browser.Engine.webkit419){var M=(function(){if(!$try(H)){return }$clear(M);K()}).periodical(50)}return N.inject(I.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,H){H=$merge({onload:$empty,onabort:$empty,onerror:$empty},H);var F=new Image();var E=$(F)||new Element("img");["load","abort","error"].each(function(C){var B="on"+C;var A=H[B];delete H[B];F[B]=function(){if(!F){return }if(!E.parentNode){E.width=F.width;E.height=F.height}F=F.onload=F.onabort=F.onerror=null;A.delay(1,E,E);E.fireEvent(C,E,1)}});F.src=E.src=G;if(F&&F.complete){F.onload.delay(1)}return E.setProperties(H)},images:function(F,G){G=$merge({onComplete:$empty,onProgress:$empty},G);if(!F.push){F=[F]}var E=[];var H=0;F.each(function(A){var B=new Asset.image(A,{onload:function(){G.onProgress.call(this,H,F.indexOf(A));H++;if(H==F.length){G.onComplete()}}});E.push(B)});return new Elements(E)}});var Sortables=new Class({Implements:[Events,Options],options:{snap:4,opacity:1,clone:false,revert:false,handle:false,constrain:false},initialize:function(C,D){this.setOptions(D);this.elements=[];this.lists=[];this.idle=true;this.addLists($$($(C)||C));if(!this.options.clone){this.options.revert=false}if(this.options.revert){this.effect=new Fx.Morph(null,$merge({duration:250,link:"cancel"},this.options.revert))}},attach:function(){this.addLists(this.lists);return this},detach:function(){this.lists=this.removeLists(this.lists);return this},addItems:function(){Array.flatten(arguments).each(function(C){this.elements.push(C);var D=C.retrieve("sortables:start",this.start.bindWithEvent(this,C));(this.options.handle?C.getElement(this.options.handle)||C:C).addEvent("mousedown",D)},this);return this},addLists:function(){Array.flatten(arguments).each(function(B){this.lists.push(B);this.addItems(B.getChildren())},this);return this},removeItems:function(){var B=[];Array.flatten(arguments).each(function(D){B.push(D);this.elements.erase(D);var A=D.retrieve("sortables:start");(this.options.handle?D.getElement(this.options.handle)||D:D).removeEvent("mousedown",A)},this);return $$(B)},removeLists:function(){var B=[];Array.flatten(arguments).each(function(A){B.push(A);this.lists.erase(A);this.removeItems(A.getChildren())},this);return $$(B)},getClone:function(D,C){if(!this.options.clone){return new Element("div").inject(document.body)}if($type(this.options.clone)=="function"){return this.options.clone.call(this,D,C,this.list)}return C.clone(true).setStyles({margin:"0px",position:"absolute",visibility:"hidden",width:C.getStyle("width")}).inject(this.list).position(C.getPosition(C.getOffsetParent()))},getDroppables:function(){var B=this.list.getChildren();if(!this.options.constrain){B=this.lists.concat(B).erase(this.list)}return B.erase(this.clone).erase(this.element)},insert:function(E,F){var D="inside";if(this.lists.contains(F)){this.list=F;this.drag.droppables=this.getDroppables()}else{D=this.element.getAllPrevious().contains(F)?"before":"after"}this.element.inject(F,D);this.fireEvent("sort",[this.element,this.clone])},start:function(D,C){if(!this.idle){return }this.idle=false;this.element=C;this.opacity=C.get("opacity");this.list=C.getParent();this.clone=this.getClone(D,C);this.drag=new Drag.Move(this.clone,{snap:this.options.snap,container:this.options.constrain&&this.element.getParent(),droppables:this.getDroppables(),onSnap:function(){D.stop();this.clone.setStyle("visibility","visible");this.element.set("opacity",this.options.opacity||0);this.fireEvent("start",[this.element,this.clone])}.bind(this),onEnter:this.insert.bind(this),onCancel:this.reset.bind(this),onComplete:this.end.bind(this)});this.clone.inject(this.element,"before");this.drag.start(D)},end:function(){this.drag.detach();this.element.set("opacity",this.opacity);if(this.effect){var C=this.element.getStyles("width","height");var D=this.clone.computePosition(this.element.getPosition(this.clone.offsetParent));this.effect.element=this.clone;this.effect.start({top:D.top,left:D.left,width:C.width,height:C.height,opacity:0.25}).chain(this.reset.bind(this))}else{this.reset()}},reset:function(){this.idle=true;this.clone.destroy();this.fireEvent("complete",this.element)},serialize:function(){var E=Array.link(arguments,{modifier:Function.type,index:$defined});var F=this.lists.map(function(A){return A.getChildren().map(E.modifier||function(B){return B.get("id")},this)},this);var D=E.index;if(this.lists.length==1){D=0}return $chk(D)&&D>=0&&D<this.lists.length?F[D]:F}});var Tips=new Class({Implements:[Events,Options],options:{onShow:function(B){B.setStyle("visibility","visible")},onHide:function(B){B.setStyle("visibility","hidden")},showDelay:100,hideDelay:100,className:null,offsets:{x:16,y:16},fixed:false},initialize:function(){var E=Array.link(arguments,{options:Object.type,elements:$defined});this.setOptions(E.options||null);this.tip=new Element("div").inject(document.body);if(this.options.className){this.tip.addClass(this.options.className)}var F=new Element("div",{"class":"tip-top"}).inject(this.tip);this.container=new Element("div",{"class":"tip"}).inject(this.tip);var D=new Element("div",{"class":"tip-bottom"}).inject(this.tip);this.tip.setStyles({position:"absolute",top:0,left:0,visibility:"hidden"});if(E.elements){this.attach(E.elements)}},attach:function(B){$$(B).each(function(J){var A=J.retrieve("tip:title",J.get("title"));var H=J.retrieve("tip:text",J.get("rel")||J.get("href"));var I=J.retrieve("tip:enter",this.elementEnter.bindWithEvent(this,J));var K=J.retrieve("tip:leave",this.elementLeave.bindWithEvent(this,J));J.addEvents({mouseenter:I,mouseleave:K});if(!this.options.fixed){var L=J.retrieve("tip:move",this.elementMove.bindWithEvent(this,J));J.addEvent("mousemove",L)}J.store("tip:native",J.get("title"));J.erase("title")},this);return this},detach:function(B){$$(B).each(function(A){A.removeEvent("mouseenter",A.retrieve("tip:enter")||$empty);A.removeEvent("mouseleave",A.retrieve("tip:leave")||$empty);A.removeEvent("mousemove",A.retrieve("tip:move")||$empty);A.eliminate("tip:enter").eliminate("tip:leave").eliminate("tip:move");var D=A.retrieve("tip:native");if(D){A.set("title",D)}});return this},elementEnter:function(H,E){$A(this.container.childNodes).each(Element.dispose);var F=E.retrieve("tip:title");if(F){this.titleElement=new Element("div",{"class":"tip-title"}).inject(this.container);this.fill(this.titleElement,F)}var G=E.retrieve("tip:text");if(G){this.textElement=new Element("div",{"class":"tip-text"}).inject(this.container);this.fill(this.textElement,G)}this.timer=$clear(this.timer);this.timer=this.show.delay(this.options.showDelay,this);this.position((!this.options.fixed)?H:{page:E.getPosition()})},elementLeave:function(B){$clear(this.timer);this.timer=this.hide.delay(this.options.hideDelay,this)},elementMove:function(B){this.position(B)},position:function(L){var N=window.getSize(),H=window.getScroll();var K={x:this.tip.offsetWidth,y:this.tip.offsetHeight};var M={x:"left",y:"top"};for(var J in M){var I=L.page[J]+this.options.offsets[J];if((I+K[J]-H[J])>N[J]){I=L.page[J]-this.options.offsets[J]-K[J]}this.tip.setStyle(M[J],I)}},fill:function(C,D){(typeof D=="string")?C.set("html",D):C.adopt(D)},show:function(){this.fireEvent("show",this.tip)},hide:function(){this.fireEvent("hide",this.tip)}});var SmoothScroll=new Class({Extends:Fx.Scroll,initialize:function(J,I){I=I||document;var G=I.getDocument(),H=I.getWindow();this.parent(G,J);this.links=(this.options.links)?$$(this.options.links):$$(G.links);var F=H.location.href.match(/^[^#]*/)[0]+"#";this.links.each(function(A){if(A.href.indexOf(F)!=0){return }var B=A.href.substr(F.length);if(B&&$(B)){this.useLink(A,B)}},this);if(!Browser.Engine.webkit419){this.addEvent("complete",function(){H.location.hash=this.anchor},true)}},useLink:function(D,C){D.addEvent("click",function(A){this.anchor=C;this.toElement(C);A.stop()}.bind(this))}});var Slider=new Class({Implements:[Events,Options],options:{onTick:function(B){if(this.options.snap){B=this.toPosition(this.step)}this.knob.setStyle(this.property,B)},snap:false,offset:0,range:false,wheel:false,steps:100,mode:"horizontal"},initialize:function(I,G,J){this.setOptions(J);this.element=$(I);this.knob=$(G);this.previousChange=this.previousEnd=this.step=-1;this.element.addEvent("mousedown",this.clickedElement.bind(this));if(this.options.wheel){this.element.addEvent("mousewheel",this.scrolledElement.bindWithEvent(this))}var H,L={},K={x:false,y:false};switch(this.options.mode){case"vertical":this.axis="y";this.property="top";H="offsetHeight";break;case"horizontal":this.axis="x";this.property="left";H="offsetWidth"}this.half=this.knob[H]/2;this.full=this.element[H]-this.knob[H]+(this.options.offset*2);this.min=$chk(this.options.range[0])?this.options.range[0]:0;this.max=$chk(this.options.range[1])?this.options.range[1]:this.options.steps;this.range=this.max-this.min;this.steps=this.options.steps||this.full;this.stepSize=Math.abs(this.range)/this.steps;this.stepWidth=this.stepSize*this.full/Math.abs(this.range);this.knob.setStyle("position","relative").setStyle(this.property,-this.options.offset);K[this.axis]=this.property;L[this.axis]=[-this.options.offset,this.full-this.options.offset];this.drag=new Drag(this.knob,{snap:0,limit:L,modifiers:K,onDrag:this.draggedKnob.bind(this),onStart:this.draggedKnob.bind(this),onComplete:function(){this.draggedKnob();this.end()}.bind(this)});if(this.options.snap){this.drag.options.grid=Math.ceil(this.stepWidth);this.drag.options.limit[this.axis][1]=this.full}},set:function(B){if(!((this.range>0)^(B<this.min))){B=this.min}if(!((this.range>0)^(B>this.max))){B=this.max}this.step=Math.round(B);this.checkStep();this.end();this.fireEvent("tick",this.toPosition(this.step));return this},clickedElement:function(E){var F=this.range<0?-1:1;var D=E.page[this.axis]-this.element.getPosition()[this.axis]-this.half;D=D.limit(-this.options.offset,this.full-this.options.offset);this.step=Math.round(this.min+F*this.toStep(D));this.checkStep();this.end();this.fireEvent("tick",D)},scrolledElement:function(C){var D=(this.options.mode=="horizontal")?(C.wheel<0):(C.wheel>0);this.set(D?this.step-this.stepSize:this.step+this.stepSize);C.stop()},draggedKnob:function(){var D=this.range<0?-1:1;var C=this.drag.value.now[this.axis];C=C.limit(-this.options.offset,this.full-this.options.offset);this.step=Math.round(this.min+D*this.toStep(C));this.checkStep()},checkStep:function(){if(this.previousChange!=this.step){this.previousChange=this.step;this.fireEvent("change",this.step)}},end:function(){if(this.previousEnd!==this.step){this.previousEnd=this.step;this.fireEvent("complete",this.step+"")}},toStep:function(C){var D=(C+this.options.offset)*this.stepSize/this.full*this.steps;return this.options.steps?Math.round(D-=D%this.stepSize):D},toPosition:function(B){return(this.full*Math.abs(this.min-B))/(this.steps*this.stepSize)-this.options.offset}});var Scroller=new Class({Implements:[Events,Options],options:{area:20,velocity:1,onChange:function(C,D){this.element.scrollTo(C,D)}},initialize:function(D,C){this.setOptions(C);this.element=$(D);this.listener=($type(this.element)!="element")?$(this.element.getDocument().body):this.element;this.timer=null;this.coord=this.getCoords.bind(this)},start:function(){this.listener.addEvent("mousemove",this.coord)},stop:function(){this.listener.removeEvent("mousemove",this.coord);this.timer=$clear(this.timer)},getCoords:function(B){this.page=(this.listener.get("tag")=="body")?B.client:B.page;if(!this.timer){this.timer=this.scroll.periodical(50,this)}},scroll:function(){var J=this.element.getSize(),F=this.element.getScroll(),G=this.element.getPosition(),H={x:0,y:0};for(var I in this.page){if(this.page[I]<(this.options.area+G[I])&&F[I]!=0){H[I]=(this.page[I]-this.options.area-G[I])*this.options.velocity}else{if(this.page[I]+this.options.area>(J[I]+G[I])&&J[I]+J[I]!=F[I]){H[I]=(this.page[I]-J[I]+this.options.area-G[I])*this.options.velocity}}}if(H.y||H.x){this.fireEvent("change",[F.x+H.x,F.y+H.y])}}});var Accordion=new Class({Extends:Fx.Elements,options:{display:0,show:false,height:true,width:false,opacity:true,fixedHeight:false,fixedWidth:false,wait:false,alwaysHide:false},initialize:function(){var E=Array.link(arguments,{container:Element.type,options:Object.type,togglers:$defined,elements:$defined});this.parent(E.elements,E.options);this.togglers=$$(E.togglers);this.container=$(E.container);this.previous=-1;if(this.options.alwaysHide){this.options.wait=true}if($chk(this.options.show)){this.options.display=false;this.previous=this.options.show}if(this.options.start){this.options.display=false;this.options.show=false}this.effects={};if(this.options.opacity){this.effects.opacity="fullOpacity"}if(this.options.width){this.effects.width=this.options.fixedWidth?"fullWidth":"offsetWidth"}if(this.options.height){this.effects.height=this.options.fixedHeight?"fullHeight":"scrollHeight"}for(var F=0,D=this.togglers.length;F<D;F++){this.addSection(this.togglers[F],this.elements[F])}this.elements.each(function(B,C){if(this.options.show===C){this.fireEvent("active",[this.togglers[C],B])}else{for(var A in this.effects){B.setStyle(A,0)}}},this);if($chk(this.options.display)){this.display(this.options.display)}},addSection:function(K,M,I){K=$(K);M=$(M);var J=this.togglers.contains(K);var N=this.togglers.length;this.togglers.include(K);this.elements.include(M);if(N&&(!J||I)){I=$pick(I,N-1);K.inject(this.togglers[I],"before");M.inject(K,"after")}else{if(this.container&&!J){K.inject(this.container);M.inject(this.container)}}var H=this.togglers.indexOf(K);K.addEvent("click",this.display.bind(this,H));if(this.options.height){M.setStyles({"padding-top":0,"border-top":"none","padding-bottom":0,"border-bottom":"none"})}if(this.options.width){M.setStyles({"padding-left":0,"border-left":"none","padding-right":0,"border-right":"none"})}M.fullOpacity=1;if(this.options.fixedWidth){M.fullWidth=this.options.fixedWidth}if(this.options.fixedHeight){M.fullHeight=this.options.fixedHeight}M.setStyle("overflow","hidden");if(!J){for(var L in this.effects){M.setStyle(L,0)}}return this},display:function(C){C=($type(C)=="element")?this.elements.indexOf(C):C;if((this.timer&&this.options.wait)||(C===this.previous&&!this.options.alwaysHide)){return this}this.previous=C;var D={};this.elements.each(function(B,G){D[G]={};var H=(G!=C)||(this.options.alwaysHide&&(B.offsetHeight>0));this.fireEvent(H?"background":"active",[this.togglers[G],B]);for(var A in this.effects){D[G][A]=H?0:B[this.effects[A]]}},this);return this.start(D)}});
