var Fx=fx={};Fx.Base=function(){};Fx.Base.prototype={setOptions:function(a){this.options=Object.extend({onStart:function(){},onComplete:function(){},transition:Fx.Transitions.sineInOut,duration:500,unit:"px",wait:true,fps:50},a||{})},step:function(){var a=new Date().getTime();if(a<this.time+this.options.duration){this.cTime=a-this.time;this.setNow()}else{setTimeout(this.options.onComplete.bind(this,this.element),10);this.clearTimer();this.now=this.to}this.increase()},setNow:function(){this.now=this.compute(this.from,this.to)},compute:function(c,b){var a=b-c;return this.options.transition(this.cTime,c,a,this.options.duration)},clearTimer:function(){clearInterval(this.timer);this.timer=null;return this},_start:function(b,a){if(!this.options.wait){this.clearTimer()}if(this.timer){return}setTimeout(this.options.onStart.bind(this,this.element),10);this.from=b;this.to=a;this.time=new Date().getTime();this.timer=setInterval(this.step.bind(this),Math.round(1000/this.options.fps));return this},custom:function(b,a){return this._start(b,a)},set:function(a){this.now=a;this.increase();return this},hide:function(){return this.set(0)},setStyle:function(c,b,a){if(b=="opacity"){if(a==0&&c.style.visibility!="hidden"){c.style.visibility="hidden"}else{if(c.style.visibility!="visible"){c.style.visibility="visible"}}if(window.ActiveXObject){c.style.filter="alpha(opacity="+a*100+")"}c.style.opacity=a}else{c.style[b]=a+this.options.unit}}};Fx.Height=Class.create();Fx.Height.prototype=Object.extend(new Fx.Base(),{initialize:function(b,a){this.element=$(b);this.setOptions(a);this.element.style.overflow="hidden"},toggle:function(){return(this.element.offsetHeight>0)?this.custom(this.element.offsetHeight,0):this.custom(0,this.element.scrollHeight)},show:function(){return this.set(this.element.scrollHeight)},increase:function(){this.setStyle(this.element,"height",this.now)}});Fx.Width=Class.create();Fx.Width.prototype=Object.extend(new Fx.Base(),{initialize:function(b,a){this.element=$(b);this.setOptions(a);this.element.style.overflow="hidden";this.iniWidth=this.element.offsetWidth},toggle:function(){if(this.element.offsetWidth>0){return this.custom(this.element.offsetWidth,0)}else{return this.custom(0,this.iniWidth)}},show:function(){return this.set(this.iniWidth)},increase:function(){this.setStyle(this.element,"width",this.now)}});Fx.Opacity=Class.create();Fx.Opacity.prototype=Object.extend(new Fx.Base(),{initialize:function(b,a){this.element=$(b);this.setOptions(a);this.now=1},toggle:function(){if(this.now>0){return this.custom(1,0)}else{return this.custom(0,1)}},show:function(){return this.set(1)},increase:function(){this.setStyle(this.element,"opacity",this.now)}});Fx.Transitions={linear:function(e,a,g,f){return g*e/f+a},sineInOut:function(e,a,g,f){return -g/2*(Math.cos(Math.PI*e/f)-1)+a}};Fx.Scroll=Class.create();Fx.Scroll.prototype=Object.extend(new Fx.Base(),{initialize:function(b,a){this.element=$(b);this.setOptions(a);this.element.style.overflow="hidden"},down:function(){return this.custom(this.element.scrollTop,this.element.scrollHeight-this.element.offsetHeight)},up:function(){return this.custom(this.element.scrollTop,0)},increase:function(){this.element.scrollTop=this.now}});Fx.ViewPortScrollVertical=Class.create();Fx.ViewPortScrollVertical.prototype=Object.extend(new Fx.Base(),{initialize:function(a){this.setOptions(a)},toggle:function(b){var a=document.viewport.getScrollOffsets();return this.custom(a.top,b)},increase:function(){window.scrollTo(0,this.now)}});Fx.Color=Class.create();Fx.Color.prototype=Object.extend(new Fx.Base(),{initialize:function(b,c,a){this.element=$(b);this.setOptions(a);this.property=c.camelize();this.now=[]},custom:function(b,a){return this._start(b.hexToRgb(true),a.hexToRgb(true))},setNow:function(){[0,1,2].each(function(a){this.now[a]=Math.round(this.compute(this.from[a],this.to[a]))}.bind(this))},increase:function(){this.element.style[this.property]="rgb("+this.now[0]+","+this.now[1]+","+this.now[2]+")"}});Object.extend(String.prototype,{rgbToHex:function(f){var a=this.match(new RegExp("([\\d]{1,3})","g"));if(a[3]==0){return"transparent"}var c=[];for(var b=0;b<3;b++){var e=(a[b]-0).toString(16);c.push(e.length==1?"0"+e:e)}var d="#"+c.join("");if(f){return c}else{return d}},hexToRgb:function(e){var d=this.match(new RegExp("^[#]{0,1}([\\w]{1,2})([\\w]{1,2})([\\w]{1,2})$"));var b=[];for(var c=1;c<d.length;c++){if(d[c].length==1){d[c]+=d[c]}b.push(parseInt(d[c],16))}var a="rgb("+b.join(",")+")";if(e){return b}else{return a}}});