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