Type.registerNamespace("Telerik.Web.UI"); $telerik.toRotator=function(a){return a; }; $telerik.findRotator=$find; Telerik.Web.UI.RadRotator=function(a){Telerik.Web.UI.RadRotator.initializeBase(this,[a]); this._enabled=true; 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 b=Telerik.Web.UI.RotatorScrollDirection; this._scrollDirection=b.Left+b.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=b.Left; this._rightButton=null; this._leftButton=null; this._downButton=null; this._upButton=null; this._isMouseOverClipElement=false; }; Telerik.Web.UI.RadRotator.prototype={initialize:function(){Telerik.Web.UI.RadRotator.callBaseMethod(this,"initialize"); this._rotatorDisposed=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 a=this.get_frameDuration(); if(a>0){window.setTimeout(Function.createDelegate(this,this.startAutoPlay),a); }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 d=$telerik.getChildrenByTagName(this.get_containerElement(),"li"); for(var a=0; aa.length-1||this._nextItemIndex<0){this._nextItemIndex=null; }return c; },get_firstItem:function(){var b=this._firstItem; if(!b){var a=this.getItemHtmlElements(); b=this.isScrollingForward()?a[0]:a[a.length-1]; }return b; },get_currentItem:function(){var a=this.getItemHtmlElements(); var b=this._getCurrentItemIndex(); return(b=e.length){return; }var k=this._getVarSizeAttribute(); var f=$telerik.getOuterSize(e[g])[k]; var m=parseInt($telerik.getContentSize(this._clipElement)[k]/f); var h=g+(this.isScrollingForward()?1:-1)*m; if(h>=0&&h0){this._setAnimationTimeout(this.get_frameDuration()); }else{this._animation.play(); }}})); }this._animation.stop(); this._animation.play(); },_checkItemsSize:function(){var c=$telerik.getOuterSize(this._itemsElement); var b=this.get_vertical(); var a=(b)?c.height:c.width; var d=(b)?this.get_height():this.get_width(); return parseInt(a)>parseInt(d); },_shiftItemInList:function(){var f=this._itemsElement; var b=this.getItemHtmlElements(); var g=this.get_vertical(); var c=this.isScrollingForward(); var h=parseInt(f.style.left); var d=parseInt(f.style.top); var e=c?b[0]:b[b.length-1]; var a=$telerik.getOuterSize(e); e.parentNode.removeChild(e); if(!c){f.insertBefore(e,f.firstChild); }if(g){f.style.top=(d+(c?a.height:-a.height))+"px"; }else{f.style.left=(h+(c?a.width:-a.width))+"px"; }if(c){f.appendChild(e); }this._nextItemIndex=c?b.length-1:0; return e; },_loadInitialFrame:function(){var c=this.get_initialItemIndex(); var h=this.get_defaultAnimationDirection(); var g=Telerik.Web.UI.RotatorScrollDirection; var k=this.isVertical(); var e=this._itemsElement; var a=$telerik.getOuterSize(e); var j=$telerik.getContentSize(this._clipElement); var b=0; var d=0; if(c>=0){if(k){d=(h==g.Up)?0:-a.height+j.height; }else{b=(h==g.Left)?0:-a.width+j.width; }}else{if(c==-1){if(k){d=(h==g.Down)?-a.height:j.height; }else{b=(h==g.Right)?-a.width:j.width; }}}e.style.left=b+"px"; e.style.top=d+"px"; if(c>0&&!this._initialItemSet){for(var f=0; f=0){this.raiseEvent("itemShown",new Telerik.Web.UI.RadRotatorEventArgs(this.get_items()[c])); }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 a=Telerik.Web.UI.RotatorType; if(this._isRotatorTypeEnabled(a.AutomaticAdvance)||this._isRotatorTypeEnabled(a.ButtonsOver)||this._isRotatorTypeEnabled(a.FromCode)){return false; }return true; },_getButtonScrollDirection:function(c){var a=Telerik.Web.UI.RotatorScrollDirection; var b=a.Left; switch(c){case this._rightButton:b=a.Left; break; case this._leftButton:b=a.Right; break; case this._downButton:b=a.Up; break; case this._upButton:b=a.Down; break; }return b; },_buttonClicked:function(f){if(!this.get_enabled()){$telerik.cancelRawEvent(f); return false; }var d=this._animation; if(d&&d.get_isPlaying()){d.stop(); }var a=f.target; if(this._isButtonDisabled(a)||this.get_items().length==0){return; }var c=new Telerik.Web.UI.RadRotatorButtonEventArgs(a); this.raiseEvent("buttonClick",c); if(c.get_cancel()){return; }var b=this._getButtonScrollDirection(a); this.set_animationDirection(b); this.scrollViewport(); return $telerik.cancelRawEvent(f); },_buttonOver:function(d){if(!this.get_enabled()){$telerik.cancelRawEvent(d); return false; }var a=d.target; if(this._isButtonDisabled(a)||this.get_items().length==0){return; }var c=new Telerik.Web.UI.RadRotatorButtonEventArgs(a); this.raiseEvent("buttonOver",c); if(c.get_cancel()){return; }var b=this._getButtonScrollDirection(a); this.set_animationDirection(b); this._stopAnimationButtonOver=false; this.scrollItem(); return $telerik.cancelRawEvent(d); },_buttonOut:function(d){if(!this.get_enabled()){$telerik.cancelRawEvent(d); return false; }var a=d.target; if(this._isButtonDisabled(a)){return; }var c=new Telerik.Web.UI.RadRotatorButtonEventArgs(a); this.raiseEvent("buttonOut",c); if(c.get_cancel()){return; }var b=this._getButtonScrollDirection(a); this.set_animationDirection(b); this._stopAnimationButtonOver=true; return $telerik.cancelRawEvent(d); },_initializeButtonsRotatorType:function(){var n=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 r=Telerik.Web.UI.RotatorScrollDirection; var m=[r.Right,r.Left,r.Down,r.Up]; var p=[this._leftButton,this._rightButton,this._upButton,this._downButton]; var g=[n.LeftButtonID?$get(n.LeftButtonID):null,n.RightButtonID?$get(n.RightButtonID):null,n.UpButtonID?$get(n.UpButtonID):null,n.DownButtonID?$get(n.DownButtonID):null]; var h=[this._rotatorLeftClass,this._rotatorRightClass,this._rotatorUpClass,this._rotatorDownClass]; var c=["marginLeft","marginRight","marginTop","marginBottom"]; var b=["paddingLeft","paddingRight","paddingTop","paddingBottom"]; var j=["width","width","height","height"]; var a=this._relativeWrapper; var d=this.get_element(); for(var k=0; k1){return; }this._canPause=true; if(c!=Telerik.Web.UI.RotatorAnimationType.None){if(g){$telerik.$(this.getItemHtmlElements()).css({position:"",visibility:""}); $telerik.$(b).css("visibility","visible"); }else{$telerik.$(b).css("opacity","1"); }}var e=this.get_currentItem(); this.raiseEvent("itemShown",new Telerik.Web.UI.RadRotatorEventArgs(e)); if(!this.get_pauseOnMouseOver()||(!this._isMouseOverClipElement)){if(this.isAutomaticAdvance()){var f=this.get_frameDuration(); if(f>=0){this._setAnimationTimeout(f); }}}}); switch(c){case Telerik.Web.UI.RotatorAnimationType.Fade:this._canPause=false; $telerik.$(b).css("opacity","0").fadeTo(d,1,a); break; case Telerik.Web.UI.RotatorAnimationType.Pulse:this._canPause=false; $telerik.$(b).fadeTo(d,0).fadeTo(d,1,a); break; case Telerik.Web.UI.RotatorAnimationType.CrossFade:this._canPause=false; this._runCrossFadeSlideShowAnimation(d,a); break; default:a(); break; }},_runCrossFadeSlideShowAnimation:function(a,n){var j=this._itemsElement; var h=(-1)*parseInt(j.style.top)+"px"; var l=(-1)*parseInt(j.style.left)+"px"; var e=this.getItemHtmlElements(); var g=this._getCurrentItemIndex(); if(g>=e.length){return; }var k=this._getVarSizeAttribute(); var f=$telerik.getOuterSize(e[g])[k]; var m=parseInt($telerik.getContentSize(this._clipElement)[k]/f); var i=g-(this.isScrollingForward()?1:-1)*m; if(i>=0&&ib.width; }else{if(f==i.Up){g=(a.height+e)>b.height; }else{if(f==i.Right){g=(h<0); }else{if(f==i.Down){g=(e<0); }}}}return g; },_getCalculatedAnimationDirection:function(){var b=this.get_animationDirection(); var a=Telerik.Web.UI.RotatorScrollDirection; var c=23; switch(b){case a.Left:c=21; break; case a.Down:c=32; break; case a.Up:c=12; break; default:c=23; }return c; },startAutoPlay:function(){if(this._rotatorDisposed){return; }this._loadInitialFrame(); this.showNext(this.get_defaultAnimationDirection()); },get_defaultAnimationDirection:function(){var b=Telerik.Web.UI.RotatorScrollDirection; var a=0; if(this._isScrollDirectionEnabled(b.Left)){a=b.Left; }else{if(this._isScrollDirectionEnabled(b.Up)){a=b.Up; }else{if(this._isScrollDirectionEnabled(b.Right)){a=b.Right; }else{if(this._isScrollDirectionEnabled(b.Down)){a=b.Down; }}}}if(!a){a=b.Left; }return a; },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 d=this.get_element(); var c=this._relativeWrapper; c.style.height=d.offsetHeight+"px"; c.style.width=d.offsetWidth+"px"; var h=true; if(this._isRotatorTypeEnabled(Telerik.Web.UI.RotatorType.Buttons)||this._isRotatorTypeEnabled(Telerik.Web.UI.RotatorType.ButtonsOver)||this._isRotatorTypeEnabled(Telerik.Web.UI.RotatorType.SlideShowButtons)){h=this._initializeButtonsRotatorType(); }if(h){Sys.UI.DomElement.addCssClass(d,"rrNoBorder"); }if(this.get_vertical()){this.set_vertical(true); }c.style.overflow="auto"; var a=this._clipElement; a.style.overflow="auto"; var b=this._itemsElement; var f=10000; try{f=1000+b.offsetWidth*$telerik.getChildrenByTagName(b,"li").length; }catch(g){f=10000; }a.style.width=Math.max(f,10000)+"px"; a.style.height="10000px"; b.style.width=this.get_vertical()?c.style.width:b.offsetWidth+"px"; b.style.height=b.offsetHeight+"px"; c.style.overflow=""; a.style.width=c.style.width; a.style.height=c.style.height; a.style.overflow="hidden"; a.style.position="relative"; b.style.position="relative"; d.style.visibility="visible"; },_fixRootElementSize:function(){var c=this.get_element(); var b=Telerik.Web.UI.RotatorScrollDirection; var a=parseInt(c.style.paddingLeft); if(a&&!isNaN(a)&&this._isScrollDirectionEnabled(b.Left)){c.style.width=(parseInt(c.style.width)+a)+"px"; c.style.paddingLeft=""; }a=parseInt(c.style.paddingRight); if(a&&!isNaN(a)&&this._isScrollDirectionEnabled(b.Right)){c.style.width=(parseInt(c.style.width)+a)+"px"; c.style.paddingRight=""; }a=parseInt(c.style.paddingTop); if(a&&!isNaN(a)&&this._isScrollDirectionEnabled(b.Up)){c.style.height=(parseInt(c.style.height)+a)+"px"; c.style.paddingTop=""; }a=parseInt(c.style.paddingBottom); if(a&&!isNaN(a)&&this._isScrollDirectionEnabled(b.Down)){c.style.height=(parseInt(c.style.height)+a)+"px"; c.style.paddingBottom=""; }},_createButton:function(a,b){var c=a; if(!c){c=document.createElement("div"); }if(!c.className){c.className=this._rotatorDownClass; }return c; },_isButtonDisabled:function(a){if(!a){return true; }return Sys.UI.DomElement.containsCssClass(a,this._rotatorButtonDisabledClass); },_isScrollDirectionEnabled:function(a){return a&this._scrollDirection?true:false; },_isRotatorTypeEnabled:function(a){return a==this._rotatorType?true:false; },get_rotatorType:function(){return this._rotatorType; },set_rotatorType:function(a){this._rotatorType=a; },get_wrapFrames:function(){return this._wrapFrames; },set_wrapFrames:function(a){this._wrapFrames=a; },get_scrollDuration:function(){if(this.isSlideShow()){return 1; }else{return this._scrollDuration; }},set_scrollDuration:function(a){this._scrollDuration=a; },set_vertical:function(b){var a=this._itemsElement; if(a){Sys.UI.DomElement.addCssClass(a,this._rotatorVerticalClass); }},get_vertical:function(){var a=Telerik.Web.UI.RotatorScrollDirection; return(this._isScrollDirectionEnabled(a.Down)||this._isScrollDirectionEnabled(a.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(a){this.get_element().style.height=a; if(this.isVisible()){this.repaint(); }},get_width:function(){return this.get_element().style.width; },set_width:function(a){this.get_element().style.width=a; if(this.isVisible()){this.repaint(); }},get_scrollDirection:function(){return this._scrollDirection; },set_scrollDirection:function(a){this._scrollDirection=a; },get_frameDuration:function(){return this._frameDuration; },set_frameDuration:function(a){this._frameDuration=a; },get_controlButtons:function(){return this._controlButtons; },set_controlButtons:function(a){this._controlButtons=a; },get_initialItemIndex:function(){return this._initialItemIndex; },set_initialItemIndex:function(a){this._initialItemIndex=a; },get_slideShowAnimationSettings:function(){return this._slideShowAnimationSettings; },set_slideShowAnimationSettings:function(a){this._slideShowAnimationSettings=a; },set_animationDirection:function(a){this._animationDirection=a?a:Telerik.Web.UI.RotatorScrollDirection.Left; },get_animationDirection:function(){return this._animationDirection; },_attachEvents:function(a){var b=this.get_containerElement(); if(null==b){return; }if(a!=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(b,"mouseover",this._mouseOverDelegate); $addHandler(b,"mouseout",this._mouseOutDelegate); $addHandler(b,"click",this._clickDelegate); this.add_itemShown(this._itemShownDelegate); }else{$removeHandler(b,"mouseover",this._mouseOverDelegate); $removeHandler(b,"mouseout",this._mouseOutDelegate); $removeHandler(b,"click",this._clickDelegate); this._clickDelegate=null; this._mouseOutDelegate=null; this._mouseOverDelegate=null; this.remove_itemShown(this._itemShownDelegate); }},_itemShownHandler:function(b){if(typeof(Telerik.Web.UI.RadTicker)=="undefined"){return; }var d=this.get_items(); for(var a=0,e=d.length; a0){for(var d=0; d