impress/public/assets/effects.js

12 lines
No EOL
24 KiB
JavaScript

// script.aculo.us effects.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// Contributors:
// Justin Palmer (http://encytemedia.com/)
// Mark Pilgrim (http://diveintomark.org/)
// Martin Bialasinki
//
// script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/
// converts rgb() and #xxx to #xxxxxx format,
// returns self (or first argument) if not convertable
String.prototype.parseColor=function(){var e="#";if(this.slice(0,4)=="rgb("){var t=this.slice(4,this.length-1).split(","),n=0;do e+=parseInt(t[n]).toColorPart();while(++n<3)}else if(this.slice(0,1)=="#"){if(this.length==4)for(var n=1;n<4;n++)e+=(this.charAt(n)+this.charAt(n)).toLowerCase();this.length==7&&(e=this.toLowerCase())}return e.length==7?e:arguments[0]||this},Element.collectTextNodes=function(e){return $A($(e).childNodes).collect(function(e){return e.nodeType==3?e.nodeValue:e.hasChildNodes()?Element.collectTextNodes(e):""}).flatten().join("")},Element.collectTextNodesIgnoreClass=function(e,t){return $A($(e).childNodes).collect(function(e){return e.nodeType==3?e.nodeValue:e.hasChildNodes()&&!Element.hasClassName(e,t)?Element.collectTextNodesIgnoreClass(e,t):""}).flatten().join("")},Element.setContentZoom=function(e,t){return e=$(e),e.setStyle({fontSize:t/100+"em"}),Prototype.Browser.WebKit&&window.scrollBy(0,0),e},Element.getInlineOpacity=function(e){return $(e).style.opacity||""},Element.forceRerendering=function(e){try{e=$(e);var t=document.createTextNode(" ");e.appendChild(t),e.removeChild(t)}catch(n){}};var Effect={_elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},Transitions:{linear:Prototype.K,sinoidal:function(e){return-Math.cos(e*Math.PI)/2+.5},reverse:function(e){return 1-e},flicker:function(e){var e=-Math.cos(e*Math.PI)/4+.75+Math.random()/4;return e>1?1:e},wobble:function(e){return-Math.cos(e*Math.PI*9*e)/2+.5},pulse:function(e,t){return-Math.cos(e*((t||5)-.5)*2*Math.PI)/2+.5},spring:function(e){return 1-Math.cos(e*4.5*Math.PI)*Math.exp(-e*6)},none:function(e){return 0},full:function(e){return 1}},DefaultOptions:{duration:1,fps:100,sync:!1,from:0,to:1,delay:0,queue:"parallel"},tagifyText:function(e){var t="position:relative";Prototype.Browser.IE&&(t+=";zoom:1"),e=$(e),$A(e.childNodes).each(function(n){n.nodeType==3&&(n.nodeValue.toArray().each(function(r){e.insertBefore((new Element("span",{style:t})).update(r==" "?String.fromCharCode(160):r),n)}),Element.remove(n))})},multiple:function(e,t){var n;(typeof e=="object"||Object.isFunction(e))&&e.length?n=e:n=$(e).childNodes;var r=Object.extend({speed:.1,delay:0},arguments[2]||{}),i=r.delay;$A(n).each(function(e,n){new t(e,Object.extend(r,{delay:n*r.speed+i}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(e,t,n){return e=$(e),t=(t||"appear").toLowerCase(),Effect[Effect.PAIRS[t][e.visible()?1:0]](e,Object.extend({queue:{position:"end",scope:e.id||"global",limit:1}},n||{}))}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal,Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[],this.interval=null},_each:function(e){this.effects._each(e)},add:function(e){var t=(new Date).getTime(),n=Object.isString(e.options.queue)?e.options.queue:e.options.queue.position;switch(n){case"front":this.effects.findAll(function(e){return e.state=="idle"}).each(function(t){t.startOn+=e.finishOn,t.finishOn+=e.finishOn});break;case"with-last":t=this.effects.pluck("startOn").max()||t;break;case"end":t=this.effects.pluck("finishOn").max()||t}e.startOn+=t,e.finishOn+=t,(!e.options.queue.limit||this.effects.length<e.options.queue.limit)&&this.effects.push(e),this.interval||(this.interval=setInterval(this.loop.bind(this),15))},remove:function(e){this.effects=this.effects.reject(function(t){return t==e}),this.effects.length==0&&(clearInterval(this.interval),this.interval=null)},loop:function(){var e=(new Date).getTime();for(var t=0,n=this.effects.length;t<n;t++)this.effects[t]&&this.effects[t].loop(e)}}),Effect.Queues={instances:$H(),get:function(e){return Object.isString(e)?this.instances.get(e)||this.instances.set(e,new Effect.ScopedQueue):e}},Effect.Queue=Effect.Queues.get("global"),Effect.Base=Class.create({position:null,start:function(e){e&&e.transition===!1&&(e.transition=Effect.Transitions.linear),this.options=Object.extend(Object.extend({},Effect.DefaultOptions),e||{}),this.currentFrame=0,this.state="idle",this.startOn=this.options.delay*1e3,this.finishOn=this.startOn+this.options.duration*1e3,this.fromToDelta=this.options.to-this.options.from,this.totalTime=this.finishOn-this.startOn,this.totalFrames=this.options.fps*this.options.duration,this.render=function(){function e(e,t){e.options[t+"Internal"]&&e.options[t+"Internal"](e),e.options[t]&&e.options[t](e)}return function(t){this.state==="idle"&&(this.state="running",e(this,"beforeSetup"),this.setup&&this.setup(),e(this,"afterSetup")),this.state==="running"&&(t=this.options.transition(t)*this.fromToDelta+this.options.from,this.position=t,e(this,"beforeUpdate"),this.update&&this.update(t),e(this,"afterUpdate"))}}(),this.event("beforeStart"),this.options.sync||Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).add(this)},loop:function(e){if(e>=this.startOn){if(e>=this.finishOn){this.render(1),this.cancel(),this.event("beforeFinish"),this.finish&&this.finish(),this.event("afterFinish");return}var t=(e-this.startOn)/this.totalTime,n=(t*this.totalFrames).round();n>this.currentFrame&&(this.render(t),this.currentFrame=n)}},cancel:function(){this.options.sync||Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).remove(this),this.state="finished"},event:function(e){this.options[e+"Internal"]&&this.options[e+"Internal"](this),this.options[e]&&this.options[e](this)},inspect:function(){var e=$H();for(property in this)Object.isFunction(this[property])||e.set(property,this[property]);return"#<Effect:"+e.inspect()+",options:"+$H(this.options).inspect()+">"}}),Effect.Parallel=Class.create(Effect.Base,{initialize:function(e){this.effects=e||[],this.start(arguments[1])},update:function(e){this.effects.invoke("render",e)},finish:function(e){this.effects.each(function(t){t.render(1),t.cancel(),t.event("beforeFinish"),t.finish&&t.finish(e),t.event("afterFinish")})}}),Effect.Tween=Class.create(Effect.Base,{initialize:function(e,t,n){e=Object.isString(e)?$(e):e;var r=$A(arguments),i=r.last(),s=r.length==5?r[3]:null;this.method=Object.isFunction(i)?i.bind(e):Object.isFunction(e[i])?e[i].bind(e):function(t){e[i]=t},this.start(Object.extend({from:t,to:n},s||{}))},update:function(e){this.method(e)}}),Effect.Event=Class.create(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}))},update:Prototype.emptyFunction}),Effect.Opacity=Class.create(Effect.Base,{initialize:function(e){this.element=$(e);if(!this.element)throw Effect._elementDoesNotExistError;Prototype.Browser.IE&&!this.element.currentStyle.hasLayout&&this.element.setStyle({zoom:1});var t=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});this.start(t)},update:function(e){this.element.setOpacity(e)}}),Effect.Move=Class.create(Effect.Base,{initialize:function(e){this.element=$(e);if(!this.element)throw Effect._elementDoesNotExistError;var t=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{});this.start(t)},setup:function(){this.element.makePositioned(),this.originalLeft=parseFloat(this.element.getStyle("left")||"0"),this.originalTop=parseFloat(this.element.getStyle("top")||"0"),this.options.mode=="absolute"&&(this.options.x=this.options.x-this.originalLeft,this.options.y=this.options.y-this.originalTop)},update:function(e){this.element.setStyle({left:(this.options.x*e+this.originalLeft).round()+"px",top:(this.options.y*e+this.originalTop).round()+"px"})}}),Effect.MoveBy=function(e,t,n){return new Effect.Move(e,Object.extend({x:n,y:t},arguments[3]||{}))},Effect.Scale=Class.create(Effect.Base,{initialize:function(e,t){this.element=$(e);if(!this.element)throw Effect._elementDoesNotExistError;var n=Object.extend({scaleX:!0,scaleY:!0,scaleContent:!0,scaleFromCenter:!1,scaleMode:"box",scaleFrom:100,scaleTo:t},arguments[2]||{});this.start(n)},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||!1,this.elementPositioning=this.element.getStyle("position"),this.originalStyle={},["top","left","width","height","fontSize"].each(function(e){this.originalStyle[e]=this.element.style[e]}.bind(this)),this.originalTop=this.element.offsetTop,this.originalLeft=this.element.offsetLeft;var e=this.element.getStyle("font-size")||"100%";["em","px","%","pt"].each(function(t){e.indexOf(t)>0&&(this.fontSize=parseFloat(e),this.fontSizeType=t)}.bind(this)),this.factor=(this.options.scaleTo-this.options.scaleFrom)/100,this.dims=null,this.options.scaleMode=="box"&&(this.dims=[this.element.offsetHeight,this.element.offsetWidth]),/^content/.test(this.options.scaleMode)&&(this.dims=[this.element.scrollHeight,this.element.scrollWidth]),this.dims||(this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth])},update:function(e){var t=this.options.scaleFrom/100+this.factor*e;this.options.scaleContent&&this.fontSize&&this.element.setStyle({fontSize:this.fontSize*t+this.fontSizeType}),this.setDimensions(this.dims[0]*t,this.dims[1]*t)},finish:function(e){this.restoreAfterFinish&&this.element.setStyle(this.originalStyle)},setDimensions:function(e,t){var n={};this.options.scaleX&&(n.width=t.round()+"px"),this.options.scaleY&&(n.height=e.round()+"px");if(this.options.scaleFromCenter){var r=(e-this.dims[0])/2,i=(t-this.dims[1])/2;this.elementPositioning=="absolute"?(this.options.scaleY&&(n.top=this.originalTop-r+"px"),this.options.scaleX&&(n.left=this.originalLeft-i+"px")):(this.options.scaleY&&(n.top=-r+"px"),this.options.scaleX&&(n.left=-i+"px"))}this.element.setStyle(n)}}),Effect.Highlight=Class.create(Effect.Base,{initialize:function(e){this.element=$(e);if(!this.element)throw Effect._elementDoesNotExistError;var t=Object.extend({startcolor:"#ffff99"},arguments[1]||{});this.start(t)},setup:function(){if(this.element.getStyle("display")=="none"){this.cancel();return}this.oldStyle={},this.options.keepBackgroundImage||(this.oldStyle.backgroundImage=this.element.getStyle("background-image"),this.element.setStyle({backgroundImage:"none"})),this.options.endcolor||(this.options.endcolor=this.element.getStyle("background-color").parseColor("#ffffff")),this.options.restorecolor||(this.options.restorecolor=this.element.getStyle("background-color")),this._base=$R(0,2).map(function(e){return parseInt(this.options.startcolor.slice(e*2+1,e*2+3),16)}.bind(this)),this._delta=$R(0,2).map(function(e){return parseInt(this.options.endcolor.slice(e*2+1,e*2+3),16)-this._base[e]}.bind(this))},update:function(e){this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(t,n,r){return t+(this._base[r]+this._delta[r]*e).round().toColorPart()}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}}),Effect.ScrollTo=function(e){var t=arguments[1]||{},n=document.viewport.getScrollOffsets(),r=$(e).cumulativeOffset();return t.offset&&(r[1]+=t.offset),new Effect.Tween(null,n.top,r[1],t,function(e){scrollTo(n.left,e.round())})},Effect.Fade=function(e){e=$(e);var t=e.getInlineOpacity(),n=Object.extend({from:e.getOpacity()||1,to:0,afterFinishInternal:function(e){if(e.options.to!=0)return;e.element.hide().setStyle({opacity:t})}},arguments[1]||{});return new Effect.Opacity(e,n)},Effect.Appear=function(e){e=$(e);var t=Object.extend({from:e.getStyle("display")=="none"?0:e.getOpacity()||0,to:1,afterFinishInternal:function(e){e.element.forceRerendering()},beforeSetup:function(e){e.element.setOpacity(e.options.from).show()}},arguments[1]||{});return new Effect.Opacity(e,t)},Effect.Puff=function(e){e=$(e);var t={opacity:e.getInlineOpacity(),position:e.getStyle("position"),top:e.style.top,left:e.style.left,width:e.style.width,height:e.style.height};return new Effect.Parallel([new Effect.Scale(e,200,{sync:!0,scaleFromCenter:!0,scaleContent:!0,restoreAfterFinish:!0}),new Effect.Opacity(e,{sync:!0,to:0})],Object.extend({duration:1,beforeSetupInternal:function(e){Position.absolutize(e.effects[0].element)},afterFinishInternal:function(e){e.effects[0].element.hide().setStyle(t)}},arguments[1]||{}))},Effect.BlindUp=function(e){return e=$(e),e.makeClipping(),new Effect.Scale(e,0,Object.extend({scaleContent:!1,scaleX:!1,restoreAfterFinish:!0,afterFinishInternal:function(e){e.element.hide().undoClipping()}},arguments[1]||{}))},Effect.BlindDown=function(e){e=$(e);var t=e.getDimensions();return new Effect.Scale(e,100,Object.extend({scaleContent:!1,scaleX:!1,scaleFrom:0,scaleMode:{originalHeight:t.height,originalWidth:t.width},restoreAfterFinish:!0,afterSetup:function(e){e.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(e){e.element.undoClipping()}},arguments[1]||{}))},Effect.SwitchOff=function(e){e=$(e);var t=e.getInlineOpacity();return new Effect.Appear(e,Object.extend({duration:.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(e){new Effect.Scale(e.element,1,{duration:.3,scaleFromCenter:!0,scaleX:!1,scaleContent:!1,restoreAfterFinish:!0,beforeSetup:function(e){e.element.makePositioned().makeClipping()},afterFinishInternal:function(e){e.element.hide().undoClipping().undoPositioned().setStyle({opacity:t})}})}},arguments[1]||{}))},Effect.DropOut=function(e){e=$(e);var t={top:e.getStyle("top"),left:e.getStyle("left"),opacity:e.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(e,{x:0,y:100,sync:!0}),new Effect.Opacity(e,{sync:!0,to:0})],Object.extend({duration:.5,beforeSetup:function(e){e.effects[0].element.makePositioned()},afterFinishInternal:function(e){e.effects[0].element.hide().undoPositioned().setStyle(t)}},arguments[1]||{}))},Effect.Shake=function(e){e=$(e);var t=Object.extend({distance:20,duration:.5},arguments[1]||{}),n=parseFloat(t.distance),r=parseFloat(t.duration)/10,i={top:e.getStyle("top"),left:e.getStyle("left")};return new Effect.Move(e,{x:n,y:0,duration:r,afterFinishInternal:function(e){new Effect.Move(e.element,{x:-n*2,y:0,duration:r*2,afterFinishInternal:function(e){new Effect.Move(e.element,{x:n*2,y:0,duration:r*2,afterFinishInternal:function(e){new Effect.Move(e.element,{x:-n*2,y:0,duration:r*2,afterFinishInternal:function(e){new Effect.Move(e.element,{x:n*2,y:0,duration:r*2,afterFinishInternal:function(e){new Effect.Move(e.element,{x:-n,y:0,duration:r,afterFinishInternal:function(e){e.element.undoPositioned().setStyle(i)}})}})}})}})}})}})},Effect.SlideDown=function(e){e=$(e).cleanWhitespace();var t=e.down().getStyle("bottom"),n=e.getDimensions();return new Effect.Scale(e,100,Object.extend({scaleContent:!1,scaleX:!1,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:n.height,originalWidth:n.width},restoreAfterFinish:!0,afterSetup:function(e){e.element.makePositioned(),e.element.down().makePositioned(),window.opera&&e.element.setStyle({top:""}),e.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(e){e.element.down().setStyle({bottom:e.dims[0]-e.element.clientHeight+"px"})},afterFinishInternal:function(e){e.element.undoClipping().undoPositioned(),e.element.down().undoPositioned().setStyle({bottom:t})}},arguments[1]||{}))},Effect.SlideUp=function(e){e=$(e).cleanWhitespace();var t=e.down().getStyle("bottom"),n=e.getDimensions();return new Effect.Scale(e,window.opera?0:1,Object.extend({scaleContent:!1,scaleX:!1,scaleMode:"box",scaleFrom:100,scaleMode:{originalHeight:n.height,originalWidth:n.width},restoreAfterFinish:!0,afterSetup:function(e){e.element.makePositioned(),e.element.down().makePositioned(),window.opera&&e.element.setStyle({top:""}),e.element.makeClipping().show()},afterUpdateInternal:function(e){e.element.down().setStyle({bottom:e.dims[0]-e.element.clientHeight+"px"})},afterFinishInternal:function(e){e.element.hide().undoClipping().undoPositioned(),e.element.down().undoPositioned().setStyle({bottom:t})}},arguments[1]||{}))},Effect.Squish=function(e){return new Effect.Scale(e,window.opera?1:0,{restoreAfterFinish:!0,beforeSetup:function(e){e.element.makeClipping()},afterFinishInternal:function(e){e.element.hide().undoClipping()}})},Effect.Grow=function(e){e=$(e);var t=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{}),n={top:e.style.top,left:e.style.left,height:e.style.height,width:e.style.width,opacity:e.getInlineOpacity()},r=e.getDimensions(),i,s,o,u;switch(t.direction){case"top-left":i=s=o=u=0;break;case"top-right":i=r.width,s=u=0,o=-r.width;break;case"bottom-left":i=o=0,s=r.height,u=-r.height;break;case"bottom-right":i=r.width,s=r.height,o=-r.width,u=-r.height;break;case"center":i=r.width/2,s=r.height/2,o=-r.width/2,u=-r.height/2}return new Effect.Move(e,{x:i,y:s,duration:.01,beforeSetup:function(e){e.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(e){new Effect.Parallel([new Effect.Opacity(e.element,{sync:!0,to:1,from:0,transition:t.opacityTransition}),new Effect.Move(e.element,{x:o,y:u,sync:!0,transition:t.moveTransition}),new Effect.Scale(e.element,100,{scaleMode:{originalHeight:r.height,originalWidth:r.width},sync:!0,scaleFrom:window.opera?1:0,transition:t.scaleTransition,restoreAfterFinish:!0})],Object.extend({beforeSetup:function(e){e.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(e){e.effects[0].element.undoClipping().undoPositioned().setStyle(n)}},t))}})},Effect.Shrink=function(e){e=$(e);var t=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{}),n={top:e.style.top,left:e.style.left,height:e.style.height,width:e.style.width,opacity:e.getInlineOpacity()},r=e.getDimensions(),i,s;switch(t.direction){case"top-left":i=s=0;break;case"top-right":i=r.width,s=0;break;case"bottom-left":i=0,s=r.height;break;case"bottom-right":i=r.width,s=r.height;break;case"center":i=r.width/2,s=r.height/2}return new Effect.Parallel([new Effect.Opacity(e,{sync:!0,to:0,from:1,transition:t.opacityTransition}),new Effect.Scale(e,window.opera?1:0,{sync:!0,transition:t.scaleTransition,restoreAfterFinish:!0}),new Effect.Move(e,{x:i,y:s,sync:!0,transition:t.moveTransition})],Object.extend({beforeStartInternal:function(e){e.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(e){e.effects[0].element.hide().undoClipping().undoPositioned().setStyle(n)}},t))},Effect.Pulsate=function(e){e=$(e);var t=arguments[1]||{},n=e.getInlineOpacity(),r=t.transition||Effect.Transitions.linear,i=function(e){return 1-r(-Math.cos(e*(t.pulses||5)*2*Math.PI)/2+.5)};return new Effect.Opacity(e,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(e){e.element.setStyle({opacity:n})}},t),{transition:i}))},Effect.Fold=function(e){e=$(e);var t={top:e.style.top,left:e.style.left,width:e.style.width,height:e.style.height};return e.makeClipping(),new Effect.Scale(e,5,Object.extend({scaleContent:!1,scaleX:!1,afterFinishInternal:function(n){new Effect.Scale(e,1,{scaleContent:!1,scaleY:!1,afterFinishInternal:function(e){e.element.hide().undoClipping().setStyle(t)}})}},arguments[1]||{}))},Effect.Morph=Class.create(Effect.Base,{initialize:function(e){this.element=$(e);if(!this.element)throw Effect._elementDoesNotExistError;var t=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(t.style))this.style=$H(t.style);else if(t.style.include(":"))this.style=t.style.parseStyle();else{this.element.addClassName(t.style),this.style=$H(this.element.getStyles()),this.element.removeClassName(t.style);var n=this.element.getStyles();this.style=this.style.reject(function(e){return e.value==n[e.key]}),t.afterFinishInternal=function(e){e.element.addClassName(e.options.style),e.transforms.each(function(t){e.element.style[t.style]=""})}}this.start(t)},setup:function(){function e(e){if(!e||["rgba(0, 0, 0, 0)","transparent"].include(e))e="#ffffff";return e=e.parseColor(),$R(0,2).map(function(t){return parseInt(e.slice(t*2+1,t*2+3),16)})}this.transforms=this.style.map(function(t){var n=t[0],r=t[1],i=null;if(r.parseColor("#zzzzzz")!="#zzzzzz")r=r.parseColor(),i="color";else if(n=="opacity")r=parseFloat(r),Prototype.Browser.IE&&!this.element.currentStyle.hasLayout&&this.element.setStyle({zoom:1});else if(Element.CSS_LENGTH.test(r)){var s=r.match(/^([\+\-]?[0-9\.]+)(.*)$/);r=parseFloat(s[1]),i=s.length==3?s[2]:null}var o=this.element.getStyle(n);return{style:n.camelize(),originalValue:i=="color"?e(o):parseFloat(o||0),targetValue:i=="color"?e(r):r,unit:i}}.bind(this)).reject(function(e){return e.originalValue==e.targetValue||e.unit!="color"&&(isNaN(e.originalValue)||isNaN(e.targetValue))})},update:function(e){var t={},n,r=this.transforms.length;while(r--)t[(n=this.transforms[r]).style]=n.unit=="color"?"#"+Math.round(n.originalValue[0]+(n.targetValue[0]-n.originalValue[0])*e).toColorPart()+Math.round(n.originalValue[1]+(n.targetValue[1]-n.originalValue[1])*e).toColorPart()+Math.round(n.originalValue[2]+(n.targetValue[2]-n.originalValue[2])*e).toColorPart():(n.originalValue+(n.targetValue-n.originalValue)*e).toFixed(3)+(n.unit===null?"":n.unit);this.element.setStyle(t,!0)}}),Effect.Transform=Class.create({initialize:function(e){this.tracks=[],this.options=arguments[1]||{},this.addTracks(e)},addTracks:function(e){return e.each(function(e){e=$H(e);var t=e.values().first();this.tracks.push($H({ids:e.keys().first(),effect:Effect.Morph,options:{style:t}}))}.bind(this)),this},play:function(){return new Effect.Parallel(this.tracks.map(function(e){var t=e.get("ids"),n=e.get("effect"),r=e.get("options"),i=[$(t)||$$(t)].flatten();return i.map(function(e){return new n(e,Object.extend({sync:!0},r))})}).flatten(),this.options)}}),Element.CSS_PROPERTIES=$w("backgroundColor backgroundPosition borderBottomColor borderBottomStyle borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth borderRightColor borderRightStyle borderRightWidth borderSpacing borderTopColor borderTopStyle borderTopWidth bottom clip color fontSize fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop markerOffset maxHeight maxWidth minHeight minWidth opacity outlineColor outlineOffset outlineWidth paddingBottom paddingLeft paddingRight paddingTop right textIndent top width wordSpacing zIndex"),Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/,String.__parseStyleElement=document.createElement("div"),String.prototype.parseStyle=function(){var e,t=$H();return Prototype.Browser.WebKit?e=(new Element("div",{style:this})).style:(String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>',e=String.__parseStyleElement.childNodes[0].style),Element.CSS_PROPERTIES.each(function(n){e[n]&&t.set(n,e[n])}),Prototype.Browser.IE&&this.include("opacity")&&t.set("opacity",this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]),t},document.defaultView&&document.defaultView.getComputedStyle?Element.getStyles=function(e){var t=document.defaultView.getComputedStyle($(e),null);return Element.CSS_PROPERTIES.inject({},function(e,n){return e[n]=t[n],e})}:Element.getStyles=function(e){e=$(e);var t=e.currentStyle,n;return n=Element.CSS_PROPERTIES.inject({},function(e,n){return e[n]=t[n],e}),n.opacity||(n.opacity=e.getOpacity()),n},Effect.Methods={morph:function(e,t){return e=$(e),new Effect.Morph(e,Object.extend({style:t},arguments[2]||{})),e},visualEffect:function(e,t,n){e=$(e);var r=t.dasherize().camelize(),i=r.charAt(0).toUpperCase()+r.substring(1);return new Effect[i](e,n),e},highlight:function(e,t){return e=$(e),new Effect.Highlight(e,t),e}},$w("fade appear grow shrink fold blindUp blindDown slideUp slideDown pulsate shake puff squish switchOff dropOut").each(function(e){Effect.Methods[e]=function(t,n){return t=$(t),Effect[e.charAt(0).toUpperCase()+e.substring(1)](t,n),t}}),$w("getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles").each(function(e){Effect.Methods[e]=Element[e]}),Element.addMethods(Effect.Methods);