window.adf||(window.adf={});var adf=window.adf;adf.shared=adf.shared||{};adf.shared.impl=adf.shared.impl||{};adf.shared.impl.conveyorBelt=adf.shared.impl.conveyorBelt||{};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon=function(a,b,d,e,f,g){this._elemId=a;this._elem=document.getElementById(this._elemId);this._orientation=b;this._contentParentId=d;this._bRtl=e;f&&(this._prevButtonId=f.prevButtonId,this._nextButtonId=f.nextButtonId,this._prevButtonStyleClass=f.prevButtonStyleClass,this._nextButtonStyleClass=f.nextButtonStyleClass,this._prevButtonIcon=f.prevButtonIcon,this._nextButtonIcon=f.nextButtonIcon);this._prevButtonId||(this._prevButtonId=this._elemId+"_buttonPrev");
this._nextButtonId||(this._nextButtonId=this._elemId+"_buttonNext");g&&(this._scrollFunc=g.scrollFunc,this._firstVisibleItemChangedFunc=g.firstVisibleItemChangedFunc,this._callbackObj=g.callbackObj);this._bExternalScroll=!0;this._firstVisibleItemIndex=0;a=navigator.userAgent.toLowerCase();if(-1!=a.indexOf("gecko/"))this._bAgentGecko=!0;else if(-1!=a.indexOf("opera"))this._bAgentOpera=!0;else if(-1!=a.indexOf("applewebkit")||-1!=a.indexOf("safari"))this._bAgentWebkit=!0};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype.setup=function(a){if(a){this._createInnerContainers();this._createPrevButton(this._prevButtonId,this._prevButtonStyleClass,this._prevButtonIcon);this._createNextButton(this._nextButtonId,this._nextButtonStyleClass,this._nextButtonIcon);var b=this._nextButton;this._buttonWidth=b.offsetWidth;this._buttonHeight=b.offsetHeight;this._hidePrevButton();this._hideNextButton();var d=this,b=adf.shared.impl.conveyorBelt.ConveyorBeltCommon;this._mouseWheelListener=
function(a){d._handleMouseWheel(a)};b._addBubbleEventListener(this._elem,"mousewheel",this._mouseWheelListener);b._addBubbleEventListener(this._elem,"wheel",this._mouseWheelListener);this._touchStartListener=function(a){d._handleTouchStart(a)};b._addBubbleEventListener(this._overflowContainer,"touchstart",this._touchStartListener);this._touchMoveListener=function(a){d._handleTouchMove(a)};b._addBubbleEventListener(this._overflowContainer,"touchmove",this._touchMoveListener);this._touchEndListener=
function(a){d._handleTouchEnd(a)};b._addBubbleEventListener(this._overflowContainer,"touchend",this._touchEndListener);b._addBubbleEventListener(this._overflowContainer,"touchcancel",this._touchEndListener)}b=null;b=this._contentParentId?document.getElementById(this._contentParentId):this._contentContainer;this._measureContents(b);this._adjustInnerSizes(a)};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype.destroy=function(){var a=this._elem,b=adf.shared.impl.conveyorBelt.ConveyorBeltCommon;b._removeBubbleEventListener(a,"mousewheel",this._mouseWheelListener);b._removeBubbleEventListener(a,"wheel",this._mouseWheelListener);b._removeBubbleEventListener(this._overflowContainer,"touchstart",this._touchStartListener);b._removeBubbleEventListener(this._overflowContainer,"touchmove",this._touchMoveListener);b._removeBubbleEventListener(this._overflowContainer,
"touchend",this._touchEndListener);b._removeBubbleEventListener(this._overflowContainer,"touchcancel",this._touchEndListener);this._touchEndListener=this._touchMoveListener=this._touchStartListener=this._mouseWheelListener=null;this._reparentChildren(this._contentContainer,this._elem);a.removeChild(this._overflowContainer);a.removeChild(this._nextButton);a.removeChild(this._prevButton);this._callbackObj=this._firstVisibleItemChangedFunc=this._scrollFunc=this._elem=this._totalSize=this._sizes=this._overflowContainer=
this._contentContainer=this._prevButton=this._nextButton=null};adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype.setFirstVisibleItem=function(a){for(var b=this._sizes,d=0;d<b.length;d++){var e=b[d];if(e.id==a){this._setCurrScroll(e.start,!0);break}}};adf.shared.impl.conveyorBelt.ConveyorBeltCommon._reparentChildren=function(a,b){for(var d=a.childNodes;0<d.length;)b.appendChild(d[0])};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon._getComputedStyle=function(a){var b=a.ownerDocument.defaultView,d=null;return d=b?b.getComputedStyle(a,null):a.currentStyle};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon._getElemInnerWidth=function(a){var b=adf.shared.impl.conveyorBelt.ConveyorBeltCommon,d=b._getComputedStyle(a),b=b._getCSSLengthAsInt(d.paddingLeft)+b._getCSSLengthAsInt(d.paddingRight)+b._getCSSLengthAsInt(d.borderLeftWidth)+b._getCSSLengthAsInt(d.borderRightWidth);return a.offsetWidth-b};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon._getElemInnerHeight=function(a){var b=adf.shared.impl.conveyorBelt.ConveyorBeltCommon,d=b._getComputedStyle(a),b=b._getCSSLengthAsInt(d.paddingTop)+b._getCSSLengthAsInt(d.paddingBottom)+b._getCSSLengthAsInt(d.borderTopWidth)+b._getCSSLengthAsInt(d.borderBottomWidth);return a.offsetHeight-b};adf.shared.impl.conveyorBelt.ConveyorBeltCommon._getCSSLengthAsInt=function(a){return 0<a.length&&"auto"!=a?(a=parseInt(a,10),isNaN(a)&&(a=0),a):0};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon._addBubbleEventListener=function(a,b,d){a.addEventListener?a.addEventListener(b,d,!1):a.attachEvent&&a.attachEvent("on"+b,d)};adf.shared.impl.conveyorBelt.ConveyorBeltCommon._removeBubbleEventListener=function(a,b,d){a.removeEventListener?a.removeEventListener(b,d,!1):a.detachEvent&&a.detachEvent("on"+b,d)};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon._getWheelDelta=function(a){var b=0;return b=null!=a.wheelDelta?a.wheelDelta:null!=a.deltaY?-a.deltaY:-a.detail};adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._isHorizontal=function(){return"horizontal"==this._orientation};adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._isEmpty=function(){var a=this._sizes;return!a||1>a.length};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._adjustInnerSizes=function(a){var b=this._contentContainer,d=b.style,e=this._totalSize;d.width=e.w+"px";d.height=e.h+"px";var d=this._getCurrScroll(),f=this._isHorizontal(),g=adf.shared.impl.conveyorBelt.ConveyorBeltCommon,g=f?g._getElemInnerWidth(this._elem):g._getElemInnerHeight(this._elem);this._setOverflowMaxSize(Math.min(g,f?e.w:e.h));this._minScroll=0;this._maxScroll=f?b.offsetWidth-g+this._buttonWidth:b.offsetHeight-g+this._buttonHeight;
this._hidePrevButton();this._hideNextButton();b=this._nextButton.style;g=this._prevButton.style;f?(e=.5*(e.h-this._buttonHeight),b.top=e+"px",g.top=e+"px"):(e=.5*(e.w-this._buttonWidth),this._bRtl?(b.left=-e+"px",g.left=-e+"px"):(b.left=e+"px",g.left=e+"px"));this._setCurrScroll(a?this._minScroll:d,!0)};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._createInnerContainers=function(){var a=this,b=this._elemId+"_overflow",d=this._elemId+"_content",e=document.createElement("div");this._overflowContainer=e;e.id=b;b=e.style;b.overflow="hidden";b.display=this._getCssDisplay();b.position="relative";var b=this._elem,f=adf.shared.impl.conveyorBelt.ConveyorBeltCommon,g=document.createElement("div");this._contentContainer=g;g.id=d;d=g.style;d.position="relative";e.appendChild(g);f._reparentChildren(b,
g);b.appendChild(e);this._isHorizontal()?d.width=1E3*b.offsetWidth+"px":d.height=1E3*b.offsetHeight+"px";f._addBubbleEventListener(e,"scroll",function(b){a._handleScroll(b)})};adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._getCssDisplay=function(){return this._isHorizontal()?"inline-block":"block"};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._createPrevButton=function(a,b,d){var e=this,f=document.createElement("div");this._prevButton=f;f.setAttribute("id",a);f.setAttribute("class",b);f.setAttribute("aria-hidden","true");a=f.style;a.display=this._getCssDisplay();a.position="relative";this._isHorizontal()&&(a.verticalAlign="top");adf.shared.impl.conveyorBelt.ConveyorBeltCommon._addBubbleEventListener(f,"click",function(a){e._scrollPrev()});a=this._elem;a.insertBefore(f,a.firstChild);
d&&f.appendChild(d)};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._createNextButton=function(a,b,d){var e=this,f=document.createElement("div");this._nextButton=f;f.setAttribute("id",a);f.setAttribute("class",b);f.setAttribute("aria-hidden","true");a=f.style;a.display=this._getCssDisplay();a.position="relative";this._isHorizontal()&&(a.verticalAlign="top");adf.shared.impl.conveyorBelt.ConveyorBeltCommon._addBubbleEventListener(f,"click",function(a){e._scrollNext()});this._elem.appendChild(f);d&&f.appendChild(d)};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._measureContents=function(a){var b={w:0,h:0},d=[];if(a.hasChildNodes()){var e=a.childNodes;a=a.offsetWidth;for(var f=0,g=this._isHorizontal(),h=null,k=0;k<e.length;k++){var l=e[k];if(1==l.nodeType){var m=l.offsetWidth,n=l.offsetHeight,q={w:m,h:n,id:l.id};g?(q.start=this._bRtl?a-(l.offsetLeft+m):l.offsetLeft,0==k&&(f=q.start),q.start-=f,b.w=q.start+m,b.h=Math.max(b.h,n),q.end=b.w-1):(q.start=l.offsetTop,b.w=Math.max(b.w,m),b.h=q.start+n,q.end=
b.h-1);h&&h.end>=q.start&&(l=h.end-(q.start-1),h.end-=l,g?h.w-=l:h.h-=l);d.push(q);h=q}}}this._totalSize=b;this._sizes=d};adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._showNextButton=function(){this._nextButton.style.display=this._getCssDisplay()};adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._showPrevButton=function(){this._prevButton.style.display=this._getCssDisplay()};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._hideNextButton=function(){this._nextButton.style.display="none"};adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._hidePrevButton=function(){this._prevButton.style.display="none"};adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._isNextButtonShown=function(){return"none"!=this._nextButton.style.display};adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._isPrevButtonShown=function(){return"none"!=this._prevButton.style.display};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._getButtonSize=function(){return this._isHorizontal()?this._buttonWidth:this._buttonHeight};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._updateButtonVisibility=function(a){var b=this._getButtonSize(),d=this._getCurrScroll(),e=this._getCurrViewportSize(),f=this._needsScroll();a<=this._minScroll?(this._isPrevButtonShown()&&(e+=b,d-=b),this._hidePrevButton()):f&&(this._isPrevButtonShown()||(e-=b,d+=b),this._showPrevButton());a>=this._maxScroll?(this._isNextButtonShown()&&(e+=b),this._hideNextButton()):f&&(this._isNextButtonShown()||(e-=b),this._showNextButton());this._setOverflowScroll(d);
this._setOverflowMaxSize(e)};adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._setOverflowMaxSize=function(a){var b=this._overflowContainer.style;a+="px";this._isHorizontal()?b.maxWidth=a:b.maxHeight=a};adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._setOverflowScroll=function(a){var b=this._overflowContainer;this._isHorizontal()?b.scrollLeft=this._convertScrollLogicalToBrowser(a):b.scrollTop=a};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._getCurrViewportSize=function(){var a=this._overflowContainer;return this._isHorizontal()?a.offsetWidth:a.offsetHeight};adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._setCurrScroll=function(a,b){this._bScrolling||(this._bExternalScroll=!1,this._setCurrScrollHelper(a,b))};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._setCurrScrollHelper=function(a,b){if(!this._isEmpty()){this._bScrolling=!0;a=this._constrainScroll(a);this._updateButtonVisibility(a);var d=this._scrollFunc;if(b||!d||a==this._getCurrScroll())this._onScrollAnimEnd(a);else{var e=adf.shared.impl.conveyorBelt.ConveyorBeltCommon,e=Math.abs(this._getCurrScroll()-a)/e._SCROLL_SPEED,f=this;d.call(this._callbackObj,this._overflowContainer,this._convertScrollLogicalToBrowser(a),e,function(){f._onScrollAnimEnd(a)})}}};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._getCurrScroll=function(){var a=this._overflowContainer;return this._isHorizontal()?this._convertScrollBrowserToLogical(a.scrollLeft):a.scrollTop};adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._needsScroll=function(){var a=this._contentContainer,b=this._overflowContainer;return this._isHorizontal()?a.offsetWidth>b.offsetWidth:a.offsetHeight>b.offsetHeight};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._constrainScroll=function(a){!this._needsScroll()||a<this._minScroll?a=this._minScroll:a>this._maxScroll&&(a=this._maxScroll);return a};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._handleMouseWheel=function(a){var b=this._bScrolling;if(this._needsScroll()&&!this._bScrolling){var d=adf.shared.impl.conveyorBelt.ConveyorBeltCommon._getWheelDelta(a);0>d&&this._isNextButtonShown()?(b=!0,this._scrollNext()):0<d&&this._isPrevButtonShown()&&(b=!0,this._scrollPrev())}b&&(a.preventDefault(),a.stopPropagation())};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._handleTouchStart=function(a){a=a.touches;this._needsScroll()&&!this._bScrolling&&1==a.length&&(this._bTouch=!0,a=a[0],this._touchStartCoord=this._isHorizontal()?a.pageX:a.pageY,this._touchStartScroll=this._getCurrScroll(),this._touchStartNextScroll=this._calcNextScroll(),this._touchStartPrevScroll=this._calcPrevScroll())};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._handleTouchMove=function(a){if(this._bTouch){var b=this._isHorizontal();a=a.touches[0];a=(b?a.pageX:a.pageY)-this._touchStartCoord;var d=this._overflowContainer;Math.abs(a)<adf.shared.impl.conveyorBelt.ConveyorBeltCommon._SWIPE_THRESHOLD*(b?d.offsetWidth:d.offsetHeight)?this._setCurrScroll(this._touchStartScroll-a,!0):(this._setCurrScroll((b&&this._bRtl?0<a:0>a)?this._touchStartNextScroll:this._touchStartPrevScroll),this._bTouch=!1)}};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._handleTouchEnd=function(a){this._bTouch&&this._setCurrScroll(this._touchStartScroll);this._bTouch=!1};adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._handleScroll=function(a){this._bExternalScroll&&!this._bScrolling&&this._setCurrScrollHelper(this._getCurrScroll(),!0)};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._onScrollAnimEnd=function(a){this._setOverflowScroll(a);this._setExternalScrollTimeout();this._bScrolling=!1;if(this._firstVisibleItemChangedFunc){this._firstVisibleItemIndex=this._calcFirstVisibleItemIndex();a=this._calcLastVisibleItemIndex();var b=this._sizes,d=b[this._firstVisibleItemIndex];this._firstVisibleItemIndex!=a&&this._getCurrScroll()>d.start&&this._firstVisibleItemIndex<this._sizes.length-2&&(this._firstVisibleItemIndex++,d=b[this._firstVisibleItemIndex]);
this._firstVisibleItemId=d.id;this._firstVisibleItemChangedFunc.call(this._callbackObj,this._firstVisibleItemId)}};adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._setExternalScrollTimeout=function(){var a=this;window.setTimeout(function(){a&&(a._bExternalScroll=!0)},0)};adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._scrollNext=function(){this._bScrolling||this._setCurrScroll(this._calcNextScroll())};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._scrollPrev=function(){this._bScrolling||this._setCurrScroll(this._calcPrevScroll())};adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._calcNextScroll=function(){var a=this._calcNextVisibleItemIndex(),b=0;return b=a==this._calcFirstVisibleItemIndex()?this._getCurrScroll()+this._getCurrViewportSize():this._calcStartScroll(a)};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._calcPrevScroll=function(){var a=this._calcPrevVisibleItemIndex(),b=0,b=a==this._calcLastVisibleItemIndex()?this._getCurrScroll()-this._getCurrViewportSize():this._calcEndScroll(a);this._isNextButtonShown()||(b+=this._getButtonSize());b<this._getButtonSize()&&(b=this._minScroll);return b};adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._calcStartScroll=function(a){return this._sizes[a].start};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._calcEndScroll=function(a){return this._sizes[a].end-this._getCurrViewportSize()+1};adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._calcFirstVisibleItemIndex=function(){var a=this._getCurrScroll(),a=this._calcItemIndex(a);return 0>a?0:a};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._calcLastVisibleItemIndex=function(){var a=this._getCurrViewportSize(),a=this._getCurrScroll()+a-1,a=this._calcItemIndex(a),b=this._sizes;return 0>a?b.length-1:a};adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._calcPrevVisibleItemIndex=function(){var a=this._getCurrScroll()-1,a=this._calcItemIndex(a);return 0>a?0:a};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._calcNextVisibleItemIndex=function(){var a=this._getCurrViewportSize(),a=this._getCurrScroll()+a,a=this._calcItemIndex(a),b=this._sizes;return 0>a?b.length-1:a};adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._calcItemIndex=function(a){for(var b=this._sizes,d=0;d<b.length;d++)if(a<=b[d].end)return d;return-1};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._convertScrollLogicalToBrowser=function(a){var b=a;if(this._bRtl&&this._isHorizontal())if(this._bAgentGecko)b=-a;else if(this._bAgentWebkit||this._bAgentOpera)b=this._contentContainer.offsetWidth-this._overflowContainer.offsetWidth-a;return b};adf.shared.impl.conveyorBelt.ConveyorBeltCommon.prototype._convertScrollBrowserToLogical=function(a){return this._convertScrollLogicalToBrowser(a)};
adf.shared.impl.conveyorBelt.ConveyorBeltCommon._SCROLL_SPEED=1.1;adf.shared.impl.conveyorBelt.ConveyorBeltCommon._SWIPE_THRESHOLD=.33;