/*
 *  script.aculo.us version 2.0.0_a6
 *  (c) 2005-2010 Thomas Fuchs
 *
 *  script.aculo.us is freely distributable under the terms of an MIT-style license.
 *----------------------------------------------------------------------------------*/
var S2={Version:"2.0.0_a6",Extensions:{}};Function.prototype.optionize=function(){var a=this,c=a.argumentNames(),b=this.length-1;var d=function(){var f=$A(arguments);var e=(typeof f.last()==="object")?f.pop():{};var g=[];if(b>0){g=((f.length>0?f:[null]).inGroupsOf(b).flatten()).concat(e)}return a.apply(this,g)};d.argumentNames=function(){return c};return d};Function.ABSTRACT=function(){throw"Abstract method. Implement in subclass."};Object.extend(Number.prototype,{constrain:function(e,d){var c=(e<d)?e:d;var a=(e<d)?d:e;var b=Number(this);if(b<c){b=c}if(b>a){b=a}return b},nearer:function(c,b){var a=Number(this);var e=Math.abs(a-c);var d=Math.abs(a-b);return(e<d)?c:b},tween:function(b,a){return this+(b-this)*a}});Object.propertize=function(b,a){return Object.isString(b)?a[b]:b};S2.CSS={PROPERTY_MAP:{backgroundColor:"color",borderBottomColor:"color",borderBottomWidth:"length",borderLeftColor:"color",borderLeftWidth:"length",borderRightColor:"color",borderRightWidth:"length",borderSpacing:"length",borderTopColor:"color",borderTopWidth:"length",bottom:"length",color:"color",fontSize:"length",fontWeight:"integer",height:"length",left:"length",letterSpacing:"length",lineHeight:"length",marginBottom:"length",marginLeft:"length",marginRight:"length",marginTop:"length",maxHeight:"length",maxWidth:"length",minHeight:"length",minWidth:"length",opacity:"number",outlineColor:"color",outlineOffset:"length",outlineWidth:"length",paddingBottom:"length",paddingLeft:"length",paddingRight:"length",paddingTop:"length",right:"length",textIndent:"length",top:"length",width:"length",wordSpacing:"length",zIndex:"integer",zoom:"number"},LENGTH:/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/,NUMBER:/([\+-]*\d+\.?\d*)/,__parseStyleElement:document.createElement("div"),parseStyle:function(a){S2.CSS.__parseStyleElement.innerHTML='<div style="'+a+'"></div>';var c=S2.CSS.__parseStyleElement.childNodes[0].style,b={};S2.CSS.NUMERIC_PROPERTIES.each(function(d){if(c[d]){b[d]=c[d]}});S2.CSS.COLOR_PROPERTIES.each(function(d){if(c[d]){b[d]=S2.CSS.colorFromString(c[d])}});if(Prototype.Browser.IE&&a.include("opacity")){b.opacity=a.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]}return b},normalizeColor:function(a){if(!a||a=="rgba(0, 0, 0, 0)"||a=="transparent"){a="#ffffff"}a=S2.CSS.colorFromString(a);return[parseInt(a.slice(1,3),16),parseInt(a.slice(3,5),16),parseInt(a.slice(5,7),16)]},colorFromString:function(a){var c="#",d,b;if(a.slice(0,4)=="rgb("){d=a.slice(4,a.length-1).split(",");b=3;while(b--){c+=parseInt(d[2-b]).toColorPart()}}else{if(a.slice(0,1)=="#"){if(a.length==4){for(b=1;b<4;b++){c+=(a.charAt(b)+a.charAt(b)).toLowerCase()}}if(a.length==7){c=a.toLowerCase()}}else{c=a}}return(c.length==7?c:(arguments[1]||c))},interpolateColor:function(c,b,a){c=S2.CSS.normalizeColor(c);b=S2.CSS.normalizeColor(b);return"#"+[0,1,2].map(function(d){return Math.max(Math.min(c[d].tween(b[d],a).round(),255),0).toColorPart()}).join("")},interpolateNumber:function(c,b,a){return 1*((c||0).tween(b,a).toFixed(3))},interpolateLength:function(c,b,a){if(!c||parseFloat(c)===0){c="0"+b.gsub(S2.CSS.NUMBER,"")}b.scan(S2.CSS.NUMBER,function(d){b=1*(d[1])});return c.gsub(S2.CSS.NUMBER,function(d){return(1*(parseFloat(d[1]).tween(b,a).toFixed(3))).toString()})},interpolateInteger:function(c,b,a){return parseInt(c).tween(b,a).round()},interpolate:function(b,d,c,a){return S2.CSS["interpolate"+S2.CSS.PROPERTY_MAP[b.camelize()].capitalize()](d,c,a)},ElementMethods:{getStyles:function(b){var a=document.defaultView.getComputedStyle($(b),null);return S2.CSS.PROPERTIES.inject({},function(c,d){c[d]=a[d];return c})}}};S2.CSS.PROPERTIES=[];for(property in S2.CSS.PROPERTY_MAP){S2.CSS.PROPERTIES.push(property)}S2.CSS.NUMERIC_PROPERTIES=S2.CSS.PROPERTIES.findAll(function(a){return !a.endsWith("olor")});S2.CSS.COLOR_PROPERTIES=S2.CSS.PROPERTIES.findAll(function(a){return a.endsWith("olor")});if(!(document.defaultView&&document.defaultView.getComputedStyle)){S2.CSS.ElementMethods.getStyles=function(b){b=$(b);var a=b.currentStyle,c;c=S2.CSS.PROPERTIES.inject({},function(e,d){e[d]=a[d];return e});if(!c.opacity){c.opacity=b.getOpacity()}return c}}Element.addMethods(S2.CSS.ElementMethods);S2.FX=(function(){var c=[],g,f,e=0;function d(h){f[(e+=h)>0?"start":"stop"]()}function b(){c.invoke("render",f.getTimestamp())}function a(h){if(g){return}c.push(g=new S2.FX.Queue());S2.FX.DefaultOptions.queue=g;f=h||new S2.FX.Heartbeat();document.observe("effect:heartbeat",b).observe("effect:queued",d.curry(1)).observe("effect:dequeued",d.curry(-1))}return{initialize:a,getQueues:function(){return c},addQueue:function(h){c.push(h)},getHeartbeat:function(){return f},setHeartbeat:function(h){f=h}}})();Object.extend(S2.FX,{DefaultOptions:{transition:"sinusoidal",position:"parallel",fps:60,duration:0.2},elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},parseOptions:function(a){if(Object.isNumber(a)){a={duration:a}}else{if(Object.isFunction(a)){a={after:a}}else{if(Object.isString(a)){a={duration:a=="slow"?1:a=="fast"?0.1:0.2}}}}return a||{}}});S2.FX.Base=Class.create({initialize:function(a){S2.FX.initialize();this.updateWithoutWrappers=this.update;if(a&&a.queue&&!S2.FX.getQueues().include(a.queue)){S2.FX.addQueue(a.queue)}this.setOptions(a);this.duration=this.options.duration*1000;this.state="idle";["after","before"].each(function(b){this[b]=function(c){c(this);return this}},this)},setOptions:function(a){a=S2.FX.parseOptions(a);if(!this.options){this.options=Object.extend(Object.extend({},S2.FX.DefaultOptions),a);if(a.tween){this.options.transition=a.tween}}if(this.options.beforeUpdate||this.options.afterUpdate){this.update=this.updateWithoutWrappers.wrap(function(c,b){if(this.options.beforeUpdate){this.options.beforeUpdate(this,b)}c(b);if(this.options.afterUpdate){this.options.afterUpdate(this,b)}}.bind(this))}if(this.options.transition===false){this.options.transition=S2.FX.Transitions.linear}this.options.transition=Object.propertize(this.options.transition,S2.FX.Transitions)},play:function(a){this.setOptions(a);this.frameCount=0;this.options.queue.add(this);this.maxFrames=this.options.fps*this.duration/1000;return this},render:function(b){if(b>=this.startsAt){if(this.state=="idle"){if(this.options.before){this.options.before(this)}if(this.setup){this.setup()}this.state="running";this.update(this.options.transition(0));this.frameCount++;return this}if(b>=this.endsAt&&!(this.state=="finished")){this.update(this.options.transition(1));if(this.teardown){this.teardown()}if(this.options.after){this.options.after(this)}this.state="finished"}else{if(this.state=="running"){var a=1-(this.endsAt-b)/this.duration;if((this.maxFrames*a).floor()>this.frameCount){this.update(this.options.transition(a));this.frameCount++}}}}return this},cancel:function(a){if(!this.state=="running"){return}if(this.teardown){this.teardown()}if(a&&this.options.after){this.options.after(this)}this.state="finished"},finish:function(a){if(!this.state=="running"){return}this.update(this.options.transition(1));this.cancel(true)},inspect:function(){return"#<S2.FX:"+[this.state,this.startsAt,this.endsAt].inspect()+">"},update:Prototype.emptyFunction});S2.FX.Element=Class.create(S2.FX.Base,{initialize:function($super,b,a){if(!(this.element=$(b))){throw (S2.FX.elementDoesNotExistError)}this.operators=[];return $super(a)},animate:function(){var b=$A(arguments),a=b.shift();a=a.charAt(0).toUpperCase()+a.substring(1);this.operators.push(new S2.FX.Operators[a](this,b[0],b[1]||{}))},play:function($super,b,a){if(b){this.element=$(b)}return $super(a)},update:function(a){this.operators.invoke("render",a)}});S2.FX.Heartbeat=Class.create({initialize:function(a){this.options=Object.extend({framerate:Prototype.Browser.MobileSafari?20:60},a);this.beat=this.beat.bind(this)},start:function(){if(this.heartbeatInterval){return}this.heartbeatInterval=setInterval(this.beat,1000/this.options.framerate);this.updateTimestamp()},stop:function(){if(!this.heartbeatInterval){return}clearInterval(this.heartbeatInterval);this.heartbeatInterval=null;this.timestamp=null},beat:function(){this.updateTimestamp();document.fire("effect:heartbeat")},getTimestamp:function(){return this.timestamp||this.generateTimestamp()},generateTimestamp:function(){return new Date().getTime()},updateTimestamp:function(){this.timestamp=this.generateTimestamp()}});S2.FX.Queue=(function(){return function(){var d=[];function e(){return d}function g(){return d.length>0}function f(h){b(h);d.push(h);document.fire("effect:queued",this);return this}function a(h){d=d.without(h);delete h;document.fire("effect:dequeued",this);return this}function c(h){d.invoke("render",h);d.select(function(i){return i.state=="finished"}).each(a);return this}function b(j){var h=j.options.position||"parallel",i=S2.FX.getHeartbeat().getTimestamp();if(h=="end"){i=d.without(j).pluck("endsAt").max()||i}j.startsAt=i+(j.options.delay||0)*1000;j.endsAt=j.startsAt+(j.options.duration||1)*1000}Object.extend(this,{getEffects:e,active:g,add:f,remove:a,render:c})}})();S2.FX.Attribute=Class.create(S2.FX.Base,{initialize:function($super,b,e,d,a,c){b=Object.isString(b)?$(b):b;this.method=Object.isFunction(c)?c.bind(b):Object.isFunction(b[c])?b[c].bind(b):function(f){b[c]=f};this.to=d;this.from=e;return $super(a)},update:function(a){this.method(this.from.tween(this.to,a))}});S2.FX.Style=Class.create(S2.FX.Element,{setup:function(){this.animate("style",this.element,{style:this.options.style})}});S2.FX.Operators={};S2.FX.Operators.Base=Class.create({initialize:function(c,b,a){this.effect=c;this.object=b;this.options=Object.extend({transition:Prototype.K},a)},inspect:function(){return"#<S2.FX.Operators.Base:"+this.lastValue+">"},setup:function(){},valueAt:function(a){},applyValue:function(a){},render:function(a){var b=this.valueAt(this.options.transition(a));this.applyValue(b);this.lastValue=b}});S2.FX.Operators.Style=Class.create(S2.FX.Operators.Base,{initialize:function($super,c,b,a){$super(c,b,a);this.element=$(this.object);this.style=Object.isString(this.options.style)?S2.CSS.parseStyle(this.options.style):this.options.style;this.tweens=[];for(var d in this.style){var e=d.underscore().dasherize(),g=this.element.getStyle(e),f=this.style[d];if(g!=f){this.tweens.push([e,S2.CSS.interpolate.curry(e,g,f),d in this.options.propertyTransitions?Object.propertize(this.options.propertyTransitions[d],S2.FX.Transitions):Prototype.K])}}},valueAt:function(a){return this.tweens.map(function(b){return b[0]+":"+b[1](b[2](a))}).join(";")},applyValue:function(a){if(this.currentStyle==a){return}this.element.setStyle(a);this.currentStyle=a}});S2.FX.Morph=Class.create(S2.FX.Element,{setup:function(){if(this.options.change){this.setupWrappers()}else{if(this.options.style){this.animate("style",this.destinationElement||this.element,{style:this.options.style,propertyTransitions:this.options.propertyTransitions||{}})}}},teardown:function(){if(this.options.change){this.teardownWrappers()}},setupWrappers:function(){var a=this.element.getStyle("float"),f,b,d,c,e;this.transitionElement=new Element("div").setStyle({position:"relative",overflow:"hidden","float":a});this.element.setStyle({"float":"none"}).insert({before:this.transitionElement});this.sourceElementWrapper=this.element.cloneWithoutIDs().wrap("div");this.destinationElementWrapper=this.element.wrap("div");this.transitionElement.insert(this.sourceElementWrapper).insert(this.destinationElementWrapper);f=this.sourceElementWrapper.getHeight();b=this.sourceElementWrapper.getWidth();this.options.change();d=this.destinationElementWrapper.getHeight();c=this.destinationElementWrapper.getWidth();this.outerWrapper=new Element("div");this.transitionElement.insert({before:this.outerWrapper});this.outerWrapper.setStyle({overflow:"hidden",height:f+"px",width:b+"px"}).appendChild(this.transitionElement);e=Math.max(d,f),maxWidth=Math.max(c,b);this.transitionElement.setStyle({height:f+"px",width:b+"px"});this.sourceElementWrapper.setStyle({position:"absolute",height:e+"px",width:maxWidth+"px",top:0,left:0});this.destinationElementWrapper.setStyle({position:"absolute",height:e+"px",width:maxWidth+"px",top:0,left:0,opacity:0,zIndex:2000});this.outerWrapper.insert({before:this.transitionElement}).remove();this.animate("style",this.transitionElement,{style:"height:"+d+"px; width:"+c+"px"});this.animate("style",this.destinationElementWrapper,{style:"opacity: 1.0"})},teardownWrappers:function(){var a=this.destinationElementWrapper.down();if(a){this.transitionElement.insert({before:a})}this.transitionElement.remove()}});S2.FX.Parallel=Class.create(S2.FX.Base,{initialize:function($super,b,a){this.effects=b||[];return $super(a||{})},setup:function(){this.effects.invoke("setup")},update:function(a){this.effects.invoke("update",a)}});S2.FX.Operators.Scroll=Class.create(S2.FX.Operators.Base,{initialize:function($super,c,b,a){$super(c,b,a);this.start=b.scrollTop;this.end=this.options.scrollTo},valueAt:function(a){return this.start+((this.end-this.start)*a)},applyValue:function(a){this.object.scrollTop=a.round()}});S2.FX.Scroll=Class.create(S2.FX.Element,{setup:function(){this.animate("scroll",this.element,{scrollTo:this.options.to})}});S2.FX.SlideDown=Class.create(S2.FX.Element,{setup:function(){var a=this.destinationElement||this.element;var c=a.getLayout();var b={height:c.get("height")+"px",paddingTop:c.get("padding-top")+"px",paddingBottom:c.get("padding-bottom")+"px"};a.setStyle({height:"0",paddingTop:"0",paddingBottom:"0",overflow:"hidden"}).show();this.animate("style",a,{style:b,propertyTransitions:{}})},teardown:function(){var a=this.destinationElement||this.element;a.setStyle({height:"",paddingTop:"",paddingBottom:"",overflow:"visible"})}});S2.FX.SlideUp=Class.create(S2.FX.Morph,{setup:function(){var a=this.destinationElement||this.element;var c=a.getLayout();var b={height:"0px",paddingTop:"0px",paddingBottom:"0px"};a.setStyle({overflow:"hidden"});this.animate("style",a,{style:b,propertyTransitions:{}})},teardown:function(){var a=this.destinationElement||this.element;a.setStyle({height:"",paddingTop:"",paddingBottom:"",overflow:"visible"}).hide()}});S2.FX.Transitions={linear:Prototype.K,sinusoidal:function(a){return(-Math.cos(a*Math.PI)/2)+0.5},reverse:function(a){return 1-a},mirror:function(b,a){a=a||S2.FX.Transitions.sinusoidal;if(b<0.5){return a(b*2)}else{return a(1-(b-0.5)*2)}},flicker:function(a){var a=a+(Math.random()-0.5)/5;return S2.FX.Transitions.sinusoidal(a<0?0:a>1?1:a)},wobble:function(a){return(-Math.cos(a*Math.PI*(9*a))/2)+0.5},pulse:function(b,a){return(-Math.cos((b*((a||5)-0.5)*2)*Math.PI)/2)+0.5},blink:function(b,a){return Math.round(b*(a||5))%2},spring:function(a){return 1-(Math.cos(a*4.5*Math.PI)*Math.exp(-a*6))},none:Prototype.K.curry(0),full:Prototype.K.curry(1)};
/*
 *  Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  1. Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *
 *  2. Redistributions in binary form must reproduce the above copyright notice,
 *  this list of conditions and the following disclaimer in the documentation
 *  and/or other materials provided with the distribution.
 *
 *  3. Neither the name of the copyright holder(s) nor the names of any
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 *  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
 *  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 *  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 *  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
(function(){function a(q,d,c,m,l,b){var p=0,v=0,f=0,n=0,s=0,e=0;function j(w){return((p*w+v)*w+f)*w}function i(w){return((n*w+s)*w+e)*w}function u(w){return(3*p*w+2*v)*w+f}function o(w){return 1/(200*w)}function h(w,y){return i(g(w,y))}function r(w){if(w>=0){return w}else{return 0-w}}function g(w,E){var D,C,A,y,B,z;for(A=w,z=0;z<8;z++){y=j(A)-w;if(r(y)<E){return A}B=u(A);if(r(B)<0.000001){break}A=A-y/B}D=0;C=1;A=w;if(A<D){return D}if(A>C){return C}while(D<C){y=j(A);if(r(y-w)<E){return A}if(w>y){D=A}else{C=A}A=(C-D)*0.5+D}return A}f=3*d;v=3*(m-d)-f;p=1-f-v;e=3*c;s=3*(l-c)-e;n=1-e-s;return h(q,o(b))}S2.FX.cubicBezierTransition=function(c,e,b,d){return(function(f){return a(f,c,e,b,d,1)})}})();S2.FX.Transitions.webkitCubic=S2.FX.cubicBezierTransition(0.25,0.1,0.25,1);S2.FX.Transitions.webkitEaseInOut=S2.FX.cubicBezierTransition(0.42,0,0.58,1);
/*
 *  TERMS OF USE - EASING EQUATIONS
 *  Open source under the BSD License.
 *  Easing Equations (c) 2003 Robert Penner, all rights reserved.
 */
Object.extend(S2.FX.Transitions,{easeInQuad:function(a){return Math.pow(a,2)},easeOutQuad:function(a){return -(Math.pow((a-1),2)-1)},easeInOutQuad:function(a){if((a/=0.5)<1){return 0.5*Math.pow(a,2)}return -0.5*((a-=2)*a-2)},easeInCubic:function(a){return Math.pow(a,3)},easeOutCubic:function(a){return(Math.pow((a-1),3)+1)},easeInOutCubic:function(a){if((a/=0.5)<1){return 0.5*Math.pow(a,3)}return 0.5*(Math.pow((a-2),3)+2)},easeInQuart:function(a){return Math.pow(a,4)},easeOutQuart:function(a){return -(Math.pow((a-1),4)-1)},easeInOutQuart:function(a){if((a/=0.5)<1){return 0.5*Math.pow(a,4)}return -0.5*((a-=2)*Math.pow(a,3)-2)},easeInQuint:function(a){return Math.pow(a,5)},easeOutQuint:function(a){return(Math.pow((a-1),5)+1)},easeInOutQuint:function(a){if((a/=0.5)<1){return 0.5*Math.pow(a,5)}return 0.5*(Math.pow((a-2),5)+2)},easeInSine:function(a){return -Math.cos(a*(Math.PI/2))+1},easeOutSine:function(a){return Math.sin(a*(Math.PI/2))},easeInOutSine:function(a){return(-0.5*(Math.cos(Math.PI*a)-1))},easeInExpo:function(a){return(a==0)?0:Math.pow(2,10*(a-1))},easeOutExpo:function(a){return(a==1)?1:-Math.pow(2,-10*a)+1},easeInOutExpo:function(a){if(a==0){return 0}if(a==1){return 1}if((a/=0.5)<1){return 0.5*Math.pow(2,10*(a-1))}return 0.5*(-Math.pow(2,-10*--a)+2)},easeInCirc:function(a){return -(Math.sqrt(1-(a*a))-1)},easeOutCirc:function(a){return Math.sqrt(1-Math.pow((a-1),2))},easeInOutCirc:function(a){if((a/=0.5)<1){return -0.5*(Math.sqrt(1-a*a)-1)}return 0.5*(Math.sqrt(1-(a-=2)*a)+1)},easeOutBounce:function(a){if((a)<(1/2.75)){return(7.5625*a*a)}else{if(a<(2/2.75)){return(7.5625*(a-=(1.5/2.75))*a+0.75)}else{if(a<(2.5/2.75)){return(7.5625*(a-=(2.25/2.75))*a+0.9375)}else{return(7.5625*(a-=(2.625/2.75))*a+0.984375)}}}},easeInBack:function(b){var a=1.70158;return(b)*b*((a+1)*b-a)},easeOutBack:function(b){var a=1.70158;return(b=b-1)*b*((a+1)*b+a)+1},easeInOutBack:function(b){var a=1.70158;if((b/=0.5)<1){return 0.5*(b*b*(((a*=(1.525))+1)*b-a))}return 0.5*((b-=2)*b*(((a*=(1.525))+1)*b+a)+2)},elastic:function(a){return -1*Math.pow(4,-8*a)*Math.sin((a*6-1)*(2*Math.PI)/2)+1},swingFromTo:function(b){var a=1.70158;return((b/=0.5)<1)?0.5*(b*b*(((a*=(1.525))+1)*b-a)):0.5*((b-=2)*b*(((a*=(1.525))+1)*b+a)+2)},swingFrom:function(b){var a=1.70158;return b*b*((a+1)*b-a)},swingTo:function(b){var a=1.70158;return(b-=1)*b*((a+1)*b+a)+1},bounce:function(a){if(a<(1/2.75)){return(7.5625*a*a)}else{if(a<(2/2.75)){return(7.5625*(a-=(1.5/2.75))*a+0.75)}else{if(a<(2.5/2.75)){return(7.5625*(a-=(2.25/2.75))*a+0.9375)}else{return(7.5625*(a-=(2.625/2.75))*a+0.984375)}}}},bouncePast:function(a){if(a<(1/2.75)){return(7.5625*a*a)}else{if(a<(2/2.75)){return 2-(7.5625*(a-=(1.5/2.75))*a+0.75)}else{if(a<(2.5/2.75)){return 2-(7.5625*(a-=(2.25/2.75))*a+0.9375)}else{return 2-(7.5625*(a-=(2.625/2.75))*a+0.984375)}}}},easeFromTo:function(a){if((a/=0.5)<1){return 0.5*Math.pow(a,4)}return -0.5*((a-=2)*Math.pow(a,3)-2)},easeFrom:function(a){return Math.pow(a,4)},easeTo:function(a){return Math.pow(a,0.25)}});Prototype.BrowserFeatures.WebkitCSSTransitions=false;S2.Extensions.webkitCSSTransitions=false;(function(){try{document.createEvent("WebKitTransitionEvent")}catch(a){return}Prototype.BrowserFeatures.WebkitCSSTransitions=true;S2.Extensions.webkitCSSTransitions=true;if(Prototype.BrowserFeatures.WebkitCSSTransitions){$w("webkitBorderTopLeftRadius webkitBorderTopRightRadius webkitBorderBottomLeftRadius webkitBorderBottomRightRadius webkitBackgroundSize").each(function(b){S2.CSS.PROPERTIES.push(b)});S2.CSS.NUMERIC_PROPERTIES=S2.CSS.PROPERTIES.findAll(function(b){return !b.endsWith("olor")});S2.FX.Operators.WebkitCssTransition=Class.create(S2.FX.Operators.Base,{initialize:function($super,e,c,b){$super(e,c,b);this.element=$(this.object);if(!Object.isString(this.options.style)){this.style=$H(this.options.style)}else{if(this.options.style.include(":")){this.style=$H(S2.CSS.parseStyle(this.options.style))}else{this.element.addClassName(b.style);this.style=$H(this.element.getStyles());this.element.removeClassName(b.style);var d=this.element.getStyles();this.style=this.style.reject(function(f){return f.value==d[f.key]})}}this.properties=[];this.targetStyle="";this.style.each(function(l){var i=l[0].underscore().dasherize(),j=l[1],g="",h=this.element.getStyle(i),f="";if(i.startsWith("webkit")){i="-"+i}this.properties.push(i);this.targetStyle+=";"+i+":"+j},this)},render:function(){this.element.style.webkitTransitionProperty=this.properties.join(",");this.element.style.webkitTransitionDuration=(this.effect.duration/1000).toFixed(3)+"s";for(t in S2.FX.Operators.WebkitCssTransition.TIMING_MAP){if(S2.FX.Transitions[t]===this.effect.options.transition){this.element.style.webkitTransitionTimingFunction=S2.FX.Operators.WebkitCssTransition.TIMING_MAP[t]}}this.element.setStyle(this.targetStyle);this.render=Prototype.emptyFunction}});S2.FX.Operators.WebkitCssTransition.TIMING_MAP={linear:"linear",sinusoidal:"ease-in-out"};timingFunctionForTransition=function(c){var b=null;for(t in S2.FX.Operators.WebkitCssTransition.TIMING_MAP){if(S2.FX.Transitions[t]===c){b=S2.FX.Operators.WebkitCssTransition.TIMING_MAP[t]}}return b};isWebkitCSSTransitionCompatible=function(b){return(S2.Extensions.webkitCSSTransitions&&!((b.options.engine||"")=="javascript")&&(timingFunctionForTransition(b.options.transition))&&!(b.options.propertyTransitions))};S2.FX.Morph=Class.create(S2.FX.Morph,{setup:function(){if(this.options.change){this.setupWrappers()}else{if(this.options.style){this.engine=isWebkitCSSTransitionCompatible(this)?"webkit":"javascript";this.animate(this.engine=="webkit"?"webkitCssTransition":"style",this.destinationElement||this.element,{style:this.options.style,propertyTransitions:this.options.propertyTransitions||{}})}}},render:function($super,b){if(this.engine=="webkit"){if(this.options.before){this.element.beforeStartEffect=this.options.before}if(this.options.after){this.element.afterFinishEffect=this.options.after;delete this.options.after}this.element._effect=this}return $super(b)}});Element.addMethods({morph:function(c,d,b){if(Object.isNumber(b)){b={duration:b}}return c.effect("morph",Object.extend(b,{style:d}))}.optionize()});S2.FX.webkitTransitionStartEvent=document.observe("webkitTransitionStart",function(c){var b=c.element();if(!b||!b.beforeStartEffect){return}b.beforeStartEffect();b.beforeStartEffect=null});S2.FX.webkitTransitionEndEvent=document.observe("webkitTransitionEnd",function(c){var b=c.element();if(!b){return}(function(){b.style.webkitTransitionDuration=""}).defer();if(!b.afterFinishEffect){return}b.afterFinishEffect();b.afterFinishEffect=null})}})();(function(){function e(o){var n=o.match(/^(\d+)%?$/i);if(!n){return null}return(Number(n[1])/100)}function j(r,q){if(Object.isElement(r)){element=r;r=element.getStyle(q)}if(r===null){return null}if((/^\d+(px)?$/i).test(r)){return window.parseInt(r,10)}if(/\d/.test(r)&&element.runtimeStyle){var o=element.style.left,s=element.runtimeStyle.left;element.runtimeStyle.left=element.currentStyle.left;element.style.left=r||0;r=element.style.pixelLeft;element.style.left=o;element.runtimeStyle.left=s;return r}if(r.include("%")){var n=e(r);var p;if(q.include("left")||q.include("right")||q.include("width")){p=$(element.parentNode).measure("width")}else{if(q.include("top")||q.include("bottom")||q.include("height")){p=$(element.parentNode).measure("height")}}return p*n}return 0}function l(n){if(Object.isString(n)&&n.endsWith("px")){return n}return n+"px"}function d(o){var n=o;while(o&&o.parentNode){var p=o.getStyle("display");if(p==="none"){return false}o=$(o.parentNode)}return true}var g=Prototype.K;if("currentStyle" in document.documentElement){g=function(n){if(!n.currentStyle.hasLayout){n.style.zoom=1}return n}}Element.Layout=Class.create(Hash,{initialize:function($super,o,n){$super();this.element=$(o);if(n){this._preComputing=true;this._begin()}Element.Layout.PROPERTIES.each(function(p){if(n){this._compute(p)}else{this._set(p,null)}},this);if(n){this._end();this._preComputing=false}},_set:function(o,n){return Hash.prototype.set.call(this,o,n)},set:function(o,n){throw"Properties of Element.Layout are read-only."},get:function($super,o){var n=$super(o);return n===null?this._compute(o):n},_begin:function(){if(this._prepared){return}var q=this.element;if(d(q)){this._prepared=true;return}var p={position:q.style.position||"",width:q.style.width||"",visibility:q.style.visibility||"",display:q.style.display||""};q.store("prototype_original_styles",p);var n=q.getStyle("position"),s=q.getStyle("width");q.setStyle({position:"absolute",visibility:"hidden",display:"block"});var v=q.getStyle("width");var u;if(s&&(v===s)){u=window.parseInt(s,10)}else{if(s&&(n==="absolute"||n==="fixed")){u=window.parseInt(s,10)}else{var r=q.parentNode,o=$(r).getLayout();u=o.get("width")-this.get("margin-left")-this.get("border-left")-this.get("padding-left")-this.get("padding-right")-this.get("border-right")-this.get("margin-right")}}q.setStyle({width:u+"px"});this._prepared=true},_end:function(){var o=this.element;var n=o.retrieve("prototype_original_styles");o.store("prototype_original_styles",null);o.setStyle(n);this._prepared=false},_compute:function(p){var n=Element.Layout.COMPUTATIONS;if(!(p in n)){throw"Property not found."}var o=n[p].call(this,this.element);this._set(p,o);return o}});Object.extend(Element.Layout,{PROPERTIES:$w("height width top left right bottom border-left border-right border-top border-bottom padding-left padding-right padding-top padding-bottom margin-top margin-bottom margin-left margin-right padding-box-width padding-box-height border-box-width border-box-height margin-box-width margin-box-height"),COMPOSITE_PROPERTIES:$w("padding-box-width padding-box-height margin-box-width margin-box-height border-box-width border-box-height"),COMPUTATIONS:{height:function(p){if(!this._preComputing){this._begin()}var n=this.get("border-box-height");if(n<=0){return 0}var q=this.get("border-top"),o=this.get("border-bottom");var s=this.get("padding-top"),r=this.get("padding-bottom");if(!this._preComputing){this._end()}return n-q-o-s-r},width:function(p){if(!this._preComputing){this._begin()}var o=this.get("border-box-width");if(o<=0){return 0}var s=this.get("border-left"),n=this.get("border-right");var q=this.get("padding-left"),r=this.get("padding-right");if(!this._preComputing){this._end()}return o-s-n-q-r},"padding-box-height":function(o){var n=this.get("height"),q=this.get("padding-top"),p=this.get("padding-bottom");return n+q+p},"padding-box-width":function(n){var o=this.get("width"),p=this.get("padding-left"),q=this.get("padding-right");return o+p+q},"border-box-height":function(n){return n.offsetHeight},"border-box-width":function(n){return n.offsetWidth},"margin-box-height":function(o){var n=this.get("border-box-height"),p=this.get("margin-top"),q=this.get("margin-bottom");if(n<=0){return 0}return n+p+q},"margin-box-width":function(p){var o=this.get("border-box-width"),q=this.get("margin-left"),n=this.get("margin-right");if(o<=0){return 0}return o+q+n},top:function(n){var o=n.positionedOffset();return o.top},bottom:function(n){var q=n.positionedOffset(),o=n.getOffsetParent(),p=o.measure("height");var r=this.get("border-box-height");return p-r-q.top},left:function(n){var o=n.positionedOffset();return o.left},right:function(p){var r=p.positionedOffset(),q=p.getOffsetParent(),n=q.measure("width");var o=this.get("border-box-width");return n-o-r.left},"padding-top":function(n){return j(n,"paddingTop")},"padding-bottom":function(n){return j(n,"paddingBottom")},"padding-left":function(n){return j(n,"paddingLeft")},"padding-right":function(n){return j(n,"paddingRight")},"border-top":function(n){return Object.isNumber(n.clientTop)?n.clientTop:j(n,"borderTopWidth")},"border-bottom":function(n){return Object.isNumber(n.clientBottom)?n.clientBottom:j(n,"borderBottomWidth")},"border-left":function(n){return Object.isNumber(n.clientLeft)?n.clientLeft:j(n,"borderLeftWidth")},"border-right":function(n){return Object.isNumber(n.clientRight)?n.clientRight:j(n,"borderRightWidth")},"margin-top":function(n){return j(n,"marginTop")},"margin-bottom":function(n){return j(n,"marginBottom")},"margin-left":function(n){return j(n,"marginLeft")},"margin-right":function(n){return j(n,"marginRight")}}});if("getBoundingClientRect" in document.documentElement){Object.extend(Element.Layout.COMPUTATIONS,{right:function(o){var p=g(o.getOffsetParent());var q=o.getBoundingClientRect(),n=p.getBoundingClientRect();return(n.right-q.right).round()},bottom:function(o){var p=g(o.getOffsetParent());var q=o.getBoundingClientRect(),n=p.getBoundingClientRect();return(n.bottom-q.bottom).round()}})}Element.Offset=Class.create({initialize:function(o,n){this.left=o.round();this.top=n.round();this[0]=this.left;this[1]=this.top},relativeTo:function(n){return new Element.Offset(this.left-n.left,this.top-n.top)},inspect:function(){return"#<Element.Offset left: #{left} top: #{top}>".interpolate(this)},toString:function(){return"[#{left}, #{top}]".interpolate(this)},toArray:function(){return[this.left,this.top]}});function c(n){return new Element.Layout(n)}function b(n,o){return $(n).getLayout().get(o)}function f(o){var n=0,p=0;do{n+=o.offsetTop||0;p+=o.offsetLeft||0;o=o.offsetParent}while(o);return new Element.Offset(p,n)}function i(o){var q=o.getLayout();var n=0,s=0;do{n+=o.offsetTop||0;s+=o.offsetLeft||0;o=o.offsetParent;if(o){if(a(o)){break}var r=Element.getStyle(o,"position");if(r!=="static"){break}}}while(o);s-=q.get("margin-top");n-=q.get("margin-left");return new Element.Offset(s,n)}function h(o){var n=0,p=0;do{n+=o.scrollTop||0;p+=o.scrollLeft||0;o=o.parentNode}while(o);return new Element.Offset(p,n)}function m(s){var n=0,r=0;var p=s;do{n+=p.offsetTop||0;r+=p.offsetLeft||0;if(p.offsetParent==document.body&&Element.getStyle(p,"position")=="absolute"){break}}while(p=p.offsetParent);p=s;var o=p.tagName,q=Prototype.Browser.Opera;do{if(!q||o&&o.toUpperCase()==="BODY"){n-=p.scrollTop||0;r-=p.scrollLeft||0}}while(p=p.parentNode);return new Element.Offset(r,n)}Element.addMethods({getLayout:c,measure:b,cumulativeOffset:f,positionedOffset:i,cumulativeScrollOffset:h,viewportOffset:m});function a(n){return $w("BODY HTML").include(n.nodeName.toUpperCase())}if("getBoundingClientRect" in document.documentElement){Element.addMethods({viewportOffset:function(n){n=$(n);var o=n.getBoundingClientRect();return new Element.Offset(o.left,o.top)},cumulativeOffset:function(p){p=$(p);var n=$(document.documentElement).viewportOffset(),o=p.viewportOffset();return o.relativeTo(n)},positionedOffset:function(o){o=$(o);var q=o.getOffsetParent();if(q.nodeName.toUpperCase()==="HTML"){return i(o)}var s=o.viewportOffset(),p=a(q)?m(q):q.viewportOffset();var n=s.relativeTo(p);var r=o.getLayout();var v=n.top-r.get("margin-top");var u=n.left-r.get("margin-left");return new Element.Offset(u,v)}})}})();S2.UI={};Object.deepExtend=function(a,c){for(var b in c){if(c[b]&&c[b].constructor&&c[b].constructor===Object){a[b]=a[b]||{};arguments.callee(a[b],c[b])}else{a[b]=c[b]}}return a};S2.UI.Mixin={};S2.UI.Mixin.Configurable={setOptions:function(c){if(!this.options){this.options={};var f=this.constructor;if(f.superclass){var e=[],a=f;while(a=a.superclass){e.push(a)}e=e.reverse();for(var d=0,b=e.length;d<b;d++){Object.deepExtend(this.options,e[d].DEFAULT_OPTIONS||{})}}Object.deepExtend(this.options,f.DEFAULT_OPTIONS||{})}return Object.deepExtend(this.options,c||{})}};S2.UI.Mixin.Trackable={register:function(){var a=this.constructor;if(!a.instances){a.instances=[]}if(!a.instances.include(this)){a.instances.push(this)}if(Object.isFunction(a.onRegister)){a.onRegister.call(a,this)}},unregister:function(){var a=this.constructor;a.instances=a.instances.without(this);if(Object.isFunction(a.onRegister)){a.onUnregister.call(a,this)}}};S2.UI.Mixin.Shim={__SHIM_TEMPLATE:new Template("<iframe frameborder='0' tabindex='-1' src='javascript:false;' style='display:block;position:absolute;z-index:-1;overflow:hidden; filter:Alpha(Opacity=\"0\");top:expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+'px');left:expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+'px');width:expression(this.parentNode.offsetWidth+'px');height:expression(this.parentNode.offsetHeight+'px');' id='#{0}'></iframe>"),createShim:function(a){this.__shim_isie6=(Prototype.Browser.IE&&(/6.0/).test(navigator.userAgent));if(!this.__shim_isie6){return}a=$(a||this.element);if(!a){return}this.__shimmed=a;var c=a.identify()+"_iframeshim",b=$(c);if(b){b.remove()}a.insert({top:this.__SHIM_TEMPLATE.evaluate([c])});this.__shim_id=c},adjustShim:function(){if(!this.__shim_isie6){return}var b=this.__shimmed.down("iframe#"+this.__shim_id);var a=this.__shimmed;if(!b){return}b.setStyle({width:a.offsetWidth+"px",height:a.offsetHeight+"px"})},destroyShim:function(){if(!this.__shim_isie6){return}var a=this.__shimmed.down("iframe#"+this.__shim_id);if(a){a.remove()}this.__shimmed=null}};Object.extend(S2.UI,{addClassNames:function(e,f){if(Object.isElement(e)){e=[e]}if(Object.isString(f)){f=f.split(" ")}var a,d;for(var c=0,b;b=e[c];c++){for(a=0;d=f[a];a++){b.addClassName(d)}}return e},removeClassNames:function(e,f){if(Object.isElement(e)){e=[e]}if(Object.isString(f)){f=f.split(" ")}var a,d;for(var c=0,b;b=e[c];c++){for(a=0;d=f[a];a++){b.removeClassName(d)}}},FOCUSABLE_ELEMENTS:$w("input select textarea button object"),isFocusable:function(d){var c=d.nodeName.toLowerCase(),a=d.readAttribute("tabIndex"),b=false;if(S2.UI.FOCUSABLE_ELEMENTS.include(c)){b=!d.disabled}else{if($w("a area").include(c)){b=d.href||(a&&!isNaN(a))}else{b=a&&!isNaN(a)}}return !!b&&S2.UI.isVisible(d)},findFocusables:function(a){return $(a).descendants().select(S2.UI.isFocusable)},isVisible:function(c){c=$(c);var a=c;while(c&&c.parentNode){var d=c.getStyle("display"),b=c.getStyle("visibility");if(d==="none"||b==="hidden"){return false}c=$(c.parentNode)}return true},makeVisible:function(c,e){if(Object.isElement(c)){c=[c]}var d=e?"visible":"hidden";for(var b=0,a;a=c[b];b++){a.setStyle({visibility:d})}return c},modifierUsed:function(a){return a.metaKey||a.ctrlKey||a.altKey}});(function(){var a=[];function b(f){var d=Event.element(f);if(!d){return}for(var c=0,e;e=a[c];c++){if(d===e||d.descendantOf(e)){Event.stop(f);break}}}if(document.attachEvent){document.onselectstart=b.bindAsEventListener(window)}else{document.observe("mousedown",b)}Object.extend(S2.UI,{enableTextSelection:function(c){c.setStyle({"-moz-user-select":"","-webkit-user-select":""});a=a.without(c);return c},disableTextSelection:function(c){c.setStyle({"-moz-user-select":"none","-webkit-user-select":"none"});if(!a.include(c)){a.push(c)}return c}})})();S2.UI.Behavior=Class.create(S2.UI.Mixin.Configurable,{initialize:function(e,d){this.element=e;this.setOptions(d);Object.extend(this,d);this._observers={};function c(h){return h.startsWith("on")||h.include("/on")}var g,e,b,f;for(var a in this){if(!c(a)){continue}g=a.split("/");if(g.length===2){e=this[g.first()]||this.element}else{e=this.element}b=g.last();f=this._observers[b]=this[a].bind(this);e.observe(b.substring(2),f)}},destroy:function(){var b=this.options.proxy||this.element;var c;for(var a in this._observers){c=this._observers[a];b.stopObserving(a.substring(2),c)}}});Object.extend(S2.UI,{addBehavior:function(f,c,e){var d=arguments.callee;if(Object.isArray(f)){f.each(function(g){d(g,c,e)});return}if(Object.isArray(c)){c.each(function(g){d(f,g,e)});return}var b=new c(f,e||{});var a=$(f).retrieve("ui.behaviors",[]);a.push(b)},removeBehavior:function(e,b){var c=arguments.callee;if(Object.isArray(e)){e.each(function(h){c(h,b)});return}if(Object.isArray(b)){b.each(function(h){c(e,h)});return}var a=$(e).retrieve("ui.behaviors",[]);var g=[];for(var d=0,f;f=a[d];d++){if(!f instanceof b){continue}f.destroy();g.push(f)}$(e).store("ui.behaviors",a.without(g))},getBehavior:function(g,e){g=$(g);var c=g.retrieve("ui.behaviors",[]);for(var f=0,d=c.length,a;f<d;f++){a=c[f];if(a.constructor===e){return a}}return null}});S2.UI.Behavior.Drag=Class.create(S2.UI.Behavior,{initialize:function($super,b,a){this.__onmousemove=this._onmousemove.bind(this);$super(b,a);this.element.addClassName("ui-draggable")},destroy:function($super){this.element.removeClassName("ui-draggable");$super()},"handle/onmousedown":function(b){var a=this.element;this._startPointer=b.pointer();this._startPosition={left:window.parseInt(a.getStyle("left"),10),top:window.parseInt(a.getStyle("top"),10)};document.observe("mousemove",this.__onmousemove)},"handle/onmouseup":function(a){this._startPointer=null;this._startPosition=null;document.stopObserving("mousemove",this.__onmousemove)},_onmousemove:function(b){var c=b.pointer();if(!this._startPointer){return}var d={x:c.x-this._startPointer.x,y:c.y-this._startPointer.y};var a={left:(this._startPosition.left+d.x)+"px",top:(this._startPosition.top+d.y)+"px"};this.element.setStyle(a)}});S2.UI.Behavior.Focus=Class.create(S2.UI.Behavior,{onfocus:function(a){if(this.element.hasClassName("ui-state-disabled")){return}this.element.addClassName("ui-state-focus")},onblur:function(a){if(this.element.hasClassName("ui-state-disabled")){return}this.element.removeClassName("ui-state-focus")}});S2.UI.Behavior.Hover=Class.create(S2.UI.Behavior,{onmouseenter:function(a){if(this.element.hasClassName("ui-state-disabled")){return}this.element.addClassName("ui-state-hover")},onmouseleave:function(a){if(this.element.hasClassName("ui-state-disabled")){return}this.element.removeClassName("ui-state-hover")}});S2.UI.Behavior.Resize=Class.create(S2.UI.Behavior,{initialize:function(b,a){}});S2.UI.Behavior.Down=Class.create(S2.UI.Behavior,{onmousedown:function(a){this._down=true;if(this.element.hasClassName("ui-state-disabled")){return}this.element.addClassName("ui-state-down")},onmouseup:function(a){this._down=false;if(this.element.hasClassName("ui-state-disabled")){return}this.element.removeClassName("ui-state-down")},onmouseleave:function(a){return this.onmouseup(a)},onmouseenter:function(a){if(this._down){return this.onmousedown(a)}}});(function(a){a.Base=Class.create(a.Mixin.Configurable,{NAME:"S2.UI.Base",addObservers:Function.ABSTRACT,removeObservers:Function.ABSTRACT,destroy:function(){this.removeObservers()},toElement:function(){return this.element},inspect:function(){return"#<#{NAME}>".interpolate(this)}})})(S2.UI);Object.extend(Event,{KEY_SPACE:32});(function(a){a.Accordion=Class.create(a.Base,{NAME:"S2.UI.Accordion",initialize:function(f,d){this.element=$(f);var e=this.setOptions(d);a.addClassNames(this.element,"ui-accordion ui-widget ui-helper-reset");if(this.element.nodeName.toUpperCase()==="UL"){var c=this.element.childElements().grep(new Selector("li"));a.addClassNames(c,"ui-accordion-li-fix")}this.headers=this.element.select(e.headerSelector);if(!this.headers||this.headers.length===0){return}a.addClassNames(this.headers,"ui-accordion-header ui-helper-reset ui-state-default ui-corner-all");a.addBehavior(this.headers,[a.Behavior.Hover,a.Behavior.Focus]);this.content=this.headers.map(function(g){return g.next()});a.addClassNames(this.content,"ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");this.headers.each(function(h){var g=new Element("span");a.addClassNames(g,"ui-icon "+e.icons.header);h.insert({top:g})});this._markActive(e.active||this.headers.first(),false);this.element.writeAttribute({role:"tablist","aria-multiselectable":e.multiple.toString()});this.headers.invoke("writeAttribute","role","tab");this.content.invoke("writeAttribute","role","tabpanel");var b=this.headers.map(function(g){return g.down("a")});b.invoke("observe","click",function(g){g.preventDefault()});this.observers={click:this.click.bind(this),keypress:this.keypress.bind(this)};this.addObservers()},addObservers:function(){this.headers.invoke("observe","click",this.observers.click);if(Prototype.Browser.WebKit){this.headers.invoke("observe","keydown",this.observers.keypress)}else{this.headers.invoke("observe","keypress",this.observers.keypress)}},click:function(b){var c=b.findElement(this.options.headerSelector);if(!c||!this.headers.include(c)){return}this._toggleActive(c)},keypress:function(b){if(b.shiftKey||b.metaKey||b.altKey||b.ctrlKey){return}var d=b.findElement(this.options.headerSelector);var c=(b.keyCode===0)?b.charCode:b.keyCode;switch(c){case Event.KEY_SPACE:this._toggleActive(d);b.stop();return;case Event.KEY_DOWN:case Event.KEY_RIGHT:this._focusHeader(d,1);b.stop();return;case Event.KEY_UP:case Event.KEY_LEFT:this._focusHeader(d,-1);b.stop();return;case Event.KEY_HOME:this._focusHeader(this.headers.first());b.stop();return;case Event.KEY_END:this._focusHeader(this.headers.last());b.stop();return}},_focusHeader:function(d,c){if(Object.isNumber(c)){var b=this.headers.indexOf(d);b=b+c;if(b>(this.headers.length-1)){b=this.headers.length-1}else{if(b<0){b=0}}d=this.headers[b]}(function(){d.down("a").focus()}).defer()},_toggleActive:function(b){if(b.hasClassName("ui-state-active")){if(!this.options.multiple){return}this._removeActive(b);this._activatePanel(null,b.next(),true)}else{this._markActive(b)}},_removeActive:function(d){var b=this.options;a.removeClassNames(d,"ui-state-active ui-corner-top");a.addClassNames(d,"ui-state-default ui-corner-all");d.writeAttribute("aria-expanded","false");var c=d.down(".ui-icon");c.removeClassName(b.icons.headerSelected);c.addClassName(b.icons.header)},_markActive:function(e,c){if(Object.isUndefined(c)){c=true}var b=this.options;var f=null;if(!b.multiple){f=this.element.down(".ui-accordion-content-active");this.headers.each(this._removeActive.bind(this))}if(!e){return}a.removeClassNames(e,"ui-state-default ui-corner-all");a.addClassNames(e,"ui-state-active ui-corner-top");e.writeAttribute("aria-expanded","true");this._activatePanel(e.next(),f,c);var d=e.down(".ui-icon");d.removeClassName(b.icons.header);d.addClassName(b.icons.headerSelected);return e},_activatePanel:function(b,d,c){if(c){this.options.transition(b,d)}else{if(d){d.removeClassName("ui-accordion-content-active")}if(b){b.addClassName("ui-accordion-content-active")}}}});Object.extend(a.Accordion,{DEFAULT_OPTIONS:{multiple:false,headerSelector:"h3",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},transition:function(b,e){var d=[],c;if(e){c=new S2.FX.SlideUp(e,{duration:0.2,after:function(){e.removeClassName("ui-accordion-content-active")}});d.push(c)}if(b){c=new S2.FX.SlideDown(b,{duration:0.2,before:function(){b.addClassName("ui-accordion-content-active")}});d.push(c)}d.invoke("play")}}})})(S2.UI);(function(a){a.Button=Class.create(a.Base,{NAME:"S2.UI.Button",initialize:function(e,c){this.element=$(e);this.element.store("ui.button",this);var d=this.setOptions(c);a.addClassNames(this.element,"ui-state-default ui-corner-all");a.addBehavior(this.element,[a.Behavior.Hover,a.Behavior.Focus,a.Behavior.Down]);if(d.primary){this.element.addClassName("ui-priority-primary")}this.element.writeAttribute("role","button");this.enabled=true;var b=(this.element.disabled===true)||!this.element.hasClassName("ui-state-disabled");this.setEnabled(b)},setEnabled:function(b){if(this.enabled===b){return}this.enabled=b;if(b){this.element.removeClassName("ui-state-disabled")}else{this.element.addClassName("ui-state-disabled")}this.element.disabled=!b},toElement:function(){return this.element},toHTML:function(){return this.element.toHTML()},toString:function(){return this.element.toHTML()},inspect:function(){return this.element.inspect()}});Object.extend(a.Button,{DEFAULT_OPTIONS:{primary:false}})})(S2.UI);(function(a){a.Tabs=Class.create(a.Base,{NAME:"S2.UI.Tabs",initialize:function(f,d){this.element=$(f);a.addClassNames(this.element,"ui-widget ui-widget-content ui-tabs ui-corner-all");this.setOptions(d);var e=this.options;this.anchors=[];this.panels=[];this.list=this.element.down("ul");this.list.cleanWhitespace();this.nav=this.list;a.addClassNames(this.nav,"ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.tabs=this.list.select("li");a.addClassNames(this.tabs,"ui-state-default ui-corner-top");a.addBehavior(this.tabs,[a.Behavior.Hover,a.Behavior.Down]);this.element.writeAttribute({role:"tablist","aria-multiselectable":"false"});this.tabs.each(function(h){var l=h.down("a");if(!l){return}var j=l.readAttribute("href");if(!j.include("#")){return}var m=j.split("#").last(),i=$(m);h.writeAttribute("tabIndex","0");if(i){i.store("ui.tab",h);h.store("ui.panel",i);this.anchors.push(l);this.panels.push(i)}},this);this.anchors.invoke("writeAttribute","role","tab");this.panels.invoke("writeAttribute","role","tabpanel");this.tabs.first().addClassName("ui-position-first");this.tabs.last().addClassName("ui-position-last");a.addClassNames(this.panels,"ui-tabs-panel ui-tabs-hide ui-widget-content ui-corner-bottom");this.observers={onKeyPress:this.onKeyPress.bind(this),onTabClick:this.onTabClick.bind(this)};this.addObservers();var c;var b=window.location.hash.substring(1),g;if(!b.empty()){g=$(b)}if(g&&this.panels.include(g)){c=g.retrieve("ui.tab")}else{c=e.selectedTab?$(e.selectedTab):this.tabs.first()}this.setSelectedTab(c)},addObservers:function(){this.anchors.invoke("observe","click",this.observers.onTabClick);this.tabs.invoke("observe","keypress",this.observers.onKeyPress)},_setSelected:function(f){var b=$(f),c=b.retrieve("ui.tab");var e=this.list.down(".ui-tabs-selected");var d=e?e.retrieve("ui.panel"):null;a.removeClassNames(this.tabs,"ui-tabs-selected ui-state-active");a.addClassNames(this.tabs,"ui-state-default");c.removeClassName("ui-state-default").addClassName("ui-tabs-selected ui-state-active");this.element.fire("ui:tabs:change",{from:{tab:e,panel:d},to:{tab:c,panel:b}});this.options.panel.transition(d,b)},setSelectedTab:function(b){this.setSelectedPanel(b.retrieve("ui.panel"))},setSelectedPanel:function(b){this._setSelected(b.readAttribute("id"))},onTabClick:function(d){d.stop();var b=d.findElement("a"),c=d.findElement("li");this.setSelectedTab(c)},onKeyPress:function(c){if(a.modifierUsed(c)){return}var b=c.findElement("li");var d=c.keyCode||c.charCode;switch(d){case Event.KEY_SPACE:case Event.KEY_RETURN:this.setSelectedTab(b);c.stop();return;case Event.KEY_UP:case Event.KEY_LEFT:this._focusTab(b,-1);return;case Event.KEY_DOWN:case Event.KEY_RIGHT:this._focusTab(b,1);return}},_focusTab:function(c,d){if(Object.isNumber(d)){var b=this.tabs.indexOf(c);b=b+d;if(b>(this.tabs.length-1)){b=this.tabs.length-1}else{if(b<0){b=0}}c=this.tabs[b]}(function(){c.focus()}).defer()}});Object.extend(a.Tabs,{DEFAULT_OPTIONS:{panel:{transition:function(c,b){if(c){c.addClassName("ui-tabs-hide")}b.removeClassName("ui-tabs-hide")}}}})})(S2.UI);(function(a){a.Overlay=Class.create(a.Base,a.Mixin.Trackable,a.Mixin.Shim,{NAME:"S2.UI.Overlay",initialize:function(b){this.setOptions(b);this.element=new Element("div",{"class":"ui-widget-overlay"});this.register();this.createShim();this.adjustShim();this.constructor.onResize()},destroy:function(){this.element.remove();this.unregister()},toElement:function(){return this.element}});Object.extend(a.Overlay,{onRegister:function(){if(this.instances.length!==1){return}this._resizeObserver=this._resizeObserver||this.onResize.bind(this);Event.observe(window,"resize",this._resizeObserver);Event.observe(window,"scroll",this._resizeObserver)},onUnregister:function(){if(this.instances.length!==0){return}Event.stopObserving(window,"resize",this._resizeObserver);Event.stopObserving(window,"scroll",this._resizeObserver)},onResize:function(){var b=document.viewport.getDimensions();var c=document.viewport.getScrollOffsets();this.instances.each(function(d){var e=d.element;e.setStyle({width:b.width+"px",height:b.height+"px",left:c.left+"px",top:c.top+"px"})});(function(){this.instances.invoke("adjustShim")}).bind(this).defer()}})})(S2.UI);(function(a){a.Dialog=Class.create(a.Base,{NAME:"S2.UI.Dialog",initialize:function(d,b){if(!Object.isElement(d)){b=d;d=null}else{d=$(d)}var c=this.setOptions(b);this.element=d||new Element("div");a.addClassNames(this.element,"ui-dialog ui-widget ui-widget-content ui-corner-all");this.element.hide().setStyle({position:"absolute",overflow:"hidden",zIndex:c.zIndex,outline:"0"});this.element.writeAttribute({tabIndex:"-1",role:"dialog"});if(c.content){this.content=Object.isElement(c.content)?c.content:new Element("div").update(c.content)}else{this.content=new Element("div")}a.addClassNames(this.content,"ui-dialog-content ui-widget-content");this.element.insert(this.content);this.titleBar=this.options.titleBar||new Element("div");a.addClassNames(this.titleBar,"ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix");this.element.insert({top:this.titleBar});this.closeButton=new Element("a",{href:"#"});a.addClassNames(this.closeButton,"ui-dialog-titlebar-close ui-corner-all");new a.Button(this.closeButton);this.closeButton.observe("mousedown",Event.stop);this.closeButton.observe("click",function(f){f.stop();this.close(false)}.bind(this));this.titleBar.insert(this.closeButton);this.closeText=new Element("span");a.addClassNames(this.closeText,"ui-icon ui-icon-closethick");this.closeButton.insert(this.closeText);this.titleText=new Element("span",{"class":"ui-dialog-title"});this.titleText.update(this.options.title).identify();this.element.writeAttribute("aria-labelledby",this.titleText.readAttribute("id"));this.titleBar.insert({top:this.titleText});a.disableTextSelection(this.element);if(this.options.draggable){a.addBehavior(this.element,a.Behavior.Drag,{handle:this.titleBar})}var e=this.options.buttons;if(e&&e.length){this._createButtons()}this.observers={keypress:this.keypress.bind(this)}},toElement:function(){return this.element},_createButtons:function(){var b=this.options.buttons;if(this.buttonPane){this.buttonPane.remove()}this.buttonPane=new Element("div");a.addClassNames(this.buttonPane,"ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");b.each(function(d){var c=new Element("button",{type:"button"});a.addClassNames(c,"ui-state-default ui-corner-all");if(d.primary){c.addClassName("ui-priority-primary")}if(d.secondary){c.addClassName("ui-priority-secondary")}c.update(d.label);new a.Button(c);c.observe("click",d.action.bind(this,this));this.buttonPane.insert(c)},this);this.element.insert(this.buttonPane)},_position:function(){var d=document.viewport.getDimensions();var c=this.element;var f={width:parseInt(c.getStyle("width"),10),height:parseInt(c.getStyle("height"),10)};var b={left:((d.width/2)-(f.width/2)).round(),top:((d.height/2)-(f.height/2)).round()};var e=document.viewport.getScrollOffsets();b.left+=e.left;b.top+=e.top;this.element.setStyle({left:b.left+"px",top:b.top+"px"})},open:function(){if(this._isOpen){return}var b=this.element.fire("ui:dialog:before:open",{dialog:this});if(b.stopped){return}var e=this.options;this.overlay=e.modal?new a.Overlay():null;$(document.body).insert(this.overlay);$(document.body).insert(this.element);this.element.show();this._position();this.focusables=a.findFocusables(this.element);if(!e.submitForms){var d=this.content.select("form");d.invoke("observe","submit",Event.stop)}var h=this.focusables.without(this.closeButton);var c=e.focus,i=false;if(c==="first"){h.first().focus();i=true}else{if(c==="last"){h.last().focus();i=true}else{if(Object.isElement(c)){c.focus();i=true}else{if(this.buttonPane){var g=this.buttonPane.down(".ui-priority-primary");if(g){g.focus();i=true}}}}}if(!i&&h.length>0){h.first().focus()}Event.observe(window,"keydown",this.observers.keypress);this._isOpen=true;this.element.fire("ui:dialog:after:open",{dialog:this});return this},close:function(e){e=!!e;var b=this.element.fire("ui:dialog:before:close",{dialog:this});if(b.stopped){return}if(this.overlay){this.overlay.destroy()}this.element.hide();this._isOpen=false;Event.stopObserving(window,"keydown",this.observers.keypress);var c={dialog:this,success:e};var d=this.content.down("form");if(d){Object.extend(c,{form:d.serialize({hash:true})})}this.element.fire("ui:dialog:after:close",c);a.enableTextSelection(this.element,true);return this},keypress:function(e){if(a.modifierUsed(e)){return}var g=this.focusables,c=this.options;if(e.keyCode===Event.KEY_ESC){if(c.closeOnEscape){this.close(false)}return}if(e.keyCode===Event.KEY_RETURN){this.close(true);return}if(e.keyCode===Event.KEY_TAB){if(!this.options.modal){return}if(!g){return}var d,h=e.findElement();var b=g.indexOf(h);if(b===-1){d=g.first()}else{if(e.shiftKey){d=b===0?g.last():g[b-1]}else{d=(b===(g.length-1))?g.first():g[b+1]}}if(d){e.stop();(function(){d.focus()}).defer()}}}});Object.extend(a.Dialog,{DEFAULT_OPTIONS:{zIndex:1000,title:"Dialog",content:null,modal:true,focus:"auto",submitForms:false,closeOnEscape:true,draggable:true,resizable:false,buttons:[{label:"OK",primary:true,action:function(b){b.close(true)}}]}})})(S2.UI);(function(a){a.Slider=Class.create(a.Base,{NAME:"S2.UI.Slider",initialize:function(e,c){this.element=$(e);var d=this.setOptions(c);a.addClassNames(this.element,"ui-slider ui-widget ui-widget-content ui-corner-all");this.orientation=d.orientation;this.element.addClassName("ui-slider-"+this.orientation);this._computeTrackLength();var f=d.value.initial;if(!Object.isArray(f)){f=[f]}this.values=f;this.handles=[];this.values.each(function(j,h){var i=new Element("a",{href:"#"});i.store("ui.slider.handle",h);this.handles.push(i);this.element.insert(i)},this);a.addClassNames(this.handles,"ui-slider-handle ui-state-default ui-corner-all");this.handles.invoke("writeAttribute","tabIndex","0");this.activeHandle=this.handles.first();this.handles.invoke("observe","click",Event.stop);a.addBehavior(this.handles,[a.Behavior.Hover,a.Behavior.Focus]);this.observers={focus:this.focus.bind(this),blur:this.blur.bind(this),keydown:this.keydown.bind(this),keyup:this.keyup.bind(this),mousedown:this.mousedown.bind(this),mouseup:this.mouseup.bind(this),mousemove:this.mousemove.bind(this),rangeMouseDown:this.rangeMouseDown.bind(this),rangeMouseMove:this.rangeMouseMove.bind(this),rangeMouseUp:this.rangeMouseUp.bind(this)};var b=d.value;if(b.step!==null){this._possibleValues=[];for(var g=b.min;g<b.max;g+=b.step){this._possibleValues.push(g)}this._possibleValues.push(b.max);this.keyboardStep=b.step}else{if(d.possibleValues){this._possibleValues=d.possibleValues.clone();this.keyboardStep=null}else{this.keyboardStep=(b.max-b.min)/100}}this.range=null;if(d.range&&this.values.length===2){this.restricted=true;this.range=new Element("div",{"class":"ui-slider-range"});this.element.insert(this.range);this.range.addClassName("ui-widget-header")}this._computeTrackLength();this._computeHandleLength();this.active=false;this.dragging=false;this.disabled=false;this.addObservers();this.values.each(this.setValue,this);this.initialized=true},addObservers:function(){this.element.observe("mousedown",this.observers.mousedown);if(this.range){this.range.observe("mousedown",this.observers.rangeMouseDown)}this.handles.invoke("observe","keydown",this.observers.keydown);this.handles.invoke("observe","keyup",this.observers.keyup)},_computeTrackLength:function(){var b,c;if(this.orientation==="vertical"){c=this.element.offsetHeight;b=(c!==0)?c:window.parseInt(this.element.getStyle("height"),10)}else{c=this.element.offsetWidth;b=(c!==0)?c:window.parseInt(this.element.getStyle("width"),10)}this._trackLength=b;return b},_computeHandleLength:function(){var c=this.handles.first(),b,d;if(!c){return}if(this.orientation==="vertical"){d=c.offsetHeight;b=(d!==0)?d:window.parseInt(c.getStyle("height"),10)}else{d=c.offsetWidth;b=(d!==0)?d:window.parseInt(c.getStyle("width"),10)}this._handleLength=b;return b},_nextValue:function(c,d){if(this.options.possibleValues){var b=this._possibleValues.indexOf(c);return this._possibleValues[b+d]}else{return c+(this.keyboardStep*d)}},keydown:function(b){if(this.options.disabled){return}var h=b.findElement();var i=h.retrieve("ui.slider.handle");var c=true,e=this.options;if(!Object.isNumber(i)){return}var l=[Event.KEY_HOME,Event.KEY_END,Event.KEY_UP,Event.KEY_DOWN,Event.KEY_LEFT,Event.KEY_RIGHT];if(!l.include(b.keyCode)){return}h.addClassName("ui-state-active");var j,d,g=this.keyboardStep;j=d=this.values[i];switch(b.keyCode){case Event.KEY_HOME:d=e.value.min;break;case Event.KEY_END:d=e.value.max;break;case Event.KEY_UP:case Event.KEY_RIGHT:if(j===e.value.max){return}d=this._nextValue(j,1);break;case Event.KEY_DOWN:case Event.KEY_LEFT:if(j===e.value.min){return}d=this._nextValue(j,-1);break}this.dragging=true;this.setValue(d,i);if(!Prototype.Browser.WebKit){var f=this._timer?0.1:1;this._timer=arguments.callee.bind(this).delay(f,b)}if(!c){b.stop()}},keyup:function(b){this.dragging=false;if(this._timer){window.clearTimeout(this._timer);this._timer=null}this._updateFinished();var c=b.findElement();c.removeClassName("ui-state-active")},setValue:function(c,e){if(!this.activeHandle){this.activeHandle=this.handles[e||0];this._updateStyles()}e=e||this.activeHandle.retrieve("ui.slider.handle")||0;if(this.initialized&&this.restricted){if(e>0&&c<this.values[e-1]){c=this.values[e-1]}if(e<(this.handles.length-1)&&(c>this.values[e+1])){c=this.values[e+1]}}c=this._getNearestValue(c);this.values[e]=c;var d=(this.orientation==="vertical")?"top":"left";var b={};b[d]=this._valueToPx(c)+"px";this.handles[e].setStyle(b);this._drawRange();if(!this.dragging&&!this.undoing&&!this.initialized){this._updateFinished()}if(this.initialized){this.element.fire("ui:slider:value:changing",{slider:this,values:this.values});this.options.onSlide(this.values,this)}return this},_getNearestValue:function(e){var b=this.options.value;if(e<b.min){e=b.min}if(e>b.max){e=b.max}if(this._possibleValues){var f,d;for(var c=0;c<this._possibleValues.length;c++){d=this._possibleValues[c];if(d===e){return e}if(d>e){break}}f=this._possibleValues[c-1];e=e.nearer(f,d)}return e},_valueToPx:function(c){var b=this.options.value;var d=(this._trackLength-(this._handleLength/2))/(b.max-b.min);d*=(c-b.min);if(this.orientation==="vertical"){d=(this._trackLength-d)-this._handleLength}else{}return Math.round(d)},mousedown:function(f){var e=this.options;if(!f.isLeftClick()||e.disabled){return}f.stop();this._oldValues=this.values.clone();this.active=true;var g=f.findElement();var h=f.pointer();if(g===this.element){var c=this.element.cumulativeOffset();var d={x:Math.round((h.x-c.left)+(this._handleLength/4)),y:Math.round((h.y-c.top)+(this._handleLength/4))};this.setValue(this._pxToValue(d));this.activeHandle=this.activeHandle||this.handles.first();handle=this.activeHandle;this._updateStyles()}else{handle=f.findElement(".ui-slider-handle");if(!handle){return}this.activeHandle=handle;this._updateStyles()}var b=handle.cumulativeOffset();this._offsets={x:h.x-b.left,y:h.y-b.top};document.observe("mousemove",this.observers.mousemove);document.observe("mouseup",this.observers.mouseup)},mouseup:function(b){if(this.active&&this.dragging){this._updateFinished();b.stop()}this.active=this.dragging=false;this.activeHandle=null;this._updateStyles();document.stopObserving("mousemove",this.observers.mousemove);document.stopObserving("mouseup",this.observers.mouseup)},mousemove:function(b){if(!this.active){return}b.stop();this.dragging=true;this._draw(b);if(Prototype.Browser.WebKit){window.scrollBy(0,0)}},rangeMouseDown:function(d){var e=d.pointer();var b=this.element.cumulativeOffset();var c={x:Math.round(e.x-b.left),y:Math.round(e.y-b.top)};this._rangeInitialValues=this.values.clone();this._rangePseudoValue=this._pxToValue(c);document.observe("mousemove",this.observers.rangeMouseMove);document.observe("mouseup",this.observers.rangeMouseUp)},rangeMouseMove:function(g){this.dragging=true;g.stop();var e=this.options;var i=g.pointer();var c=this.element.cumulativeOffset();var d={x:Math.round(i.x-c.left),y:Math.round(i.y-c.top)};var h=this._pxToValue(d);var f=h-this._rangePseudoValue;var b=this._rangeInitialValues.map(function(j){return j+f});if(b[0]<e.value.min){f=e.value.min-this._rangeInitialValues[0];b=this._rangeInitialValues.map(function(j){return j+f})}else{if(b[1]>e.value.max){f=e.value.max-this._rangeInitialValues[1];b=this._rangeInitialValues.map(function(j){return j+f})}}b.each(this.setValue,this)},rangeMouseUp:function(b){this.dragging=false;document.stopObserving("mousemove",this.observers.rangeMouseMove);document.stopObserving("mouseup",this.observers.rangeMouseUp);this._updateFinished()},_draw:function(d){var e=d.pointer();var b=this.element.cumulativeOffset();var c={x:Math.round((e.x-b.left)+(this._handleLength/4)),y:Math.round((e.y-b.top)+(this._handleLength/4))};e.x-=(this._offsets.x+b.left);e.y-=(this._offsets.y+b.top);this.setValue(this._pxToValue(e))},_pxToValue:function(c){var b=this.options;var e=(this.orientation==="horizontal")?c.x:c.y;var d=((e/(this._trackLength-this._handleLength)*(b.value.max-b.value.min))+b.value.min);if(this.orientation==="vertical"){d=b.value.max-(d-b.value.min)}return d},undo:function(){if(!this._oldValues){return}this.values=this._oldValues.clone();this.undoing=true;this._oldValues.each(this.setValue,this);this.undoing=false},_updateFinished:function(){var b=this.element.fire("ui:slider:value:changed",{slider:this,values:this.values});if(b.stopped){this.undo();return}this.activeHandle=null;this._updateStyles();this.options.onChange(this.values,this)},_updateStyles:function(){a.removeClassNames(this.handles,"ui-state-active");if(this.activeHandle){this.activeHandle.addClassName("ui-state-active")}},_drawRange:function(){if(!this.range){return}var b=this.values,c=b.map(this._valueToPx,this);if(this.orientation==="vertical"){this.range.setStyle({top:c[1]+"px",height:(c[0]-c[1])+"px"})}else{this.range.setStyle({left:c[0]+"px",width:(c[1]-c[0])+"px"})}},focus:function(b){if(this.options.disabled){return}var c=b.findElement();this.element.select(".ui-state-focus").invoke("removeClassName","ui-state-focus");c.addClassName("ui-state-focus")},blur:function(b){b.findElement().removeClassName("ui-state-focus")}});Object.extend(a.Slider,{DEFAULT_OPTIONS:{range:false,disabled:false,value:{min:0,max:100,initial:0,step:null},possibleValues:null,orientation:"horizontal",onSlide:Prototype.emptyFunction,onChange:Prototype.emptyFunction}})})(S2.UI);(function(a){a.ProgressBar=Class.create(a.Base,{NAME:"S2.UI.ProgressBar",initialize:function(d,b){this.element=$(d);var c=this.setOptions(b);a.addClassNames(this.element,"ui-progressbar ui-widget ui-widget-content ui-corner-all");this.element.writeAttribute({role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0});this.valueElement=new Element("div",{"class":"ui-progressbar-value ui-widget-header ui-corner-left"});this.value=c.value.initial;this._refreshValue();this.element.insert(this.valueElement);this.element.store(this.NAME,this)},destroy:function(){a.removeClassNames(this.element,"ui-progressbar ui-widget ui-widget-content ui-corner-all");a.removeAttributes(this.element,"role aria-valuemin aria-valuemax aria-valuenow");this.element.getData().unset(this.NAME)},getValue:function(){var c=this.value,b=this.options.value;if(c<b.min){c=b.min}if(c>b.max){c=b.max}return c},setValue:function(b){this._oldValue=this.getValue();this.value=b;this._refreshValue();return this},undo:function(){this.undoing=true;this.setValue(this._oldValue);this.undoing=false;return this},_refreshValue:function(){var f=this.getValue();if(!this.undoing){var b=this.element.fire("ui:progressbar:value:changed",{progressBar:this,value:f});if(b.stopped){this.undo();return}}if(f===this.options.value.max){this.valueElement.addClassName("ui-corner-right")}else{this.valueElement.removeClassName("ui-corner-right")}var d=window.parseInt(this.element.getStyle("width"),10);var e=(d*f)/100;var c="width: #{0}px".interpolate([e]);a.makeVisible(this.valueElement,(f>this.options.value.min));this.valueElement.morph(c,{duration:0.7,transition:"linear"});this.element.writeAttribute("aria-valuenow",f)}});Object.extend(a.ProgressBar,{DEFAULT_OPTIONS:{value:{min:0,max:100,initial:0}}})})(S2.UI);(function(a){a.Menu=Class.create(a.Base,a.Mixin.Shim,{NAME:"S2.UI.Menu",initialize:function(d,b){this.element=$(d);if(!this.element){var b=d;this.element=new Element("ul",{"class":"ui-helper-hidden"})}this.activeId=this.element.identify()+"_active";var c=this.setOptions();a.addClassNames(this.element,"ui-widget ui-widget-content ui-menu ui-corner-"+c.corner);this.choices=this.element.select("li");this._highlightedIndex=-1;this.element.writeAttribute({role:"menu","aria-activedescendant":this.activeId});this.choices.invoke("writeAttribute","role","menuitem");this.observers={mouseover:this._mouseover.bind(this),click:this._click.bind(this)};this.addObservers();this._shown=false;this.createShim()},addObservers:function(){this.element.observe("mouseover",this.observers.mouseover);this.element.observe("mousedown",this.observers.click)},removeObservers:function(){this.element.stopObserving("mouseover",this.observers.mouseover);this.element.stopObserving("mousedown",this.observers.click)},clear:function(){this.element.select("li").invoke("remove");this.choices=[];return this},addChoice:function(c){var b;if(Object.isElement(c)){if(c.tagName.toUpperCase()==="LI"){b=c}else{b=new Element("li");b.insert(c)}}else{b=new Element("li");b.update(c)}b.addClassName("ui-menu-item");b.writeAttribute("role","menuitem");this.element.insert(b);this.choices=this.element.select("li");return b},_mouseover:function(c){var b=c.findElement("li");if(!b){return}this.highlightChoice(b)},_click:function(c){var b=c.findElement("li");if(!b){return}this.selectChoice(b)},moveHighlight:function(b){this._highlightedIndex=(this._highlightedIndex+b).constrain(-1,this.choices.length-1);this.highlightChoice();return this},highlightChoice:function(c){var e=this.choices,b;if(Object.isElement(c)){b=e.indexOf(c)}else{if(Object.isNumber(c)){b=c}else{b=this._highlightedIndex}}a.removeClassNames(this.choices,"ui-state-active");if(b===-1){return}this.choices[b].addClassName("ui-state-active");this._highlightedIndex=b;var d=this.element.down("#"+this.activeId);if(d){d.writeAttribute("id","")}this.choices[b].writeAttribute("id",this.activeId)},selectChoice:function(c){var c;if(Object.isNumber(c)){c=this.choices[c]}else{if(!c){c=this.choices[this._highlightedIndex]}}var b=this.element.fire("ui:menu:selected",{instance:this,element:c});if(!b.stopped){this.close()}return this},open:function(){var b=this.element.fire("ui:menu:opened",{instance:this});this.element.removeClassName("ui-helper-hidden");this._highlightedIndex=-1;if(Prototype.Browser.IE){this.adjustShim()}},close:function(){var b=this.element.fire("ui:menu:closed",{instance:this});this.element.addClassName("ui-helper-hidden");return this},isOpen:function(){return !this.element.hasClassName("ui-helper-hidden")}});Object.extend(a.Menu,{DEFAULT_OPTIONS:{corner:"all"}})})(S2.UI);(function(a){a.Autocompleter=Class.create(a.Base,{NAME:"S2.UI.Autocompleter",initialize:function(d,b){this.element=$(d);var c=this.setOptions(b);a.addClassNames(this.element,"ui-widget ui-autocompleter");this.input=this.element.down('input[type="text"]');if(!this.input){this.input=new Element("input",{type:"text"});this.element.insert(this.input)}this.input.insert({before:this.button});this.input.setAttribute("autocomplete","off");this.name=c.parameterName||this.input.readAttribute("name");if(c.choices){this.choices=c.choices.clone()}this.menu=new a.Menu();this.element.insert(this.menu.element);(function(){var e=this.input.getLayout();this.menu.element.setStyle({left:e.get("left")+"px",top:(e.get("top")+e.get("margin-box-height"))+"px"})}).bind(this).defer();this.observers={blur:this._blur.bind(this),keyup:this._keyup.bind(this),keydown:this._keydown.bind(this),selected:this._selected.bind(this)};this.addObservers()},addObservers:function(){this.input.observe("blur",this.observers.blur);this.input.observe("keyup",this.observers.keyup);this.input.observe("keydown",this.observers.keydown);this.menu.element.observe("ui:menu:selected",this.observers.selected)},_schedule:function(){this._unschedule();this._timeout=this._change.bind(this).delay(this.options.frequency)},_unschedule:function(){if(this._timeout){window.clearTimeout(this._timeout)}},_keyup:function(b){var c=this.input.getValue();if(c){if(c.blank()||c.length<this.options.minCharacters){this.menu.close();this._unschedule();return}if(c!==this._value){this._schedule()}}else{this.menu.close();this._unschedule()}this._value=c},_keydown:function(b){if(a.modifierUsed(b)){return}if(!this.menu.isOpen()){return}var c=b.keyCode||b.charCode;switch(b.keyCode){case Event.KEY_UP:this.menu.moveHighlight(-1);b.stop();break;case Event.KEY_DOWN:this.menu.moveHighlight(1);b.stop();break;case Event.KEY_TAB:this.menu.selectChoice();break;case Event.KEY_RETURN:this.menu.selectChoice();this.input.blur();b.stop();break;case Event.KEY_ESC:this.input.setValue("");this.input.blur();break}},_getInput:function(){return this.input.getValue()},_setInput:function(b){this.input.setValue(b)},_change:function(){this.findChoices()},findChoices:function(){var c=this._getInput();var d=this.choices||[];var b=d.inject([],function(f,e){if(e.toLowerCase().include(c.toLowerCase())){f.push(e)}return f});this.setChoices(b)},setChoices:function(b){this.results=b;this._updateMenu(b)},_updateMenu:function(f){var e=this.options;this.menu.clear();var g=new RegExp(RegExp.escape(this._value),"i");for(var d=0,c,b,h;c=f[d];d++){h=e.highlightSubstring?c.replace(g,"<b>$&</b>"):h;b=new Element("li").update(h);b.store("ui.autocompleter.value",c);this.menu.addChoice(b)}if(f.length===0){this.menu.close()}else{this.menu.open()}},_moveMenuChoice:function(c){var b=this.list.down("li");this._selectedIndex=(this._selectedIndex+c).constrain(-1,this.results.length-1);this._highlightMenuChoice()},_highlightMenuChoice:function(c){var d=this.list.select("li"),b;if(Object.isElement(c)){b=d.indexOf(c)}else{if(Object.isNumber(c)){b=c}else{b=this._selectedIndex}}a.removeClassNames(d,"ui-state-active");if(b===-1||b===null){return}d[b].addClassName("ui-state-active");this._selectedIndex=b},_selected:function(d){var c=d.memo,b=c.element;if(b){this._setInput(b.retrieve("ui.autocompleter.value"))}this.menu.close()},_blur:function(b){this._unschedule();this.menu.close()}});Object.extend(a.Autocompleter,{DEFAULT_OPTIONS:{tokens:[],frequency:0.4,minCharacters:1,highlightSubstring:true,onShow:Prototype.K,onHide:Prototype.K}})})(S2.UI);document.observe("dom:loaded",function(){if(!S2.enableMultitouchSupport){return}var h=$(document.body),i=0;function f(b){b._rotation=b._rotation||0;b._scale=b._scale||1;b._panX=b._panX||0;b._panY=b._panY||0;b._pans=[[0,0],[0,0],[0,0]];b._panidx=1}function c(n,m,o,e,b){n._rotation=m;n._scale=o;n._panX=e;n._panY=b}function j(b,e){b.fire("manipulate:update",Object.extend(e,{id:i}))}function g(){var n,z,e,p={},s=null,q=null,b=0,u,r,o,m,x,y;function w(C){var B=C.length;while(B--){p[C[B].identifier]=C[B]}var A=[];for(k in p){A.push(k)}A=A.sort();s=A.length>0?A[0]:null;n=s?p[s].target:null;if(n&&n.nodeType==3){n=n.parentNode}q=A.length>1?A[1]:null;if(b==0&&(s&&q)){o=(p[s].pageX-p[q].pageX).abs();m=(p[s].pageY-p[q].pageY).abs();if(n){f(n)}x=Math.sqrt(o*o+m*m);y=Math.atan2(p[q].pageY-p[s].pageY,p[q].pageX-p[s].pageX);b=1;return}if(b==1&&!(s&&q)){if(n){c(n,z,e)}b=0}}function v(){var A=0;for(k in p){A++}return A}h.observe("touchstart",function(B){var A=s,C;w(B.changedTouches);if(A==null&&s){C=n.viewportOffset();u=C.left+(p[s].pageX-C.left),r=C.top+(p[s].pageY-C.top)}B.stop()});h.observe("touchmove",function(C){w(C.changedTouches);if(s&&!q){j(n,{panX:(n._panX||0)+p[s].pageX-u,panY:(n._panY||0)+p[s].pageY-r,scale:n._scale,rotation:n._rotation});C.stop();return}if(!(s&&q)){return}var B=p[q].pageX-p[s].pageX,A=p[q].pageY-p[s].pageY,F=(n._panX||0)+p[q].pageX-B/2-u,D=(n._panY||0)+p[q].pageY-A/2-r,E=Math.sqrt(B*B+A*A);e=n._scale*E/x;z=n._rotation+Math.atan2(A,B)-y;j(n,{rotation:z,scale:e,panX:F,panY:D});C.stop()});["touchcancel","touchend"].each(function(A){h.observe(A,function(C){var B=C.changedTouches.length;while(B--){delete (p[C.changedTouches[B].identifier])}w([]);if(n){c(n,z,e)}})})}function l(){var n,m,p,e,b,o=false;h.observe("manipulatestart",function(q){q.stop();n=q.element();f(n);o=true});h.observe("manipulatemove",function(q){n=q.element();m=n._rotation+q.rotation;p=n._scale*q.scale;e=n._panX+q.panX;b=n._panY+q.panY;j(n,{rotation:m,scale:p,panX:e,panY:b,clientX:q.clientX,clientY:q.clientY});q.stop()},false);h.observe("manipulateend",function(q){n=q.element();if(n){c(n,m,p,e,b)}o=false;var r=Math.sqrt(q.panSpeedX*q.panSpeedX+q.panSpeedY*q.panSpeedY);if(r>25){n.fire("manipulate:flick",{speed:r,direction:Math.atan2(q.panSpeedY,q.panSpeedX)})}});h.observe("mousemove",function(q){q.stop()});h.observe("mousedown",function(q){q.stop()});h.observe("mouseup",function(q){q.stop()})}function a(){var m,e,o=false,p=true,q,s,v,x,u,r,z,n,b;function y(C){var D=q.viewportOffset(),B=(C.pageX-D.left)-m,A=(C.pageY-D.top)-e;b=Math.sqrt(B*B+A*A);n=q._scale*b/v;z=q._rotation+Math.atan2(A,B)-x;return{rotation:z,scale:n,panX:q._panX,panY:q._panY}}function w(A){return{rotation:q._rotation,scale:q._scale,panX:q._panX+A.pageX-u,panY:q._panY+A.pageY-r}}h.observe("mousedown",function(C){s=C.shiftKey?"scale":"pan";q=C.element();if(!(q&&q.fire)){return}i++;o=true;f(q);var D=q.viewportOffset();m=q.offsetWidth/2;e=q.offsetHeight/2;var B=C.pageX-D.left-m,A=C.pageY-D.top-e;v=Math.sqrt(B*B+A*A);x=Math.atan2(A,B);u=D.left+(C.pageX-D.left),r=D.top+(C.pageY-D.top);C.stop()});h.observe("mousemove",function(A){if(!o){return}j(q,s=="scale"?y(A):w(A))});h.observe("mouseup",function(A){if(!o){return}o=false;if(s=="scale"){var B=y(A);j(q,B);q._rotation=B.rotation;q._scale=B.scale}else{j(q,w(A));q._panX=q._panX+A.pageX-u;q._panY=q._panY+A.pageY-r}});h.observe("dragstart",function(A){A.stop()})}if(navigator.userAgent.match(/SLBrowser/)){return l()}if(navigator.userAgent.match(/QtLauncher/)){return l()}if(navigator.userAgent.match(/Starlight/)){return l()}try{document.createEvent("ManipulateEvent");return l()}catch(d){}try{document.createEvent("TouchEvent");return g()}catch(d){}return a()});Element.__scrollTo=Element.scrollTo;Element.addMethods({scrollTo:function(b,c,a){if(arguments.length==1){return Element.__scrollTo(b)}new S2.FX.Scroll(b,Object.extend(a||{},{to:c})).play();return b}});Element.addMethods({effect:function(b,c,a){if(Object.isFunction(c)){c=new c(b,a)}else{if(Object.isString(c)){c=new S2.FX[c.capitalize()](b,a)}}c.play(b,a);return b},morph:function(b,c,a){a=S2.FX.parseOptions(a);if(!a.queue){a.queue=b.retrieve("S2.FX.Queue");if(!a.queue){b.store("S2.FX.Queue",a.queue=new S2.FX.Queue())}}if(!a.position){a.position="end"}return b.effect("morph",Object.extend(a,{style:c}))}.optionize(),appear:function(b,a){return b.effect("morph",Object.extend({before:function(){b.show().setStyle({opacity:0})},style:"opacity:1"},a))},fade:function(b,a){return b.effect("morph",Object.extend({style:"opacity:0",after:b.hide.bind(b)},a))},cloneWithoutIDs:function(a){a=$(a);var b=a.cloneNode(true);b.id="";$(b).select("*[id]").each(function(c){c.id=""});return b}});(function(){var a;if(window.CSSMatrix){a=function(c,b){c.style.transform="scale("+(b.scale||1)+") rotate("+(b.rotation||0)+"rad)";return c}}else{if(window.WebKitCSSMatrix){a=function(c,b){c.style.webkitTransform="scale("+(b.scale||1)+") rotate("+(b.rotation||0)+"rad)";return c}}else{if(Prototype.Browser.Gecko){a=function(c,b){c.style.MozTransform="scale("+(b.scale||1)+") rotate("+(b.rotation||0)+"rad)";return c}}else{if(Prototype.Browser.IE){a=function(d,b){if(!d._oDims){d._oDims=[d.offsetWidth,d.offsetHeight]}var g=Math.cos(b.rotation||0)*1,f=Math.sin(b.rotation||0)*1,e="progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand',M11="+g+",M12="+(-f)+",M21="+f+",M22="+g+")";d.style.filter=e;d.style.marginLeft=(d._oDims[0]-d.offsetWidth)/2+"px";d.style.marginTop=(d._oDims[1]-d.offsetHeight)/2+"px";return d}}else{a=function(b){return b}}}}}Element.addMethods({transform:a})})();S2.viewportOverlay=function(){var a=document.viewport.getDimensions(),b=document.viewport.getScrollOffsets();return new Element("div").setStyle({position:"absolute",left:b.left+"px",top:b.top+"px",width:a.width+"px",height:a.height+"px"})};S2.FX.Helpers={fitIntoRectangle:function(a,d,g,b){var e=a/d,c=g/b;return e<c?[(g-(a*(b/d)))/2,0,a*(b/d),b]:[0,(b-(d*(g/a)))/2,g,d*(g/a)]}};S2.FX.Operators.Zoom=Class.create(S2.FX.Operators.Style,{initialize:function($super,d,c,b){var a=document.viewport.getDimensions(),e=document.viewport.getScrollOffsets(),h=c.getDimensions(),g=S2.FX.Helpers.fitIntoRectangle(h.width,h.height,a.width-(b.borderWidth||0)*2,a.height-(b.borderWidth||0)*2);Object.extend(b,{style:{left:g[0]+(b.borderWidth||0)+e.left+"px",top:g[1]+(b.borderWidth||0)+e.top+"px",width:g[2]+"px",height:g[3]+"px"}});$super(d,c,b)}});S2.FX.Zoom=Class.create(S2.FX.Element,{setup:function(){this.clone=this.element.cloneWithoutIDs();this.element.insert({before:this.clone});this.clone.absolutize().setStyle({zIndex:9999});this.overlay=S2.viewportOverlay();if(this.options.overlayClassName){this.overlay.addClassName(this.options.overlayClassName)}else{this.overlay.setStyle({backgroundColor:"#000",opacity:"0.9"})}$$("body")[0].insert(this.overlay);this.animate("zoom",this.clone,{borderWidth:this.options.borderWidth,propertyTransitions:this.options.propertyTransitions||{}})},teardown:function(){this.clone.observe("click",function(){this.overlay.remove();this.clone.morph("opacity:0",{duration:0.2,after:function(){this.clone.remove()}.bind(this)})}.bind(this))}});
