Rico.animate=function(_1){
new Rico.Effect.Animator().play(_1,arguments[1]);
};
Rico.Effect={};
Rico.Effect.easeIn=function(_2){
return Math.sqrt(_2);
};
Rico.Effect.easeOut=function(_3){
return _3*_3;
};
Rico.Stepping={};
Rico.Stepping.easeIn=Rico.Effect.easeIn;
Rico.Stepping.easeOut=Rico.Effect.easeOut;
Rico.Effect.Animator=Class.create();
Rico.Effect.Animator.prototype={initialize:function(_4){
this.animateMethod=this.animate.bind(this);
this.options=arguments[1]||{};
this.stepsLeft=0;
if(!_4){
return;
}
this.reset(_4,arguments[1]);
},reset:function(_5){
this.effect=_5;
if(arguments[1]){
this.setOptions(arguments[1]);
}
this.stepsLeft=this.options.steps;
this.duration=this.options.duration;
},setOptions:function(_6){
this.options=Object.extend({steps:10,duration:200,rate:function(_7){
return _7;
}},_6||{});
},play:function(_8){
this.setOptions(arguments[1]);
if(_8){
if(_8.step){
this.reset(_8,arguments[1]);
}else{
$H(_8).keys().each((function(e){
var _a={fadeOut:Rico.Effect.FadeOut}[e];
this.reset(new _a(_8[e]));
}).bind(this));
}
}
this.animate();
},stop:function(){
if(this.timer){
clearTimeout(this.timer);
}
this.stepsLeft=0;
if(this.effect&&this.effect.finish){
this.effect.finish();
}
if(this.options.onFinish){
this.options.onFinish();
}
},pause:function(){
this.interupt=true;
},resume:function(){
this.interupt=false;
if(this.stepsLeft>0){
this.animate();
}
},animate:function(){
if(this.interupt){
return;
}
if(this.stepsLeft<=0){
this.stop();
return;
}
if(this.timer){
clearTimeout(this.timer);
}
this.effect.step(this.options.rate(this.stepsLeft));
this.startNextStep();
},startNextStep:function(){
var _b=Math.round(this.duration/this.stepsLeft);
this.duration-=_b;
this.stepsLeft--;
this.timer=setTimeout(this.animateMethod,_b);
},isPlaying:function(){
return this.stepsLeft!=0&&!this.interupt;
}};
Rico.Effect.Group=Class.create();
Rico.Effect.Group.prototype={initialize:function(_c){
this.effects=_c;
},step:function(_d){
this.effects.each(function(e){
e.step(_d);
});
},finish:function(){
this.effects.each(function(e){
if(e.finish){
e.finish();
}
});
}};
Rico.Effect.SizeAndPosition=Class.create();
Rico.Effect.SizeAndPosition.prototype={initialize:function(_10,x,y,w,h){
Object.extend(this,new Rico.Effect.SizeAndPositionFade(_10,x,y,w,h));
}};
Rico.Effect.SizeAndPositionFade=Class.create();
Rico.Effect.SizeAndPositionFade.prototype={initialize:function(_15,x,y,w,h,_1a){
this.element=$(_15);
this.x=typeof (x)=="number"?x:this.element.offsetLeft;
this.y=typeof (y)=="number"?y:this.element.offsetTop;
if(!Prototype.Browser.IE||(document.compatMode&&document.compatMode.indexOf("CSS")!=-1)){
this.pw=RicoUtil.nan2zero(Element.getStyle(this.element,"padding-left"))+RicoUtil.nan2zero(Element.getStyle(this.element,"padding-right"));
this.pw+=RicoUtil.nan2zero(Element.getStyle(this.element,"border-left-width"))+RicoUtil.nan2zero(Element.getStyle(this.element,"border-right-width"));
this.ph=RicoUtil.nan2zero(Element.getStyle(this.element,"padding-top"))+RicoUtil.nan2zero(Element.getStyle(this.element,"padding-bottom"));
this.ph+=RicoUtil.nan2zero(Element.getStyle(this.element,"border-top-width"))+RicoUtil.nan2zero(Element.getStyle(this.element,"border-bottom-width"));
}else{
this.pw=0;
this.ph=0;
}
this.w=typeof (w)=="number"?w:this.element.offsetWidth;
this.h=typeof (h)=="number"?h:this.element.offsetHeight;
this.opacity=Element.getStyle(this.element,"opacity")||1;
this.target=arguments.length>5?Math.min(_1a,1):this.opacity;
},step:function(_1b){
var _1c=this.element.offsetLeft+((this.x-this.element.offsetLeft)/_1b);
var top=this.element.offsetTop+((this.y-this.element.offsetTop)/_1b);
var _1e=this.element.offsetWidth+((this.w-this.element.offsetWidth)/_1b)-this.pw;
var _1f=this.element.offsetHeight+((this.h-this.element.offsetHeight)/_1b)-this.ph;
var _20=this.element.style;
var _21=Element.getStyle(this.element,"opacity");
var _22=_21+(this.target-_21)/_1b;
Rico.Effect.setOpacity(this.element,Math.min(Math.max(0,_22),1));
_20.left=_1c+"px";
_20.top=top+"px";
_20.width=_1e+"px";
_20.height=_1f+"px";
}};
Rico.AccordionEffect=Class.create();
Rico.AccordionEffect.prototype={initialize:function(_23,_24,_25){
this.toClose=_23;
this.toOpen=_24;
_24.style.height="0px";
Element.show(_24);
Element.makeClipping(_24);
Element.makeClipping(_23);
Rico.Controls.disableNativeControls(_23);
this.endHeight=_25;
},step:function(_26){
var _27=Math.max(1,this.toClose.offsetHeight-parseInt((parseInt(this.toClose.offsetHeight))/_26));
var _28=_27+"px";
var _29=(this.endHeight-_27)+"px";
this.toClose.style.height=_28;
this.toOpen.style.height=_29;
},finish:function(){
Element.hide(this.toClose);
this.toOpen.style.height=this.endHeight+"px";
this.toClose.style.height="0px";
Element.undoClipping(this.toOpen);
Element.undoClipping(this.toClose);
Rico.Controls.enableNativeControls(this.toOpen);
}};
Rico.Effect.SizeFromBottom=Class.create();
Rico.Effect.SizeFromBottom.prototype={initialize:function(_2a,y,h){
this.element=$(_2a);
this.y=typeof (y)=="number"?y:this.element.offsetTop;
this.h=typeof (h)=="number"?h:this.element.offsetHeight;
this.options=arguments[3]||{};
},step:function(_2d){
var top=this.element.offsetTop+((this.y-this.element.offsetTop)/_2d)+"px";
var _2f=this.element.offsetHeight+((this.h-this.element.offsetHeight)/_2d)+"px";
var _30=this.element.style;
_30.height=_2f;
_30.top=top;
}};
Rico.Effect.Position=Class.create();
Rico.Effect.Position.prototype={initialize:function(_31,x,y){
this.element=$(_31);
this.x=typeof (x)=="number"?x:this.element.offsetLeft;
this.destTop=typeof (y)=="number"?y:this.element.offsetTop;
},step:function(_34){
var _35=this.element.offsetLeft+((this.x-this.element.offsetLeft)/_34)+"px";
var top=this.element.offsetTop+((this.destTop-this.element.offsetTop)/_34)+"px";
var _37=this.element.style;
_37.left=_35;
_37.top=top;
}};
Rico.Effect.FadeTo=Class.create();
Rico.Effect.FadeTo.prototype={initialize:function(_38,_39){
this.element=_38;
this.opacity=Element.getStyle(this.element,"opacity")||1;
this.target=Math.min(_39,1);
},step:function(_3a){
var _3b=Element.getStyle(this.element,"opacity");
var _3c=_3b+(this.target-_3b)/_3a;
Rico.Effect.setOpacity(this.element,Math.min(Math.max(0,_3c),1));
}};
Rico.Effect.FadeOut=Class.create();
Rico.Effect.FadeOut.prototype={initialize:function(_3d){
this.effect=new Rico.Effect.FadeTo(_3d,0);
},step:function(_3e){
this.effect.step(_3e);
}};
Rico.Effect.FadeIn=Class.create();
Rico.Effect.FadeIn.prototype={initialize:function(_3f){
var _40=arguments[1]||{};
var _41=_40.startValue||0;
Rico.Effect.setOpacity(_3f,_41);
this.effect=new Rico.Effect.FadeTo(_3f,1);
},step:function(_42){
this.effect.step(_42);
}};
Rico.Effect.setOpacity=function(_43,_44){
if(_43.setOpacity){
_43.setOpacity(_44);
}else{
_43.style.filter="alpha(opacity="+Math.round(_44*100)+")";
_43.style.opacity=_44;
}
};
Rico.Effect.SizeFromTop=Class.create();
Rico.Effect.SizeFromTop.prototype={initialize:function(_45,_46,y,h){
this.element=$(_45);
this.h=typeof (h)=="number"?h:this.element.offsetHeight;
this.scrollElement=_46;
this.options=arguments[4]||{};
this.baseHeight=this.options.baseHeight||Math.max(this.h,this.element.offsetHeight);
},step:function(_49){
var _4a=this.element.offsetHeight+((this.h-this.element.offsetHeight)/_49);
var _4b=_4a+"px";
var _4c=(_4a-this.baseHeight)+"px";
this.scrollElement.style.top=_4c;
this.element.style.height=_4b;
}};
Rico.Effect.Height=Class.create();
Rico.Effect.Height.prototype={initialize:function(_4d,_4e){
this.element=_4d;
this.endHeight=_4e;
},step:function(_4f){
if(this.element.constructor!=Array){
var _50=this.element.offsetHeight+((this.endHeight-this.element.offsetHeight)/_4f)+"px";
this.element.style.height=_50;
}else{
var _50=this.element[0].offsetHeight+((this.endHeight-this.element[0].offsetHeight)/_4f)+"px";
this.element.each(function(e){
e.style.height=_50;
});
}
}};
Rico.Effect.SizeWidth=Class.create();
Rico.Effect.SizeWidth.prototype={initialize:function(_52,_53){
this.element=_52;
this.endWidth=_53;
},step:function(_54){
delta=Math.abs(this.endWidth-parseInt(this.element.offsetWidth))/(_54);
this.element.style.width=(this.element.offsetWidth-delta)+"px";
}};
Rico.Controls={editors:[],scrollSelectors:[],disableNativeControls:function(_55){
Rico.Controls.defaultDisabler.disableNative(_55);
},enableNativeControls:function(_56){
Rico.Controls.defaultDisabler.enableNative(_56);
},prepareForSizing:function(_57){
Element.makeClipping(_57);
Rico.Controls.disableNativeControls(_57);
},resetSizing:function(_58){
Element.undoClipping(_58);
Rico.Controls.enableNativeControls(_58);
},registerScrollSelectors:function(_59){
_59.each(function(s){
Rico.Controls.scrollSelectors.push(Rico.selector(s));
});
}};
Rico.Controls.Disabler=Class.create();
Rico.Controls.Disabler.prototype={initialize:function(){
this.options=Object.extend({excludeSet:[],hidables:Rico.Controls.editors},arguments[0]||{});
},disableNative:function(_5b){
if(!(/Konqueror|Safari|KHTML/.test(navigator.userAgent))){
if(!navigator.appVersion.match(/\bMSIE\b/)){
this.blockControls(_5b).each(function(e){
Element.makeClipping(e);
});
}else{
this.hidableControls(_5b).each(function(e){
e.disable();
});
}
}
},enableNative:function(_5e){
if(!(/Konqueror|Safari|KHTML/.test(navigator.userAgent))){
if(!navigator.appVersion.match(/\bMSIE\b/)){
this.blockControls(_5e).each(function(e){
Element.undoClipping(e);
});
}else{
this.hidableControls(_5e).each(function(e){
e.enable();
});
}
}
},blockControls:function(_61){
try{
var _62=[];
if(this.options.includeSet){
_62=this.options.includeSet;
}else{
var _63=this.options.includeSelectors||Rico.Controls.scrollSelectors;
_62=_63.map(function(s){
return s.findAll(_61);
}).flatten();
}
return _62.select(function(e){
return (Element.getStyle(e,"display")!="none")&&!this.options.excludeSet.include(e);
}.bind(this));
}
catch(e){
return [];
}
},hidableControls:function(_66){
if(_66){
return this.options.hidables.select(function(e){
return Element.childOf(e,_66);
});
}else{
return this.options.hidables;
}
}};
Rico.Controls.defaultDisabler=new Rico.Controls.Disabler();
Rico.Controls.blankDisabler=new Rico.Controls.Disabler({includeSet:[],hidables:[]});
Rico.Controls.HidableInput=Class.create();
Rico.Controls.HidableInput.prototype={initialize:function(_68,_69){
this.field=_68;
this.view=_69;
this.enable();
Rico.Controls.editors.push(this);
},enable:function(){
Element.hide(this.view);
Element.show(this.field);
},disable:function(){
this.view.value=$F(this.field);
if(this.field.offsetWidth>1){
this.view.style.width=parseInt(this.field.offsetWidth)+"px";
Element.hide(this.field);
Element.show(this.view);
}
}};
Element.forceRefresh=function(_6a){
try{
var n=document.createTextNode(" ");
_6a.appendChild(n);
_6a.removeChild(n);
}
catch(e){
}
};
Rico.includeLoaded("ricoEffects.js");
