﻿Type.registerNamespace("Telerik.Web.UI.Animations");
(function(){var b=$telerik.$;
var a=Telerik.Web.UI;
a.Animations.playJQueryAnimation=function(d,e,m,o,n,g,p,j){if(!d){return;
}if(!e){e=2;
}if(!m){m=new Sys.UI.Bounds(1,1,1,1);
}if(!o){o=new Sys.UI.Bounds(1,1,1,1);
}var i=j?j:500;
if(!n){n=32;
}n+="";
var h=parseInt(n.substr(0,1));
var k=parseInt(n.substr(1,1));
if(g){g();
}b(d).stop(false,true);
if(e==2){b(d).css({left:o.x,top:o.y}).fadeIn(i,p);
return;
}if(e==8){var f=$telerik.getClientBounds();
var l=$telerik.getClientBounds();
m.x=l.width/2;
m.y=l.height;
switch(k){case 2:m.x=o.x;
break;
case 3:m.x=f.width;
break;
case 1:m.x=f.x;
}switch(h){case 2:m.y=o.y;
break;
case 1:m.y=f.y-o.height;
break;
case 3:m.y=f.height;
}}else{if(e==4){m.x=o.x;
m.y=o.y;
m.width=o.width;
m.height=1;
switch(k){case 2:m.x=o.x;
break;
case 3:m.x=o.x;
break;
case 1:var c=o.x;
if(2==h){c+=o.width;
}m.x=c;
}switch(h){case 2:m.y=o.y;
m.height=o.height;
m.width=1;
break;
case 1:m.y=o.y+o.height;
break;
case 3:m.y=o.y;
}}else{if(e==1){}}}b(d).css({width:m.width,height:m.height,left:m.x,top:m.y,opacity:0.1,filter:"alpha(opacity=10)"}).show().animate({width:o.width,height:o.height,left:o.x,top:o.y,opacity:1},i,null,p);
};
b.fx.prototype.oldstep=b.fx.prototype.step;
b.fx.prototype.step=function(e){var c=this.prop;
if(c=="left"||c=="top"||c=="telerikCarouselAngle"){if(this.elem.getAttribute("paused")){if(!this.elem.getAttribute("elapsedTime")){var d=(+new Date)-this.startTime;
this.elem.setAttribute("elapsedTime",d);
}return true;
}if(this.elem.getAttribute("elapsedTime")){this.startTime=(+new Date)-this.elem.getAttribute("elapsedTime");
this.elem.removeAttribute("elapsedTime");
}}return this.oldstep(e);
};
a.Animations.jMoveBase=function(c,d,e,f){a.Animations.jMoveBase.initializeBase(this);
this._owner=c;
this._element=d;
this._duration=e;
this._events=null;
this._animationEndedDelegate=null;
this._isPlaying=false;
this._isPaused=false;
this._isCyclic=false;
this._easing=f;
this._isDisposed=false;
};
a.Animations.jMoveBase.prototype={initialize:function(){a.Animations.jMoveBase.callBaseMethod(this,"initialize");
this._animationEndedDelegate=Function.createDelegate(this,this._animationEnded);
},dispose:function(){if(this._isDisposed){return;
}this._getAnimationQuery().stop(true,false);
this._owner=null;
this._element=null;
this._animationEndedDelegate=null;
a.Animations.jMoveBase.callBaseMethod(this,"dispose");
this._isDisposed=true;
},get_isPlaying:function(){return this._isPlaying;
},get_isCyclic:function(){return this._isCyclic;
},set_isCyclic:function(c){this._isCyclic=c;
},get_easing:function(){return this._easing;
},set_easing:function(c){this._easing=c;
},get_isActive:function(){return true;
},play:function(c){var h=this._getAnimationQuery();
var d=h.attr("paused");
h.removeAttr("paused");
if(d&&h.attr("elapsedTime")){this._isPlaying=true;
this._isPaused=false;
}else{var f=this._owner;
var g=f.get_frameDuration();
if(this._isPaused&&this._isCyclic&&(g>0&&!c)&&f._setAnimationTimeout){f._setAnimationTimeout(g);
}else{var e=this._animationStarted();
if(e!=false){this._playAnimation();
this._isPlaying=true;
this._isPaused=false;
}}}},stop:function(){this._getAnimationQuery().stop(false,true);
this._isPlaying=false;
},pause:function(){if(this._isPlaying){this._getAnimationQuery().attr("paused",true);
}this._isPlaying=false;
this._isPaused=true;
},add_started:function(c){this.get_events().addHandler("started",c);
},remove_started:function(c){this.get_events().removeHandler("started",c);
},add_ended:function(c){this.get_events().addHandler("ended",c);
},remove_ended:function(c){this.get_events().removeHandler("ended",c);
},_getAnimationQuery:function(){return b(this._element);
},_playAnimation:function(){},_animationStarted:function(){var c=new Sys.CancelEventArgs();
this._raiseEvent("started",c);
return !c.get_cancel();
},_animationEnded:function(){this._isPlaying=false;
this._raiseEvent("ended",Sys.EventArgs.Empty);
},_raiseEvent:function(d,e){var c=this.get_events().getHandler(d);
if(c){if(!e){e=Sys.EventArgs.Empty;
}c(this,e);
}}};
a.Animations.jMoveBase.registerClass("Telerik.Web.UI.Animations.jMoveBase",Sys.Component);
a.Animations.jMove=function(f,c,e,h,g,d){a.Animations.jMove.initializeBase(this,[f,c,e,d]);
this._horizontal=(typeof(h)=="undefined"||h==null)?0:h;
this._vertical=(typeof(g)=="undefined"||g==null)?0:g;
};
a.Animations.jMove.prototype={initialize:function(){a.Animations.jMove.callBaseMethod(this,"initialize");
},dispose:function(){a.Animations.jMove.callBaseMethod(this,"dispose");
},get_vertical:function(){return this._vertical;
},set_vertical:function(c){this._vertical=c;
},get_horizontal:function(){return this._horizontal;
},set_horizontal:function(c){this._horizontal=c;
},_getFinalPosition:function(){return(isNaN(parseInt(this._vertical)))?this._horizontal:this._vertical;
},_getAnimatedProperty:function(){return(isNaN(parseInt(this._vertical)))?"left":"top";
},_getPosition:function(){return this._element.style[this._getAnimatedProperty()];
},_playAnimation:function(){var c=this._getFinalPosition();
var d=this._getAnimationQuery();
var e=this._getAnimatedProperty();
var f={queue:true};
f[e]=c;
d.stop(true,!this._isCyclic).animate(f,this._duration,this._easing,this._animationEndedDelegate);
}};
a.Animations.jMove.registerClass("Telerik.Web.UI.Animations.jMove",a.Animations.jMoveBase);
a.Animations.jCarousel=function(f,c,g,e,d,h){a.Animations.jCarousel.initializeBase(this,[f,c,e,h]);
this._items=g;
this._minScale=d.minScale;
this._x=d.xO;
this._y=d.yO;
this._xRadius=d.xR;
this._yRadius=d.yR;
this._angle=Math.PI/2;
};
a.Animations.jCarousel.prototype={initialize:function(){a.Animations.jCarousel.callBaseMethod(this,"initialize");
},dispose:function(){a.Animations.jCarousel.callBaseMethod(this,"dispose");
this._items=null;
},get_angle:function(){return this._angle;
},set_angle:function(c){this._angle=c;
},_getFinalPosition:function(){return this._angle;
},_getAnimatedProperty:function(){return"telerikCarouselAngle";
},_getAnimationQuery:function(){var c;
b.each(this._items,function(e,d){var f=this.element;
if(!c){c=b(f);
}else{c=c.add(f);
}});
return c;
},_playAnimation:function(){this._getAnimationQuery().stop(true,!this._isCyclic);
var f=this._minScale;
var d=(1-f)/2;
var h=this._items;
var e=(h.length>0)?((Math.PI*2)/h.length):0;
var c=this._angle;
var g=this;
b.each(h,function(i,j){b(this.element).stop(true,false).animate({queue:true,telerikCarouselAngle:c},{xO:g._x,yO:g._y,xR:g._xRadius,yR:g._yRadius,minScale:f,width:this.width,height:this.height,duration:g._duration,easing:g._easing,complete:g._animationEndedDelegate});
c+=e;
});
}};
a.Animations.jCarousel.registerClass("Telerik.Web.UI.Animations.jCarousel",a.Animations.jMoveBase);
b.fx.step.telerikCarouselAngle=function(i){var f=i.now;
var e=i.options;
var k=Math.sin(f);
var h=e.minScale;
var j=h+(k+1)*((1-h)/2);
var d=e.xO+(((Math.cos(f+Math.PI)*e.xR)-e.width/2)*j);
var g=e.yO+((k*e.yR)*j);
i.elem.telerikCarouselAngle=i.now;
var c="px";
b(i.elem).css("display","none").css({width:e.width*j+c,height:e.height*j+c,left:d+c,top:g+c,zIndex:parseInt(j*100)}).css("display","");
};
})();
