Type.registerNamespace("Telerik.Web.UI"); Telerik.Web.UI.RadRotator=function(c){Telerik.Web.UI.RadRotator.initializeBase(this,[c]); this._skin="Default"; this._postBackReference=null; this._items=null; this._webServiceSettings=new Telerik.Web.UI.WebServiceSettings({}); this._webServiceLoader=null; this._containerElement=null; this._clickDelegate=null; this._mouseOutDelegate=null; this._mouseOverDelegate=null; this._itemShownDelegate=null; this._rotatorDisposed=false; this._useRandomSlide=false; var d=Telerik.Web.UI.RotatorScrollDirection; this._scrollDirection=d.Left+d.Right; this._slideShowAnimationSettings={}; this._rotatorType=Telerik.Web.UI.RotatorType.AutomaticAdvance; this._scrollDuration=500; this._frameDuration=2000; this._initialItemIndex=0; this._canPause=true; this._pauseOnMouseOver=true; this._wrapFrames=true; this._controlButtons={}; this._relativeWrapper=null; this._clipElement=null; this._itemsElement=null; this._animationDirection=d.Left; this._rightButton=null; this._leftButton=null; this._downButton=null; this._upButton=null }; Telerik.Web.UI.RadRotator.prototype={initialize:function(){Telerik.Web.UI.RadRotator.callBaseMethod(this,"initialize"); this._rotatorDisposed=false; this._wrapFramesFinished=false; this._setChildElements(); this._createUI(); this._createChildItems(); this._attachEvents(true); this._initialItemSet=false; this._loadInitialFrame(); this._enableDisableButtons(); this._fixVisibilityProblems(true); if($telerik.isSafari){$addHandler(this.get_containerElement(),"mousewheel",this._mouseWheelHandler) }this.raiseEvent("load",Sys.EventArgs.Empty); if(this.isAutomaticAdvance()){var b=this.get_frameDuration(); if(b>0){window.setTimeout(Function.createDelegate(this,this.startAutoPlay),b) }else{this.startAutoPlay() }}},dispose:function(){this._rotatorDisposed=true; this._fixVisibilityProblems(false); this._attachEvents(false); this._containerElement=null; if(this._animation){this._animation.dispose(); this._animation=null }if(this._rightButton){$clearHandlers(this._rightButton) }if(this._leftButton){$clearHandlers(this._leftButton) }if(this._downButton){$clearHandlers(this._downButton) }if(this._upButton){$clearHandlers(this._upButton) }if($telerik.isSafari){$removeHandler(this.get_containerElement(),"mousewheel",this._mouseWheelHandler) }if(this._itemsElement){$clearHandlers(this._itemsElement) }Telerik.Web.UI.RadRotator.callBaseMethod(this,"dispose") },_createChildItems:function(){var h=$telerik.getChildrenByTagName(this.get_containerElement(),"li"); for(var f=0; fg.length-1||this._nextItemIndex<0){this._nextItemIndex=null }return e },get_firstItem:function(){var d=this._firstItem; if(!d){var c=this.getItemHtmlElements(); d=this.isScrollingForward()?c[0]:c[c.length-1] }return d },get_currentItem:function(){var k=this.getItemHtmlElements(); var i=parseInt(k[0].parentNode.style.left),l="left"; if(isNaN(i)||i==0){i=parseInt(k[0].parentNode.style.top); l="top" }var n=0,h=k.length; while(i<0&&n0){this._setAnimationTimeout(this.get_frameDuration()) }else{this._animation.play() }}})) }this._animation.stop(); this._animation.play() },_checkItemsSize:function(){var e=$telerik.getOuterSize(this._itemsElement); var g=this.get_vertical(); var h=(g)?e.height:e.width; var f=(g)?this.get_height():this.get_width(); return parseInt(h)>parseInt(f) },_shiftItemInList:function(){var j=this._itemsElement; var n=this.getItemHtmlElements(); var k=this.get_vertical(); var l=this.isScrollingForward(); var i=parseInt(j.style.left); var p=parseInt(j.style.top); var m=l?n[0]:n[n.length-1]; var o=$telerik.getOuterSize(m); m.parentNode.removeChild(m); if(!l){j.insertBefore(m,j.firstChild) }if(k){j.style.top=(p+(l?o.height:-o.height))+"px" }else{j.style.left=(i+(l?o.width:-o.width))+"px" }if(l){j.appendChild(m) }this._nextItemIndex=l?n.length-1:0; return m },_loadInitialFrame:function(){var m=this.get_initialItemIndex(); var s=this.get_defaultAnimationDirection(); var l=Telerik.Web.UI.RotatorScrollDirection; var q=this.isVertical(); var n=this._itemsElement; var r=$telerik.getOuterSize(n); var t=$telerik.getContentSize(this._clipElement); var o=0; var p=0; if(m>=0){if(q){p=(s==l.Up)?0:-r.height+t.height }else{o=(s==l.Left)?0:-r.width+t.width }}else{if(m==-1){if(q){p=(s==l.Down)?-r.height:t.height }else{o=(s==l.Right)?-r.width:t.width }}}n.style.left=o+"px"; n.style.top=p+"px"; if(m>0&&!this._initialItemSet){for(var i=0; i=0){this.raiseEvent("itemShown",new Telerik.Web.UI.RadRotatorEventArgs(this.get_items()[m])) }this._initialItemSet=true },pause:function(){if(this._isPaused){return }this._isPaused=true; if(this._animation&&this._animation.get_isActive()){this._animation.pause() }},resume:function(){if(this._timeoutPassed||!this._isPaused){if(this._animation){this._animation.play(this._timeoutPassed) }}else{if(this._isPaused){if(this._animation&&this._animation.get_isActive()){this._animation.play() }}}this._isPaused=false },stop:function(){this._clearAnimationTimeout(); this._canPause=false; this.pause() },start:function(){this._canPause=true; this._isPaused=false; this.resume() },isViewportScrollMode:function(){var b=Telerik.Web.UI.RotatorType; if(this._isRotatorTypeEnabled(b.AutomaticAdvance)||this._isRotatorTypeEnabled(b.ButtonsOver)||this._isRotatorTypeEnabled(b.FromCode)){return false }return true },_getButtonScrollDirection:function(e){var f=Telerik.Web.UI.RotatorScrollDirection; var d=f.Left; switch(e){case this._rightButton:d=f.Left; break; case this._leftButton:d=f.Right; break; case this._downButton:d=f.Up; break; case this._upButton:d=f.Down; break }return d },_buttonClicked:function(h){var g=h.target; if(this._isButtonDisabled(g)){return }var e=new Telerik.Web.UI.RadRotatorButtonEventArgs(g); this.raiseEvent("buttonClick",e); if(e.get_cancel()){return }var f=this._getButtonScrollDirection(g); this.set_animationDirection(f); this.scrollViewport(); return $telerik.cancelRawEvent(h) },_buttonOver:function(h){var g=h.target; if(this._isButtonDisabled(g)){return }var e=new Telerik.Web.UI.RadRotatorButtonEventArgs(g); this.raiseEvent("buttonOver",e); if(e.get_cancel()){return }var f=this._getButtonScrollDirection(g); this.set_animationDirection(f); this._stopAnimationButtonOver=false; this.scrollItem(); return $telerik.cancelRawEvent(h) },_buttonOut:function(h){var g=h.target; if(this._isButtonDisabled(g)){return }var e=new Telerik.Web.UI.RadRotatorButtonEventArgs(g); this.raiseEvent("buttonOut",e); if(e.get_cancel()){return }var f=this._getButtonScrollDirection(g); this.set_animationDirection(f); this._stopAnimationButtonOver=true; return $telerik.cancelRawEvent(h) },_initializeButtonsRotatorType:function(){var t=this.get_controlButtons(); this._rightButton=$telerik.getElementByClassName(this._rootElement,this._rotatorRightClass); this._leftButton=$telerik.getElementByClassName(this._rootElement,this._rotatorLeftClass); this._downButton=$telerik.getElementByClassName(this._rootElement,this._rotatorDownClass); this._upButton=$telerik.getElementByClassName(this._rootElement,this._rotatorUpClass); var H=Telerik.Web.UI.RotatorScrollDirection; var G=[H.Right,H.Left,H.Down,H.Up]; var w=[this._leftButton,this._rightButton,this._upButton,this._downButton]; var s=[t.LeftButtonID?$get(t.LeftButtonID):null,t.RightButtonID?$get(t.RightButtonID):null,t.UpButtonID?$get(t.UpButtonID):null,t.DownButtonID?$get(t.DownButtonID):null]; var x=[this._rotatorLeftClass,this._rotatorRightClass,this._rotatorUpClass,this._rotatorDownClass]; var C=["marginLeft","marginRight","marginTop","marginBottom"]; var y=["paddingLeft","paddingRight","paddingTop","paddingBottom"]; var B=["width","width","height","height"]; var A=this._relativeWrapper; var v=this.get_element(); for(var u=0; u0&&this.isAutomaticAdvance()){this._setAnimationTimeout(this.get_frameDuration()) }}); switch(e){case Telerik.Web.UI.RotatorAnimationType.Fade:this._canPause=false; $telerik.$(f).css("opacity","0").fadeTo(g,1,h); break; case Telerik.Web.UI.RotatorAnimationType.Pulse:this._canPause=false; $telerik.$(f).fadeTo(g,0).fadeTo(g,1,h); break; default:h(); break }},_hasViewportWidth:function(k){if(null==k){k=this.get_animationDirection() }var o=this._itemsElement; var n=this._clipElement; var l=parseInt(o.style.left); var q=parseInt(o.style.top); var p=$telerik.getOuterSize(o); var r=$telerik.getContentSize(n); var m=false; var j=Telerik.Web.UI.RotatorScrollDirection; switch(k){case j.Left:m=p.width+lr.width }else{if(o==j.Up){m=(q.height+p)>r.height }else{if(o==j.Right){m=(l<0) }else{if(o==j.Down){m=(p<0) }}}}return m },_getCalculatedAnimationDirection:function(){var d=this.get_animationDirection(); var f=Telerik.Web.UI.RotatorScrollDirection; var e=23; switch(d){case f.Left:e=21; break; case f.Down:e=32; break; case f.Up:e=12; break; default:e=23 }return e },startAutoPlay:function(){if(this._rotatorDisposed){return }this._loadInitialFrame(); this.showNext(this.get_defaultAnimationDirection()) },get_defaultAnimationDirection:function(){var d=Telerik.Web.UI.RotatorScrollDirection; var c=0; if(this._isScrollDirectionEnabled(d.Left)){c=d.Left }else{if(this._isScrollDirectionEnabled(d.Up)){c=d.Up }else{if(this._isScrollDirectionEnabled(d.Right)){c=d.Right }else{if(this._isScrollDirectionEnabled(d.Down)){c=d.Down }}}}if(!c){c=d.Left }return c },get_containerElement:function(){return this._itemsElement },_setChildElements:function(){this._rotatorListClass="rrItemsList"; this._rotatorVerticalClass="rrVerticalList"; this._rotatorRelativeWrapperClass="rrRelativeWrapper"; this._rotatorClipRegionClass="rrClipRegion"; this._rotatorRightClass="rrButtonRight"; this._rotatorLeftClass="rrButtonLeft"; this._rotatorDownClass="rrButtonDown"; this._rotatorUpClass="rrButtonUp"; this._rotatorButtonDisabledClass="rrButtonDisabled"; this._rootElement=this.get_element(); this._relativeWrapper=$telerik.getElementByClassName(this._rootElement,this._rotatorRelativeWrapperClass); this._clipElement=$telerik.getElementByClassName(this._rootElement,this._rotatorClipRegionClass); this._itemsElement=$telerik.getElementByClassName(this._rootElement,this._rotatorListClass) },_createUI:function(){if(!this.isVisible()){return }this._fixRootElementSize(); var e=this.get_element(); var h=this._relativeWrapper; h.style.height=e.offsetHeight+"px"; h.style.width=e.offsetWidth+"px"; var g=true; if(this._isRotatorTypeEnabled(Telerik.Web.UI.RotatorType.Buttons)||this._isRotatorTypeEnabled(Telerik.Web.UI.RotatorType.ButtonsOver)||this._isRotatorTypeEnabled(Telerik.Web.UI.RotatorType.SlideShowButtons)){g=this._initializeButtonsRotatorType() }if(g){Sys.UI.DomElement.addCssClass(e,"rrNoBorder") }if(this.get_vertical()){this.set_vertical(true) }h.style.overflow="auto"; var f=this._clipElement; f.style.overflow="auto"; f.style.width="10000px"; f.style.height="10000px"; this._itemsElement.style.width=this.get_vertical()?h.style.width:this._itemsElement.offsetWidth+"px"; this._itemsElement.style.height=this._itemsElement.offsetHeight+"px"; h.style.overflow=""; f.style.width=h.style.width; f.style.height=h.style.height; f.style.overflow="hidden"; f.style.position="relative"; this._itemsElement.style.position="relative"; e.style.visibility="visible" },_fixRootElementSize:function(){var d=this.get_element(); var f=Telerik.Web.UI.RotatorScrollDirection; var e=parseInt(d.style.paddingLeft); if(e&&!isNaN(e)&&this._isScrollDirectionEnabled(f.Left)){d.style.width=(parseInt(d.style.width)+e)+"px"; d.style.paddingLeft="" }e=parseInt(d.style.paddingRight); if(e&&!isNaN(e)&&this._isScrollDirectionEnabled(f.Right)){d.style.width=(parseInt(d.style.width)+e)+"px"; d.style.paddingRight="" }e=parseInt(d.style.paddingTop); if(e&&!isNaN(e)&&this._isScrollDirectionEnabled(f.Up)){d.style.height=(parseInt(d.style.height)+e)+"px"; d.style.paddingTop="" }e=parseInt(d.style.paddingBottom); if(e&&!isNaN(e)&&this._isScrollDirectionEnabled(f.Down)){d.style.height=(parseInt(d.style.height)+e)+"px"; d.style.paddingBottom="" }},_createButton:function(f,e){var d=f; if(!d){d=document.createElement("div") }if(!d.className){d.className=this._rotatorDownClass }return d },_isButtonDisabled:function(b){if(!b){return true }return Sys.UI.DomElement.containsCssClass(b,this._rotatorButtonDisabledClass) },_isScrollDirectionEnabled:function(b){return b&this._scrollDirection?true:false },_isRotatorTypeEnabled:function(b){return b==this._rotatorType?true:false },get_rotatorType:function(){return this._rotatorType },set_rotatorType:function(b){this._rotatorType=b },get_wrapFrames:function(){return this._wrapFrames },set_wrapFrames:function(b){this._wrapFrames=b },get_scrollDuration:function(){if(this.isSlideShow()){return 1 }else{return this._scrollDuration }},set_scrollDuration:function(b){this._scrollDuration=b },set_vertical:function(b){if(this._itemsElement){Sys.UI.DomElement.addCssClass(this._itemsElement,this._rotatorVerticalClass) }},get_vertical:function(){var b=Telerik.Web.UI.RotatorScrollDirection; return(this._isScrollDirectionEnabled(b.Down)||this._isScrollDirectionEnabled(b.Up)) },isVertical:function(){if(this._itemsElement){return Sys.UI.DomElement.containsCssClass(this._itemsElement,this._rotatorVerticalClass) }return false },get_height:function(){return this.get_element().style.height },set_height:function(b){this.get_element().style.height=b; if(this.isVisible()){this.repaint() }},get_width:function(){return this.get_element().style.width },set_width:function(b){this.get_element().style.width=b; if(this.isVisible()){this.repaint() }},get_scrollDirection:function(){return this._scrollDirection },set_scrollDirection:function(b){this._scrollDirection=b },get_frameDuration:function(){return this._frameDuration },set_frameDuration:function(b){this._frameDuration=b },get_controlButtons:function(){return this._controlButtons },set_controlButtons:function(b){this._controlButtons=b },get_initialItemIndex:function(){return this._initialItemIndex },set_initialItemIndex:function(b){this._initialItemIndex=b },get_slideShowAnimationSettings:function(){return this._slideShowAnimationSettings },set_slideShowAnimationSettings:function(b){this._slideShowAnimationSettings=b },set_animationDirection:function(b){this._animationDirection=b?b:Telerik.Web.UI.RotatorScrollDirection.Left },get_animationDirection:function(){return this._animationDirection },_attachEvents:function(c){var d=this.get_containerElement(); if(null==d){return }if(c!=false){this._clickDelegate=Function.createDelegate(this,this._mouseClickHandler); this._mouseOutDelegate=Function.createDelegate(this,this._mouseOutHandler); this._mouseOverDelegate=Function.createDelegate(this,this._mouseOverHandler); this._itemShownDelegate=Function.createDelegate(this,this._itemShownHandler); $addHandler(d,"mouseover",this._mouseOverDelegate); $addHandler(d,"mouseout",this._mouseOutDelegate); $addHandler(d,"click",this._clickDelegate); this.add_itemShown(this._itemShownDelegate) }else{$removeHandler(d,"mouseover",this._mouseOverDelegate); $removeHandler(d,"mouseout",this._mouseOutDelegate); $removeHandler(d,"click",this._clickDelegate); this._clickDelegate=null; this._mouseOutDelegate=null; this._mouseOverDelegate=null; this.remove_itemShown(this._itemShownDelegate) }},_itemShownHandler:function(g){if(typeof(Telerik.Web.UI.RadTicker)=="undefined"){return }var i=this.get_items(); for(var j=0,f=i.length; j0){for(var g=0; g