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(e,d,c){var b=[];var a=2;a.times(function(f){b[f]=Fx.compute(e[f],d[f],c)});return b},start:function(a,d){if(!this.check(arguments.callee,a,d)){return this}this[d||this.options.mode]();var c=this.element.getStyle(this.margin).toInt();var b=this.wrapper.getStyle(this.layout).toInt();var g=[[c,b],[0,this.offset]];var f=[[c,b],[-this.offset,0]];var e;switch(a){case"in":e=g;break;case"out":e=f;break;case"toggle":e=(this.wrapper["offset"+this.layout.capitalize()]==0)?g:f}return this.parent(e[0],e[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(d,e){d=d||"toggle";var b=this.get("slide"),a;switch(d){case"hide":b.hide(e);break;case"show":b.show(e);break;case"toggle":var c=this.retrieve("slide:flag",b.open);b[(c)?"slideOut":"slideIn"](e);this.store("slide:flag",!c);a=true;break;default:b.start(d,e)}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,c){this.element=this.subject=$(d);this.parent(c);var b=this.cancel.bind(this,false);if($type(this.element)!="element"){this.element=$(this.element.getDocument().body)}var a=this.element;if(this.options.wheelStops){this.addEvent("start",function(){a.addEvent("mousewheel",b)},true);this.addEvent("complete",function(){a.removeEvent("mousewheel",b)},true)}},set:function(){var a=Array.flatten(arguments);this.element.scrollTo(a[0],a[1])},compute:function(e,d,c){var b=[];var a=2;a.times(function(f){b.push(Fx.compute(e[f],d[f],c))});return b},start:function(b,g){if(!this.check(arguments.callee,b,g)){return this}var d=this.element.getSize(),e=this.element.getScrollSize();var a=this.element.getScroll(),c={x:b,y:g};for(var f in c){var h=e[f]-d[f];if($chk(c[f])){c[f]=($type(c[f])=="number")?c[f].limit(0,h):h}else{c[f]=a[f]}c[f]+=this.options.offset[f]}return this.parent([a.x,a.y],[c.x,c.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,h,j){var c={};for(var d in g){var a=g[d],e=h[d],f=c[d]={};for(var b in a){f[b]=this.parent(a[b],e[b],j)}}return c},set:function(d){for(var a in d){var c=d[a];for(var b in c){this.render(this.elements[a],b,c[b],this.options.unit)}}return this},start:function(c){if(!this.check(arguments.callee,c)){return this}var h={},j={};for(var d in c){var f=c[d],a=h[d]={},g=j[d]={};for(var b in f){var e=this.prepare(this.elements[d],b,f[b]);a[b]=e.from;g[b]=e.to}}return this.parent(h,j)}});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(a){if(this.options.preventDefault){a.preventDefault()}this.fireEvent("beforeStart",this.element);this.mouse.start=a.page;var c=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]=a.page[b]-this.value.now[b];if(c&&c[b]){for(var d=2;d--;d){if($chk(c[b][d])){this.limit[b][d]=$lambda(c[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(a,d){this.parent(a,d);this.droppables=$$(this.options.droppables);this.container=$(this.options.container);if(this.container&&$type(this.container)!="element"){this.container=$(this.container.getDocument().body)}a=this.element;var b=a.getStyle("position");var c=(b!="static")?b:"absolute";if(a.getStyle("left")=="auto"||a.getStyle("top")=="auto"){a.position(a.getPosition(a.offsetParent))}a.setStyle("position",c);this.addEvent("start",function(){this.checkDroppables()},true)},start:function(b){if(this.container){var d=this.element,j=this.container,e=j.getCoordinates(d.offsetParent),f={},a={};["top","right","bottom","left"].each(function(k){f[k]=j.getStyle("padding-"+k).toInt();a[k]=d.getStyle("margin-"+k).toInt()},this);var c=d.offsetWidth+a.left+a.right,i=d.offsetHeight+a.top+a.bottom;var h=[e.left+f.left,e.right-f.right-c];var g=[e.top+f.top,e.bottom-f.bottom-i];this.options.limit={x:h,y:g}}this.parent(b)},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(c,b){a[b]=function(){var d=c.apply(this.hash,arguments);if(this.options.autoSave){this.save()}return d}});return a})());var Color=new Native({initialize:function(a,b){if(arguments.length>=3){b="rgb";a=Array.slice(arguments,0,3)}else{if(typeof a=="string"){if(a.match(/rgb/)){a=a.rgbToHex().hexToRgb(true)}else{if(a.match(/hsb/)){a=a.hsbToRgb()}else{a=a.hexToRgb(true)}}}}b=b||"rgb";switch(b){case"hsb":var c=a;a=a.hsbToRgb();a.hsb=c;break;case"hex":a=a.hexToRgb(true);break}a.rgb=a.slice(0,3);a.hsb=a.hsb||a.rgbToHsb();a.hex=a.rgbToHex();return $extend(a,this)}});Color.implement({mix:function(){var c=Array.slice(arguments);var b=($type(c.getLast())=="number")?c.pop():50;var a=this.slice();c.each(function(d){d=new Color(d);for(var e=0;e<3;e++){a[e]=Math.round((a[e]/100*(100-b))+(d[e]/100*b))}});return new Color(a,"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(d,c,a){return new Color([d,c,a],"rgb")}function $HSB(d,c,a){return new Color([d,c,a],"hsb")}function $HEX(a){return new Color(a,"hex")}Array.implement({rgbToHsb:function(){var h=this[0],i=this[1],d=this[2];var a,l,b;var c=Math.max(h,i,d),k=Math.min(h,i,d);var e=c-k;b=c/255;l=(c!=0)?e/c:0;if(l==0){a=0}else{var j=(c-h)/e;var g=(c-i)/e;var f=(c-d)/e;if(h==c){a=f-g}else{if(i==c){a=2+j-f}else{a=4+g-j}}a/=6;if(a<0){a++}}return[Math.round(a*360),Math.round(l*100),Math.round(b*100)]},hsbToRgb:function(){var e=Math.round(this[2]/100*255);if(this[1]==0){return[e,e,e]}else{var c=this[0]%360;var a=c%60;var b=Math.round((this[2]*(100-this[1]))/10000*255);var g=Math.round((this[2]*(6000-this[1]*a))/600000*255);var d=Math.round((this[2]*(6000-this[1]*(60-a)))/600000*255);switch(Math.floor(c/60)){case 0:return[e,d,b];case 1:return[g,e,b];case 2:return[b,e,d];case 3:return[b,g,e];case 4:return[d,b,e];case 5:return[e,b,g]}}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(c,d){c.addEvent(b,this.check.bind(this,[b,c,d]))},this);return this},check:function(a,c,d){this.checker[a][d]=true;var b=this.instances.every(function(f,e){return this.checker[a][e]||false},this);if(!b){return}this.checker[a]={};this.events[a].each(function(e){e.call(this,this.instances,c)},this)}});var Asset=new Hash({javascript:function(e,c){c=$extend({onload:$empty,document:document,check:$lambda(true)},c);var a=new Element("script",{src:e,type:"text/javascript"});var d=c.onload.bind(a),g=c.check,f=c.document;delete c.onload;delete c.check;delete c.document;a.addEvents({load:d,readystatechange:function(){if(["loaded","complete"].contains(this.readyState)){d()}}}).setProperties(c);if(Browser.Engine.webkit419){var b=(function(){if(!$try(g)){return}$clear(b);d()}).periodical(50)}return a.inject(f.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(a,d){d=$merge({onload:$empty,onabort:$empty,onerror:$empty},d);var b=new Image();var c=$(b)||new Element("img");["load","abort","error"].each(function(f){var g="on"+f;var e=d[g];delete d[g];b[g]=function(){if(!b){return}if(!c.parentNode){c.width=b.width;c.height=b.height}b=b.onload=b.onabort=b.onerror=null;e.delay(1,c,c);c.fireEvent(f,c,1)}});b.src=c.src=a;if(b&&b.complete){b.onload.delay(1)}return c.setProperties(d)},images:function(b,a){a=$merge({onComplete:$empty,onProgress:$empty},a);if(!b.push){b=[b]}var c=[];var d=0;b.each(function(f){var e=new Asset.image(f,{onload:function(){a.onProgress.call(this,d,b.indexOf(f));d++;if(d==b.length){a.onComplete()}}});c.push(e)});return new Elements(c)}});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(b){a.push(b);this.elements.erase(b);var c=b.retrieve("sortables:start");(this.options.handle?b.getElement(this.options.handle)||b:b).removeEvent("mousedown",c)},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,a){var c="inside";if(this.lists.contains(a)){this.list=a;this.drag.droppables=this.getDroppables()}else{c=this.element.getAllPrevious().contains(a)?"before":"after"}this.element.inject(a,c);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 a=this.lists.map(function(d){return d.getChildren().map(b.modifier||function(e){return e.get("id")},this)},this);var c=b.index;if(this.lists.length==1){c=0}return $chk(c)&&c>=0&&c<this.lists.length?a[c]:a}});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(d){var g=d.retrieve("tip:title",d.get("title"));var f=d.retrieve("tip:text",d.get("rel")||d.get("href"));var e=d.retrieve("tip:enter",this.elementEnter.bindWithEvent(this,d));var c=d.retrieve("tip:leave",this.elementLeave.bindWithEvent(this,d));d.addEvents({mouseenter:e,mouseleave:c});if(!this.options.fixed){var b=d.retrieve("tip:move",this.elementMove.bindWithEvent(this,d));d.addEvent("mousemove",b)}d.store("tip:native",d.get("title"));d.erase("title")},this);return this},detach:function(a){$$(a).each(function(c){c.removeEvent("mouseenter",c.retrieve("tip:enter")||$empty);c.removeEvent("mouseleave",c.retrieve("tip:leave")||$empty);c.removeEvent("mousemove",c.retrieve("tip:move")||$empty);c.eliminate("tip:enter").eliminate("tip:leave").eliminate("tip:move");var b=c.retrieve("tip:native");if(b){c.set("title",b)}});return this},elementEnter:function(d,c){$A(this.container.childNodes).each(Element.dispose);var b=c.retrieve("tip:title");if(b){this.titleElement=new Element("div",{"class":"tip-title"}).inject(this.container);this.fill(this.titleElement,b)}var a=c.retrieve("tip:text");if(a){this.textElement=new Element("div",{"class":"tip-text"}).inject(this.container);this.fill(this.textElement,a)}this.timer=$clear(this.timer);this.timer=this.show.delay(this.options.showDelay,this);this.position((!this.options.fixed)?d:{page:c.getPosition()})},elementLeave:function(a){$clear(this.timer);this.timer=this.hide.delay(this.options.hideDelay,this)},elementMove:function(a){this.position(a)},position:function(c){var a=window.getSize(),g=window.getScroll();var d={x:this.tip.offsetWidth,y:this.tip.offsetHeight};var b={x:"left",y:"top"};for(var e in b){var f=c.page[e]+this.options.offsets[e];if((f+d[e]-g[e])>a[e]){f=c.page[e]-this.options.offsets[e]-d[e]}this.tip.setStyle(b[e],f)}},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(b,c){c=c||document;var e=c.getDocument(),d=c.getWindow();this.parent(e,b);this.links=(this.options.links)?$$(this.options.links):$$(e.links);var a=d.location.href.match(/^[^#]*/)[0]+"#";this.links.each(function(g){if(g.href.indexOf(a)!=0){return}var f=g.href.substr(a.length);if(f&&$(f)){this.useLink(g,f)}},this);if(!Browser.Engine.webkit419){this.addEvent("complete",function(){d.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(a,c,f){this.setOptions(f);this.element=$(a);this.knob=$(c);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,d={},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;d[this.axis]=[-this.options.offset,this.full-this.options.offset];this.drag=new Drag(this.knob,{snap:0,limit:d,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 a=this.range<0?-1:1;var c=b.page[this.axis]-this.element.getPosition()[this.axis]-this.half;c=c.limit(-this.options.offset,this.full-this.options.offset);this.step=Math.round(this.min+a*this.toStep(c));this.checkStep();this.end();this.fireEvent("tick",c)},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 b=this.element.getSize(),a=this.element.getScroll(),e=this.element.getPosition(),d={x:0,y:0};for(var c in this.page){if(this.page[c]<(this.options.area+e[c])&&a[c]!=0){d[c]=(this.page[c]-this.options.area-e[c])*this.options.velocity}else{if(this.page[c]+this.options.area>(b[c]+e[c])&&b[c]+b[c]!=a[c]){d[c]=(this.page[c]-b[c]+this.options.area-e[c])*this.options.velocity}}}if(d.y||d.x){this.fireEvent("change",[a.x+d.x,a.y+d.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 a=0,c=this.togglers.length;a<c;a++){this.addSection(this.togglers[a],this.elements[a])}this.elements.each(function(f,e){if(this.options.show===e){this.fireEvent("active",[this.togglers[e],f])}else{for(var d in this.effects){f.setStyle(d,0)}}},this);if($chk(this.options.display)){this.display(this.options.display)}},addSection:function(d,b,f){d=$(d);b=$(b);var e=this.togglers.contains(d);var a=this.togglers.length;this.togglers.include(d);this.elements.include(b);if(a&&(!e||f)){f=$pick(f,a-1);d.inject(this.togglers[f],"before");b.inject(d,"after")}else{if(this.container&&!e){d.inject(this.container);b.inject(this.container)}}var g=this.togglers.indexOf(d);d.addEvent("click",this.display.bind(this,g));if(this.options.height){b.setStyles({"padding-top":0,"border-top":"none","padding-bottom":0,"border-bottom":"none"})}if(this.options.width){b.setStyles({"padding-left":0,"border-left":"none","padding-right":0,"border-right":"none"})}b.fullOpacity=1;if(this.options.fixedWidth){b.fullWidth=this.options.fixedWidth}if(this.options.fixedHeight){b.fullHeight=this.options.fixedHeight}b.setStyle("overflow","hidden");if(!e){for(var c in this.effects){b.setStyle(c,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(c,f){b[f]={};var e=(f!=a)||(this.options.alwaysHide&&(c.offsetHeight>0));this.fireEvent(e?"background":"active",[this.togglers[f],c]);for(var d in this.effects){b[f][d]=e?0:c[this.effects[d]]}},this);return this.start(b)}});