var userAgent=navigator.userAgent.toLowerCase();
var browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};
function AnimateObj(E,H,G,F,D,B,C){var A=this;
this.animateWrapper=function(){A.animate()
};
this.startWrapper=function(){A.start()
};
this.init(E,H,G,F,D,B,C)
}AnimateObj.prototype={init:function(D,G,F,E,C,A,B){this.obj=D;
this.from=F;
this.prop=G;
this.to=E;
this.duration=C;
this.delay=A?A:0;
this.removeWhenDone=B?B:false;
this.delayedStart()
},delayedStart:function(){setTimeout(this.startWrapper,this.delay)
},start:function(){if(this.timerId==null){this.startTime=new Date().getTime();
this.timerId=setInterval(this.animateWrapper,20)
}},stop:function(){clearInterval(this.timerId);
this.timerId=null;
if(this.removeWhenDone){this.obj.parentNode.removeChild(this.obj)
}},animate:function(){var A=new Date().getTime();
var C=(this.to-this.from)*this.easeIn(Math.min((A-this.startTime)/this.duration,1));
var B=this.from+C;
if(this.prop=="opacity"){if(browser.msie){this.obj.style.filter=(B==1)?"":"alpha(opacity="+B+")"
}else{this.obj.style.opacity=B/100
}}else{this.obj.style[this.prop]=B+"px"
}if(B==this.to){this.stop()
}},easeIn:function(A){return -(Math.cos(A*Math.PI)/2)+0.5
}};
function AnimatedScroll(D,C,A){var B=this;
this.timerFunction=function(){B.animate()
};
this.from=D!=null?D:this.getCurrentPostion();
this.to=C;
this.duration=A;
this.start()
}AnimatedScroll.prototype={start:function(){if(this.timerId==null){this.startTime=new Date().getTime();
this.timerId=setInterval(this.timerFunction,20)
}},stop:function(){clearInterval(this.timerId);
this.timerId=null
},animate:function(){var B=new Date().getTime();
var A=B-this.startTime;
var D=Math.min(A/this.duration,1);
D=this.easeIn(D);
var E=(this.to-this.from)*D;
var C=this.from+E;
window.scrollTo(window.scrollX,C);
if(C==this.to||A>this.duration){this.stop()
}},getCurrentPostion:function(){if(document.body&&document.body.scrollTop){return document.body.scrollTop
}if(document.documentElement&&document.documentElement.scrollTop){return document.documentElement.scrollTop
}if(window.pageYOffset){return window.pageYOffset
}return 0
},easeIn:function(A){return 1-Math.pow(1-A,2)
}};
