/*
 *  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"},VENDOR_MAP:{webkit:{DEFAULT:$w("border-radius box-shadow transform transition transition-duration transition-timing-function transition-property transition-delay border-top-left-radius border-top-right-radius border-bottom-left-radius border-bottom-right-radius")},moz:{DEFAULT:$w("border-radius box-shadow transform transition transition-duration transition-timing-function transition-property transition-delay "),"border-top-left-radius":"-moz-border-radius-topleft","border-top-right-radius":"-moz-border-radius-topright","border-bottom-left-radius":"-moz-border-radius-bottomleft","border-bottom-right-radius":"-moz-border-radius-bottomright"},o:{}},VENDOR_PREFIX:null,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},parse:function(a){return S2.CSS.parseStyle(a)},normalize:function(b,c){if(Object.isHash(c)){c=c.toObject()}if(typeof c==="string"){c=S2.CSS.parseStyle(c)}var a={},e;for(var d in c){e=b.getStyle(d);if(c[d]!==e){a[d]=c[d]}}return a},serialize:function(b){if(Object.isHash(b)){b=b.toObject()}var a="",d;for(var c in b){d=b[c];c=this.vendorizeProperty(c);a+=(c+": "+d+";")}return a},vendorizeProperty:function(c){var b=S2.CSS.VENDOR_PREFIX;c=c.underscore().dasherize();if(b){var a=S2.CSS.VENDOR_MAP[b.toLowerCase()];if(a.DEFAULT.include(c)){c=b+"-"+c}else{if(a[c]){c=a[c]}}}if(c.match(/^(?:webkit|moz|ms|o|khtml)-/)){c="-"+c}return c},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(var 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);(function(){var d=document.createElement("div");var a=d.style,c=$w("webkit Moz");var b=c.detect(function(e){return typeof a[e+"BorderRadius"]!=="undefined"});S2.CSS.VENDOR_PREFIX=b;d=null})();S2.FX=(function(){var c=[],g,f,e=0;function d(i){e+=i;if(e>0){f.start()}else{f.stop()}}function b(){var l=f.getTimestamp();for(var k=0,j;j=c[k];k++){j.render(l)}}function a(i){if(g){return}c.push(g=new S2.FX.Queue());S2.FX.DefaultOptions.queue=g;f=i||new S2.FX.Heartbeat();document.observe("effect:heartbeat",b).observe("effect:queued",d.curry(1)).observe("effect:dequeued",d.curry(-1))}function h(i){if(!i){i=(new Date()).valueOf()}var j=new Date(i);return j.getSeconds()+"."+j.getMilliseconds()+"s"}return{initialize:a,getQueues:function(){return c},addQueue:function(i){c.push(i)},getHeartbeat:function(){return f},setHeartbeat:function(i){f=i},formatTimestamp: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||{}},ready:function(b){var c=this._ready;var a=b._prototypeUID;if(!a){return true}bool=c[a];return Object.isUndefined(bool)?true:bool},setReady:function(c,a){var d=this._ready;var b=c._prototypeUID;if(!b){c.getStorage();b=c._prototypeUID}d[b]=a},_ready:{}});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);this.options=Object.extend(this.options||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.state="idle";this.options.queue.add(this);this.maxFrames=this.options.fps*this.duration/1000;return this},render:function(b){if(this.options.debug){}if(b>=this.startsAt){if(this.state=="idle"&&S2.FX.ready(this.element)){this.debug("starting the effect at "+S2.FX.formatTimestamp(b));this.endsAt=this.startsAt+this.duration;this.start();this.frameCount++;return this}if(b>=this.endsAt&&this.state!=="finished"){this.debug("stopping the effect at "+S2.FX.formatTimestamp(b));this.finish();return this}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},start:function(){if(this.options.before){this.options.before(this)}if(this.setup){this.setup()}this.state="running";this.update(this.options.transition(0))},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(){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,debug:function(a){if(!this.options.debug){return}if(window.console&&console.log){console.log(a)}}});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)}this.operators=[];return $super(a)},update:function(a){for(var c=0,b;b=this.operators[c];c++){b.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 b=this;var e=[];function f(){return e}function h(){return e.length>0}function g(i){c(i);e.push(i);document.fire("effect:queued",b);return b}function a(i){e=e.without(i);document.fire("effect:dequeued",b);delete i;return b}function d(l){for(var j=0,k;k=e[j];j++){k.render(l);if(k.state==="finished"){a(k)}}return b}function c(m){var i=m.options.position||"parallel",l=S2.FX.getHeartbeat().getTimestamp();var j;if(i==="end"){j=e.without(m).pluck("endsAt").max()||l;if(j<l){j=l}}else{j=l}var k=(m.options.delay||0)*1000;m.startsAt=j+k;var n=(m.options.duration||1)*1000;m.endsAt=m.startsAt+n}Object.extend(b,{getEffects:f,active:h,add:g,remove:a,render:d})}})();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,g,a,h){$super(g,a,h);this.element=$(this.object);this.style=Object.isString(this.options.style)?S2.CSS.parseStyle(this.options.style):this.options.style;var b=this.options.propertyTransitions||{};this.tweens=[];for(var f in this.style){var e=f.underscore().dasherize(),d=this.element.getStyle(e),c=this.style[f];if(d!=c){this.tweens.push([e,S2.CSS.interpolate.curry(e,d,c),f in b?Object.propertize(b[f],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(p,d,c,l,k,b){var o=0,u=0,f=0,m=0,r=0,e=0;function j(v){return((o*v+u)*v+f)*v}function i(v){return((m*v+r)*v+e)*v}function s(v){return(3*o*v+2*u)*v+f}function n(t){return 1/(200*t)}function h(t,v){return i(g(t,v))}function q(t){if(t>=0){return t}else{return 0-t}}function g(t,C){var B,A,y,v,z,w;for(y=t,w=0;w<8;w++){v=j(y)-t;if(q(v)<C){return y}z=s(y);if(q(z)<0.000001){break}y=y-v/z}B=0;A=1;y=t;if(y<B){return B}if(y>A){return A}while(B<A){v=j(y);if(q(v-t)<C){return y}if(t>v){B=y}else{A=y}y=(A-B)*0.5+B}return y}f=3*d;u=3*(l-d)-f;o=1-f-u;e=3*c;r=3*(k-c)-e;m=1-e-r;return h(p,n(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)}});(function(k){Hash.addMethods({hasKey:function(m){return(m in this._object)}});var a=false;var f=false;function d(){var m=navigator.userAgent,n=navigator.appVersion;return(!m.include("Chrome")&&n.include("10_6"))||Prototype.Browser.MobileSafari}(function(){var n=document.createElement("div");try{document.createEvent("WebKitTransitionEvent");a=true;f=d()}catch(m){if(typeof n.style.MozTransition!=="undefined"){a=true}}n=null})();if(!a){return}Prototype.BrowserFeatures.CSSTransitions=true;S2.Extensions.CSSTransitions=true;S2.Extensions.HardwareAcceleratedCSSTransitions=f;if(f){Object.extend(k.DefaultOptions,{accelerate:true})}function l(m){return S2.CSS.vendorizeProperty(m)}var h=$w("border-top-left-radius border-top-right-radius border-bottom-left-radius border-bottom-right-radius background-size transform").map(function(m){return l(m).camelize()});h.each(function(m){S2.CSS.PROPERTIES.push(m)});S2.CSS.NUMERIC_PROPERTIES=S2.CSS.PROPERTIES.findAll(function(m){return !m.endsWith("olor")});CSS_TRANSITIONS_HARDWARE_ACCELERATED_PROPERTIES=S2.Extensions.HardwareAcceleratedCSSTransitions?$w("top left bottom right opacity"):[];var i=new Template("translate(#{0}px, #{1}px)");var g=k.Operators;g.CssTransition=Class.create(g.Base,{initialize:function($super,p,n,m){$super(p,n,m);this.element=$(this.object);var o=this.options.style;this.style=Object.isString(o)?S2.CSS.normalize(this.element,o):o;this.style=$H(this.style);this.targetStyle=S2.CSS.serialize(this.style);this.running=false},_canHardwareAccelerate:function(){if(this.effect.options.accelerate===false){return false}var o=this.style.toObject(),q=this.style.keys();var n=this.element;if(q.length===0){return false}var r=q.any(function(s){return !CSS_TRANSITIONS_HARDWARE_ACCELERATED_PROPERTIES.include(s)});if(r){return false}var p={left:n.getStyle("left"),right:n.getStyle("right"),top:n.getStyle("top"),bottom:n.getStyle("bottom")};function m(s){if(s.top&&s.bottom){return true}if(s.left&&s.right){return true}return false}if(m(p)){return false}if(m(o)){return false}return true},_adjustForHardwareAcceleration:function(o){var n=0,m=0;$w("top bottom left right").each(function(t){if(!o.hasKey(t)){return}var s=window.parseInt(this.element.getStyle(t),10);var r=window.parseInt(o.get(t),10);if(t==="top"){m+=(r-s)}else{if(t==="bottom"){m+=(s-r)}else{if(t==="left"){n+=(r-s)}else{if(t==="right"){n+=(s-r)}}}}o.unset(t)},this);var p=l("transform");if(n!==0||m!==0){var q=i.evaluate([n,m]);o.set(p,q)}this.targetStyle+=p+": translate(0px, 0px);";return o},render:function(){if(this.running===true){return}var p=this.style.clone(),o=this.effect;if(this._canHardwareAccelerate()){o.accelerated=true;p=this._adjustForHardwareAcceleration(p)}else{o.accelerated=false}var n=this.element.style;var m={};$w("transition-property transition-duration transition-timing-function").each(function(q){q=l(q).camelize();m[q]=n[q]});this.element.store("s2.targetStyle",this.targetStyle);this.element.store("s2.originalTransitionStyle",m);n[l("transition-property").camelize()]=p.keys().join(",");n[l("transition-duration").camelize()]=(o.duration/1000).toFixed(3)+"s";n[l("transition-timing-function").camelize()]=c(o.options.transition);this.element.setStyle(p.toObject());this.running=true;this.render=Prototype.emptyFunction}});g.CssTransition.TIMING_MAP={linear:"linear",sinusoidal:"ease-in-out"};function c(p){var o=null,n=k.Operators.CssTransition.TIMING_MAP;for(var m in n){if(k.Transitions[m]===p){o=n[m];break}}return o}function j(n){if(!S2.Extensions.CSSTransitions){return false}var m=n.options;if((m.engine||"")==="javascript"){return false}if(!c(m.transition)){return false}if(m.propertyTransitions){return false}return true}k.Morph=Class.create(k.Morph,{setup:function(){if(this.options.change){this.setupWrappers()}else{if(this.options.style){this.engine="javascript";var n="style";var p=Object.isString(this.options.style)?S2.CSS.parseStyle(this.options.style):p;var o=S2.CSS.normalize(this.destinationElement||this.element,p);var m=Object.keys(o).length>0;if(m&&j(this)){this.engine="css-transition";n="CssTransition";this.update=function(q){this.element.store("s2.effect",this);S2.FX.setReady(this.element,false);for(var s=0,r;r=this.operators[s];s++){r.render(q)}this.render=Prototype.emptyFunction}}this.animate(n,this.destinationElement||this.element,{style:this.options.style,propertyTransitions:this.options.propertyTransitions||{}})}}}});var b={webkit:"webkitTransitionEnd",moz:"transitionend"};var e=b[S2.CSS.VENDOR_PREFIX.toLowerCase()];document.observe(e,function(o){var m=o.element();if(!m){return}var n=m.retrieve("s2.effect");if(n){function p(s,t){var r=s.retrieve("s2.targetStyle");if(!r){return}s.setStyle(r);var u=s.retrieve("s2.originalTransitionStyle");var v=s.getStorage();v.unset("s2.targetStyle");v.unset("s2.originalTransitionStyle");v.unset("s2.effect");(function(){if(u){s.setStyle(u)}S2.FX.setReady(s)}).defer()}(function(s,t){var r=l("transition-duration").camelize();s.style[r]="";p(s,t)}).defer(m,n);n.state="finished";var q=n.options.after;if(q){q(n)}}})})(S2.FX);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.charAt(0).toUpperCase()+c.substring(1)](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.setStyle("opacity: 0;").show().morph("opacity: 1",a)},fade:function(b,a){a=Object.extend({after:Element.hide.curry(b)},a||{});return b.morph("opacity: 0",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))}});
