var Fx={};
Fx.Base=new Class({options:{onStart:Class.empty,onComplete:Class.empty,onCancel:Class.empty,transition:function(p){
return -(Math.cos(Math.PI*p)-1)/2;
},duration:500,unit:"px",wait:true,fps:50},initialize:function(_21f){
this.element=this.element||null;
this.setOptions(_21f);
if(this.options.initialize){
this.options.initialize.call(this);
}
},step:function(){
var time=$time();
if(time<this.time+this.options.duration){
this.delta=this.options.transition((time-this.time)/this.options.duration);
this.setNow();
this.increase();
}else{
this.stop(true);
this.set(this.to);
this.fireEvent("onComplete",this.element,10);
this.callChain();
}
},set:function(to){
this.now=to;
this.increase();
return this;
},setNow:function(){
this.now=this.compute(this.from,this.to);
},compute:function(from,to){
return (to-from)*this.delta+from;
},start:function(from,to){
if(!this.options.wait){
this.stop();
}else{
if(this.timer){
return this;
}
}
this.from=from;
this.to=to;
this.change=this.to-this.from;
this.time=$time();
this.timer=this.step.periodical(Math.round(1000/this.options.fps),this);
this.fireEvent("onStart",this.element);
return this;
},stop:function(end){
if(!this.timer){
return this;
}
this.timer=$clear(this.timer);
if(!end){
this.fireEvent("onCancel",this.element);
}
return this;
},custom:function(from,to){
return this.start(from,to);
},clearTimer:function(end){
return this.stop(end);
}});
Fx.Base.implement(new Chain,new Events,new Options);
Fx.CSS={select:function(_22a,to){
if(_22a.test(/color/i)){
return this.Color;
}
var type=$type(to);
if((type=="array")||(type=="string"&&to.contains(" "))){
return this.Multi;
}
return this.Single;
},parse:function(el,_22e,_22f){
if(!_22f.push){
_22f=[_22f];
}
var from=_22f[0],to=_22f[1];
if(!$chk(to)){
to=from;
from=el.getStyle(_22e);
}
var css=this.select(_22e,to);
return {"from":css.parse(from),"to":css.parse(to),"css":css};
}};
Fx.CSS.Single={parse:function(_232){
return parseFloat(_232);
},getNow:function(from,to,fx){
return fx.compute(from,to);
},getValue:function(_236,unit,_238){
if(unit=="px"&&_238!="opacity"){
_236=Math.round(_236);
}
return _236+unit;
}};
Fx.CSS.Multi={parse:function(_239){
return _239.push?_239:_239.split(" ").map(function(v){
return parseFloat(v);
});
},getNow:function(from,to,fx){
var now=[];
for(var i=0;i<from.length;i++){
now[i]=fx.compute(from[i],to[i]);
}
return now;
},getValue:function(_240,unit,_242){
if(unit=="px"&&_242!="opacity"){
_240=_240.map(Math.round);
}
return _240.join(unit+" ")+unit;
}};
Fx.CSS.Color={parse:function(_243){
return _243.push?_243:_243.hexToRgb(true);
},getNow:function(from,to,fx){
var now=[];
for(var i=0;i<from.length;i++){
now[i]=Math.round(fx.compute(from[i],to[i]));
}
return now;
},getValue:function(_249){
return "rgb("+_249.join(",")+")";
}};
Fx.Style=Fx.Base.extend({initialize:function(el,_24b,_24c){
this.element=$(el);
this.property=_24b;
this.parent(_24c);
},hide:function(){
return this.set(0);
},setNow:function(){
this.now=this.css.getNow(this.from,this.to,this);
},set:function(to){
this.css=Fx.CSS.select(this.property,to);
return this.parent(this.css.parse(to));
},start:function(from,to){
if(this.timer&&this.options.wait){
return this;
}
var _250=Fx.CSS.parse(this.element,this.property,[from,to]);
this.css=_250.css;
return this.parent(_250.from,_250.to);
},increase:function(){
this.element.setStyle(this.property,this.css.getValue(this.now,this.options.unit,this.property));
}});
Element.extend({effect:function(_251,_252){
return new Fx.Style(this,_251,_252);
}});
Fx.Styles=Fx.Base.extend({initialize:function(el,_254){
this.element=$(el);
this.parent(_254);
},setNow:function(){
for(var p in this.from){
this.now[p]=this.css[p].getNow(this.from[p],this.to[p],this);
}
},set:function(to){
var _257={};
this.css={};
for(var p in to){
this.css[p]=Fx.CSS.select(p,to[p]);
_257[p]=this.css[p].parse(to[p]);
}
return this.parent(_257);
},start:function(obj){
if(this.timer&&this.options.wait){
return this;
}
this.now={};
this.css={};
var from={},to={};
for(var p in obj){
var _25c=Fx.CSS.parse(this.element,p,obj[p]);
from[p]=_25c.from;
to[p]=_25c.to;
this.css[p]=_25c.css;
}
return this.parent(from,to);
},increase:function(){
for(var p in this.now){
this.element.setStyle(p,this.css[p].getValue(this.now[p],this.options.unit,p));
}
}});
Element.extend({effects:function(_25e){
return new Fx.Styles(this,_25e);
}});
Fx.Elements=Fx.Base.extend({initialize:function(_25f,_260){
this.elements=$$(_25f);
this.parent(_260);
},setNow:function(){
for(var i in this.from){
var _262=this.from[i],iTo=this.to[i],iCss=this.css[i],iNow=this.now[i]={};
for(var p in _262){
iNow[p]=iCss[p].getNow(_262[p],iTo[p],this);
}
}
},set:function(to){
var _265={};
this.css={};
for(var i in to){
var iTo=to[i],iCss=this.css[i]={},iParsed=_265[i]={};
for(var p in iTo){
iCss[p]=Fx.CSS.select(p,iTo[p]);
iParsed[p]=iCss[p].parse(iTo[p]);
}
}
return this.parent(_265);
},start:function(obj){
if(this.timer&&this.options.wait){
return this;
}
this.now={};
this.css={};
var from={},to={};
for(var i in obj){
var _26c=obj[i],iFrom=from[i]={},iTo=to[i]={},iCss=this.css[i]={};
for(var p in _26c){
var _26e=Fx.CSS.parse(this.elements[i],p,_26c[p]);
iFrom[p]=_26e.from;
iTo[p]=_26e.to;
iCss[p]=_26e.css;
}
}
return this.parent(from,to);
},increase:function(){
for(var i in this.now){
var iNow=this.now[i],iCss=this.css[i];
for(var p in iNow){
this.elements[i].setStyle(p,iCss[p].getValue(iNow[p],this.options.unit,p));
}
}
}});
Fx.Scroll=Fx.Base.extend({options:{overflown:[],offset:{"x":0,"y":0},wheelStops:true},initialize:function(_272,_273){
this.now=[];
this.element=$(_272);
this.bound={"stop":this.stop.bind(this,false)};
this.parent(_273);
if(this.options.wheelStops){
this.addEvent("onStart",function(){
document.addEvent("mousewheel",this.bound.stop);
}.bind(this));
this.addEvent("onComplete",function(){
document.removeEvent("mousewheel",this.bound.stop);
}.bind(this));
}
},setNow:function(){
for(var i=0;i<2;i++){
this.now[i]=this.compute(this.from[i],this.to[i]);
}
},scrollTo:function(x,y){
if(this.timer&&this.options.wait){
return this;
}
var el=this.element.getSize();
var _278={"x":x,"y":y};
for(var z in el.size){
var max=el.scrollSize[z]-el.size[z];
if($chk(_278[z])){
_278[z]=($type(_278[z])=="number")?_278[z].limit(0,max):max;
}else{
_278[z]=el.scroll[z];
}
_278[z]+=this.options.offset[z];
}
return this.start([el.scroll.x,el.scroll.y],[_278.x,_278.y]);
},toTop:function(){
return this.scrollTo(false,0);
},toBottom:function(){
return this.scrollTo(false,"full");
},toLeft:function(){
return this.scrollTo(0,false);
},toRight:function(){
return this.scrollTo("full",false);
},toElement:function(el){
var _27c=this.element.getPosition(this.options.overflown);
var _27d=$(el).getPosition(this.options.overflown);
return this.scrollTo(_27d.x-_27c.x,_27d.y-_27c.y);
},increase:function(){
this.element.scrollTo(this.now[0],this.now[1]);
}});
Fx.Slide=Fx.Base.extend({options:{mode:"vertical"},initialize:function(el,_27f){
this.element=$(el);
this.wrapper=new Element("div",{"styles":$extend(this.element.getStyles("margin"),{"overflow":"hidden"})}).injectAfter(this.element).adopt(this.element);
this.element.setStyle("margin",0);
this.setOptions(_27f);
this.now=[];
this.parent(this.options);
this.open=true;
this.addEvent("onComplete",function(){
this.open=(this.now[0]===0);
});
if(window.webkit419){
this.addEvent("onComplete",function(){
if(this.open){
this.element.remove().inject(this.wrapper);
}
});
}
},setNow:function(){
for(var i=0;i<2;i++){
this.now[i]=this.compute(this.from[i],this.to[i]);
}
},vertical:function(){
this.margin="margin-top";
this.layout="height";
this.offset=this.element.offsetHeight;
},horizontal:function(){
this.margin="margin-left";
this.layout="width";
this.offset=this.element.offsetWidth;
},slideIn:function(mode){
this[mode||this.options.mode]();
return this.start([this.element.getStyle(this.margin).toInt(),this.wrapper.getStyle(this.layout).toInt()],[0,this.offset]);
},slideOut:function(mode){
this[mode||this.options.mode]();
return this.start([this.element.getStyle(this.margin).toInt(),this.wrapper.getStyle(this.layout).toInt()],[-this.offset,0]);
},hide:function(mode){
this[mode||this.options.mode]();
this.open=false;
return this.set([-this.offset,0]);
},show:function(mode){
this[mode||this.options.mode]();
this.open=true;
return this.set([0,this.offset]);
},toggle:function(mode){
if(this.wrapper.offsetHeight==0||this.wrapper.offsetWidth==0){
return this.slideIn(mode);
}
return this.slideOut(mode);
},increase:function(){
this.element.setStyle(this.margin,this.now[0]+this.options.unit);
this.wrapper.setStyle(this.layout,this.now[1]+this.options.unit);
}});
Fx.Transition=function(_286,_287){
_287=_287||[];
if($type(_287)!="array"){
_287=[_287];
}
return $extend(_286,{easeIn:function(pos){
return _286(pos,_287);
},easeOut:function(pos){
return 1-_286(1-pos,_287);
},easeInOut:function(pos){
return (pos<=0.5)?_286(2*pos,_287)/2:(2-_286(2*(1-pos),_287))/2;
}});
};
Fx.Transitions=new Abstract({linear:function(p){
return p;
}});
Fx.Transitions.extend=function(_28c){
for(var _28d in _28c){
Fx.Transitions[_28d]=new Fx.Transition(_28c[_28d]);
Fx.Transitions.compat(_28d);
}
};
Fx.Transitions.compat=function(_28e){
["In","Out","InOut"].each(function(_28f){
Fx.Transitions[_28e.toLowerCase()+_28f]=Fx.Transitions[_28e]["ease"+_28f];
});
};
Fx.Transitions.extend({Pow:function(p,x){
return Math.pow(p,x[0]||6);
},Expo:function(p){
return Math.pow(2,8*(p-1));
},Circ:function(p){
return 1-Math.sin(Math.acos(p));
},Sine:function(p){
return 1-Math.sin((1-p)*Math.PI/2);
},Back:function(p,x){
x=x[0]||1.618;
return Math.pow(p,2)*((x+1)*p-x);
},Bounce:function(p){
var _298;
for(var a=0,b=1;1;a+=b,b/=2){
if(p>=(7-4*a)/11){
_298=-Math.pow((11-6*a-11*p)/4,2)+b*b;
break;
}
}
return _298;
},Elastic:function(p,x){
return Math.pow(2,10*--p)*Math.cos(20*p*Math.PI*(x[0]||1)/3);
}});
["Quad","Cubic","Quart","Quint"].each(function(_29c,i){
Fx.Transitions[_29c]=new Fx.Transition(function(p){
return Math.pow(p,[i+2]);
});
Fx.Transitions.compat(_29c);
});
