/*
 *  script.aculo.us version 2.0.0_a4
 *  (c) 2005-2009 Thomas Fuchs
 *
 *  script.aculo.us is freely distributable under the terms of an MIT-style license.
 *----------------------------------------------------------------------------------*/
var S2={Version:"2.0.0_a4",Extensions:{}};Function.prototype.optionize=function(){var a=this,c=a.argumentNames(),b=c.length-1,d=function(){var f=$A(arguments),e=typeof f.last()=="object"?f.pop():{},g=(b==0?[]:((f.length>0?f:[null]).inGroupsOf(b).flatten())).concat(e);return a.apply(this,g)};d.argumentNames=function(){return c};return d};Number.prototype.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()}}}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){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()+">"}});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),(this.options.propertyTransitions&&this.options.propertyTransitions[d])?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.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})}})();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))}});
