YAHOO.namespace("extension");YAHOO.extension.Carousel = function(carouselElementID, carouselCfg) {this.init(carouselElementID, carouselCfg);};YAHOO.extension.Carousel.prototype = {UNBOUNDED_SIZE: 1000000,init:function(e,f){var g=this;this.getCarouselItem=this.getItem;var h="carousel-list";var i="carousel-clip-region";var j="carousel-next";var k="carousel-prev";this._carouselElemID=e;this.carouselElem=$(e);this._prevEnabled=true;this._nextEnabled=true;this.cfg=new YAHOO.util.Config(this);this.cfg.addProperty("scrollBeforeAmount",{value:0,handler:function(a,b,c){},validator:g.cfg.checkNumber});this.cfg.addProperty("scrollAfterAmount",{value:0,handler:function(a,b,c){},validator:g.cfg.checkNumber});this.cfg.addProperty("loadOnStart",{value:true,handler:function(a,b,c){},validator:g.cfg.checkBoolean});this.cfg.addProperty("orientation",{value:"horizontal",handler:function(a,b,c){g.reload()},validator:function(a){if(typeof a=="string")return("horizontal,vertical".indexOf(a.toLowerCase())!=-1);else return false}});this.cfg.addProperty("size",{value:this.UNBOUNDED_SIZE,handler:function(a,b,c){g.reload()},validator:g.cfg.checkNumber});this.cfg.addProperty("numVisible",{value:3,handler:function(a,b,c){g.reload()},validator:g.cfg.checkNumber});this.cfg.addProperty("firstVisible",{value:1,handler:function(a,b,c){g.moveTo(b[0])},validator:g.cfg.checkNumber});this.cfg.addProperty("scrollInc",{value:3,handler:function(a,b,c){},validator:g.cfg.checkNumber});this.cfg.addProperty("animationSpeed",{value:0.25,handler:function(a,b,c){g.animationSpeed=b[0]},validator:g.cfg.checkNumber});this.cfg.addProperty("animationMethod",{value:YAHOO.util.Easing.easeOut,handler:function(a,b,c){}});this.cfg.addProperty("animationCompleteHandler",{value:null,handler:function(a,b,c){if(g._animationCompleteEvt){g._animationCompleteEvt.unsubscribe(g._currAnimationCompleteHandler,g)}g._currAnimationCompleteHandler=b[0];if(g._currAnimationCompleteHandler){if(!g._animationCompleteEvt)g._animationCompleteEvt=new YAHOO.util.CustomEvent("onAnimationComplete",g);g._animationCompleteEvt.subscribe(g._currAnimationCompleteHandler,g)}}});this.cfg.addProperty("autoPlay",{value:0,handler:function(a,b,c){var d=b[0];if(d>0)g.startAutoPlay();else g.stopAutoPlay()}});this.cfg.addProperty("wrap",{value:false,handler:function(a,b,c){},validator:g.cfg.checkBoolean});this.cfg.addProperty("navMargin",{value:0,handler:function(a,b,c){g.calculateSize()},validator:g.cfg.checkNumber});this.cfg.addProperty("revealAmount",{value:0,handler:function(a,b,c){g.reload()},validator:g.cfg.checkNumber});this.cfg.addProperty("prevElementID",{value:null,handler:function(a,b,c){if(g._carouselPrev)$E.removeListener(g._carouselPrev,"click",g._scrollPrev);g._prevElementID=b[0];if(g._prevElementID==null)g._carouselPrev=$$(k,"div",g.carouselElem)[0];else g._carouselPrev=$(g._prevElementID);$E.addListener(g._carouselPrev,"click",g._scrollPrev,g)}});this.cfg.addProperty("prevElement",{value:null,handler:function(a,b,c){if(g._carouselPrev)$E.removeListener(g._carouselPrev,"click",g._scrollPrev);g._prevElementID=b[0];if(g._prevElementID==null)g._carouselPrev=$$(k,"div",g.carouselElem)[0];else g._carouselPrev=$(g._prevElementID);$E.addListener(g._carouselPrev,"click",g._scrollPrev,g)}});this.cfg.addProperty("nextElementID",{value:null,handler:function(a,b,c){if(g._carouselNext)$E.removeListener(g._carouselNext,"click",g._scrollNext);g._nextElementID=b[0];if(g._nextElementID==null)g._carouselNext=$$(j,"div",g.carouselElem);else g._carouselNext=$(g._nextElementID);if(g._carouselNext)$E.addListener(g._carouselNext,"click",g._scrollNext,g)}});this.cfg.addProperty("nextElement",{value:null,handler:function(a,b,c){if(g._carouselNext){$E.removeListener(g._carouselNext,"click",g._scrollNext)}g._nextElementID=b[0];if(g._nextElementID==null)g._carouselNext=$$(j,"div",g.carouselElem);else g._carouselNext=$(g._nextElementID);if(g._carouselNext)$E.addListener(g._carouselNext,"click",g._scrollNext,g)}});this.cfg.addProperty("disableSelection",{value:true,handler:function(a,b,c){},validator:g.cfg.checkBoolean});this.cfg.addProperty("loadInitHandler",{value:null,handler:function(a,b,c){if(g._loadInitHandlerEvt){g._loadInitHandlerEvt.unsubscribe(g._currLoadInitHandler,g)}g._currLoadInitHandler=b[0];if(g._currLoadInitHandler){if(!g._loadInitHandlerEvt){g._loadInitHandlerEvt=new YAHOO.util.CustomEvent("onLoadInit",g)}g._loadInitHandlerEvt.subscribe(g._currLoadInitHandler,g)}}});this.cfg.addProperty("loadNextHandler",{value:null,handler:function(a,b,c){if(g._loadNextHandlerEvt){g._loadNextHandlerEvt.unsubscribe(g._currLoadNextHandler,g)}g._currLoadNextHandler=b[0];if(g._currLoadNextHandler){if(!g._loadNextHandlerEvt){g._loadNextHandlerEvt=new YAHOO.util.CustomEvent("onLoadNext",g)}g._loadNextHandlerEvt.subscribe(g._currLoadNextHandler,g)}}});this.cfg.addProperty("loadPrevHandler",{value:null,handler:function(a,b,c){if(g._loadPrevHandlerEvt){g._loadPrevHandlerEvt.unsubscribe(g._currLoadPrevHandler,g)}g._currLoadPrevHandler=b[0];if(g._currLoadPrevHandler){if(!g._loadPrevHandlerEvt){g._loadPrevHandlerEvt=new YAHOO.util.CustomEvent("onLoadPrev",g)}g._loadPrevHandlerEvt.subscribe(g._currLoadPrevHandler,g)}}});this.cfg.addProperty("prevButtonStateHandler",{value:null,handler:function(a,b,c){if(g._currPrevButtonStateHandler){g._prevButtonStateHandlerEvt.unsubscribe(g._currPrevButtonStateHandler,g)}g._currPrevButtonStateHandler=b[0];if(g._currPrevButtonStateHandler){if(!g._prevButtonStateHandlerEvt){g._prevButtonStateHandlerEvt=new YAHOO.util.CustomEvent("onPrevButtonStateChange",g)}g._prevButtonStateHandlerEvt.subscribe(g._currPrevButtonStateHandler,g)}}});this.cfg.addProperty("nextButtonStateHandler",{value:null,handler:function(a,b,c){if(g._currNextButtonStateHandler){g._nextButtonStateHandlerEvt.unsubscribe(g._currNextButtonStateHandler,g)}g._currNextButtonStateHandler=b[0];if(g._currNextButtonStateHandler){if(!g._nextButtonStateHandlerEvt){g._nextButtonStateHandlerEvt=new YAHOO.util.CustomEvent("onNextButtonStateChange",g)}g._nextButtonStateHandlerEvt.subscribe(g._currNextButtonStateHandler,g)}}});if(f){this.cfg.applyConfig(f)}$E.addListener(this.carouselElem,'mousedown',this._handleMouseDownForSelection,this,true);this._origFirstVisible=this.cfg.getProperty("firstVisible");this._currLoadInitHandler=this.cfg.getProperty("loadInitHandler");this._currLoadNextHandler=this.cfg.getProperty("loadNextHandler");this._currLoadPrevHandler=this.cfg.getProperty("loadPrevHandler");this._currPrevButtonStateHandler=this.cfg.getProperty("prevButtonStateHandler");this._currNextButtonStateHandler=this.cfg.getProperty("nextButtonStateHandler");this._currAnimationCompleteHandler=this.cfg.getProperty("animationCompleteHandler");this._nextElementID=this.cfg.getProperty("nextElementID");if(!this._nextElementID)this._nextElementID=this.cfg.getProperty("nextElement");this._prevElementID=this.cfg.getProperty("prevElementID");if(!this._prevElementID)this._prevElementID=this.cfg.getProperty("prevElement");this._autoPlayTimer=null;this._priorLastVisible=this._priorFirstVisible=this.cfg.getProperty("firstVisible");this._lastPrebuiltIdx=0;this.carouselList=$$(h,"ul",this.carouselElem)[0];if(this._nextElementID==null){this._carouselNext=$$(j,"div",this.carouselElem)[0]}else{this._carouselNext=$(this._nextElementID)}if(this._prevElementID==null){this._carouselPrev=$$(k,"div",this.carouselElem)[0]}else{this._carouselPrev=$(this._prevElementID)}this._clipReg=$$(i,"div",this.carouselElem)[0];if(this.isVertical()){$D.addClass(this.carouselList,"carousel-vertical")}this._scrollNextAnim=new YAHOO.util.Motion(this.carouselList,this.scrollNextParams,this.cfg.getProperty("animationSpeed"),this.cfg.getProperty("animationMethod"));this._scrollPrevAnim=new YAHOO.util.Motion(this.carouselList,this.scrollPrevParams,this.cfg.getProperty("animationSpeed"),this.cfg.getProperty("animationMethod"));if(this._carouselNext)$E.addListener(this._carouselNext,"click",this._scrollNext,this);if(this._carouselPrev)$E.addListener(this._carouselPrev,"click",this._scrollPrev,this);var l=this.cfg.getProperty("loadInitHandler");if(l){this._loadInitHandlerEvt=new YAHOO.util.CustomEvent("onLoadInit",this);this._loadInitHandlerEvt.subscribe(l,this)}var m=this.cfg.getProperty("loadNextHandler");if(m){this._loadNextHandlerEvt=new YAHOO.util.CustomEvent("onLoadNext",this);this._loadNextHandlerEvt.subscribe(m,this)}var n=this.cfg.getProperty("loadPrevHandler");if(n){this._loadPrevHandlerEvt=new YAHOO.util.CustomEvent("onLoadPrev",this);this._loadPrevHandlerEvt.subscribe(n,this)}var o=this.cfg.getProperty("animationCompleteHandler");if(o){this._animationCompleteEvt=new YAHOO.util.CustomEvent("onAnimationComplete",this);this._animationCompleteEvt.subscribe(o,this)}var p=this.cfg.getProperty("prevButtonStateHandler");if(p){this._prevButtonStateHandlerEvt=new YAHOO.util.CustomEvent("onPrevButtonStateChange",this);this._prevButtonStateHandlerEvt.subscribe(p,this)}var q=this.cfg.getProperty("nextButtonStateHandler");if(q){this._nextButtonStateHandlerEvt=new YAHOO.util.CustomEvent("onNextButtonStateChange",this);this._nextButtonStateHandlerEvt.subscribe(q,this)}var r=this._calculateVisibleExtent();$E.onAvailable(this._carouselElemID+"-item-"+r.start,this._calculateSize,this);if(this.cfg.getProperty("loadOnStart"))this._loadInitial()},_handleMouseDownForSelection:function(e){if(this.cfg.getProperty("disableSelection")){$E.preventDefault(e);$E.stopPropagation(e)}},clear:function(){var a=this.cfg.getProperty("loadInitHandler");if(a){this._removeChildrenFromNode(this.carouselList);this._lastPrebuiltIdx=0}this.stopAutoPlay();this._priorLastVisible=this._priorFirstVisible=this._origFirstVisible;this.cfg.setProperty("firstVisible",this._origFirstVisible,true);this.moveTo(this._origFirstVisible)},reload:function(a){if(this._isValidObj(a)){this.cfg.setProperty("numVisible",a)}this.clear();var b=this._calculateVisibleExtent();$E.onAvailable(this._carouselElemID+"-item-"+b.start,this._calculateSize,this);this._loadInitial()},load:function(){var a=this._calculateVisibleExtent();$E.onAvailable(this._carouselElemID+"-item-"+a.start,this._calculateSize,this);this._loadInitial()},addItem:function(a,b,c){if(a>this.cfg.getProperty("size")){return null}var d=this.getItem(a);if(!this._isValidObj(d)){d=this._createItem(a,b);this.carouselList.appendChild(d)}else if(this._isValidObj(d.placeholder)){var e=this._createItem(a,b);this.carouselList.replaceChild(e,d);d=e}if(this._isValidObj(c)){$D.addClass(d,c)}if(this.isVertical())setTimeout(function(){d.style.display="block"},1);return d},insertBefore:function(a,b){if(a>=this.cfg.getProperty("size")){return null}if(a<1){a=1}var c=a-1;if(c>this._lastPrebuiltIdx){this._prebuildItems(this._lastPrebuiltIdx,a)}var d=this._insertBeforeItem(a,b);this._enableDisableControls();return d},insertAfter:function(a,b){if(a>this.cfg.getProperty("size")){a=this.cfg.getProperty("size")}var c=a+1;if(c>this._lastPrebuiltIdx){this._prebuildItems(this._lastPrebuiltIdx,c+1)}var d=this._insertAfterItem(a,b);if(c>this.cfg.getProperty("size")){this.cfg.setProperty("size",c,true)}this._enableDisableControls();return d},scrollNext:function(){this._scrollNext(null,this);this._autoPlayTimer=null;if(this.cfg.getProperty("autoPlay")!==0){this._autoPlayTimer=this.startAutoPlay()}},scrollPrev:function(){this._scrollPrev(null,this)},scrollTo:function(a){this._position(a,true)},moveTo:function(a){this._position(a,false)},startAutoPlay:function(a){if(this._isValidObj(a)){this.cfg.setProperty("autoPlay",a,true)}if(this._autoPlayTimer!==null){return this._autoPlayTimer}var b=this;var c=function(){b.scrollNext()};this._autoPlayTimer=setTimeout(c,this.cfg.getProperty("autoPlay"));return this._autoPlayTimer},stopAutoPlay:function(){if(this._autoPlayTimer!==null){clearTimeout(this._autoPlayTimer);this._autoPlayTimer=null}},isVertical:function(){return(this.cfg.getProperty("orientation")!="horizontal")},isItemLoaded:function(a){var b=this.getItem(a);if(this._isValidObj(b)&&!this._isValidObj(b.placeholder)){return true}return false},getItem:function(a){var b=this._carouselElemID+"-item-"+a;var c=$(b);return c},show:function(){$D.setStyle(this.carouselElem,"display","block");this.calculateSize();$D.setStyle(this.carouselElem,"width","679px")},hide:function(){$D.setStyle(this.carouselElem,"display","none")},calculateSize:function(){var a=this.carouselList.childNodes;var b=null;for(var i=0;i<a.length;i++){b=a[i];if(b.tagName=="LI"||b.tagName=="li")break}var c=this.cfg.getProperty("navMargin");var d=this.cfg.getProperty("numVisible");var e=this.cfg.getProperty("firstVisible");var f=this._getStyleVal(b,"paddingLeft");var g=this._getStyleVal(b,"paddingRight");var h=this._getStyleVal(b,"marginLeft");var j=this._getStyleVal(b,"marginRight");var k=this._getStyleVal(b,"paddingTop");var l=this._getStyleVal(b,"paddingBottom");var m=this._getStyleVal(b,"marginTop");var n=this._getStyleVal(b,"marginBottom");$D.removeClass(this.carouselList,"carousel-vertical");$D.removeClass(this.carouselList,"carousel-horizontal");if(this.isVertical()){var o=f+g+h+j;$D.addClass(this.carouselList,"carousel-vertical");var p=k+l+m+n;var q=this._getStyleVal(this.carouselList,"paddingTop");var r=this._getStyleVal(this.carouselList,"paddingBottom");var s=this._getStyleVal(this.carouselList,"marginTop");var t=this._getStyleVal(this.carouselList,"marginBottom");var u=q+r+s+t;var v=(this._isExtraRevealed())?(this.cfg.getProperty("revealAmount")+(p)/2):0;var w=this._getStyleVal(b,"height",true);this.scrollAmountPerInc=(w+p);var x=this._getStyleVal(b,"width");this.carouselElem.style.width=(x+o)+"px";this._clipReg.style.height=(this.scrollAmountPerInc*d+v*2+u)+"px";this.carouselElem.style.height=(this.scrollAmountPerInc*d+v*2+c*2+u)+"px";var y=(this._isExtraRevealed())?(v-(Math.abs(m-n)+Math.abs(k-l))/2):0;$D.setStyle(this.carouselList,"position","relative");$D.setStyle(this.carouselList,"top",""+y+"px");var z=$D.getY(this.carouselList);$D.setY(this.carouselList,z-this.scrollAmountPerInc*(e-1))}else{$D.addClass(this.carouselList,"carousel-horizontal");var A=this._getStyleVal(this.carouselList,"paddingLeft");var B=this._getStyleVal(this.carouselList,"paddingRight");var C=this._getStyleVal(this.carouselList,"marginLeft");var D=this._getStyleVal(this.carouselList,"marginRight");var E=A+B+C+D;var F=h+j;var o=F+g+f;var v=(this._isExtraRevealed())?(this.cfg.getProperty("revealAmount")+(o)/2):0;var x=b.offsetWidth;this.scrollAmountPerInc=x+F;this._clipReg.style.width=(this.scrollAmountPerInc*d+v*2)+"px";this.carouselElem.style.width=(this.scrollAmountPerInc*d+c*2+v*2+E)+"px";var G=(this._isExtraRevealed())?(v-(Math.abs(j-h)+Math.abs(g-f))/2-(C+A)):0;$D.setStyle(this.carouselList,"position","relative");$D.setStyle(this.carouselList,"left",""+G+"px");var H=$D.getX(this.carouselList);$D.setX(this.carouselList,H-this.scrollAmountPerInc*(e-1))}},setProperty:function(a,b,c){this.cfg.setProperty(a,b,c)},getProperty:function(a){return this.cfg.getProperty(a)},getFirstItemRevealed:function(){return this._firstItemRevealed},getLastItemRevealed:function(){return this._lastItemRevealed},getFirstVisible:function(){return this.cfg.getProperty("firstVisible")},getLastVisible:function(){var a=this.cfg.getProperty("firstVisible");var b=this.cfg.getProperty("numVisible");return a+b-1},_getStyleVal:function(a,b,c){var d=$D.getStyle(a,b);var e=c?parseFloat(d):parseInt(d,10);if(b=="height"&&isNaN(e)){e=a.offsetHeight}else if(isNaN(e)){e=0}return e},_calculateSize:function(a){a.calculateSize();a.show()},_removeChildrenFromNode:function(a){if(!this._isValidObj(a)){return}var b=a.childNodes.length;while(a.hasChildNodes()){a.removeChild(a.firstChild)}},_prebuildLiElem:function(a){if(a<1)return;var b=document.createElement("li");b.id=this._carouselElemID+"-item-"+a;b.placeholder=true;this.carouselList.appendChild(b);this._lastPrebuiltIdx=(a>this._lastPrebuiltIdx)?a:this._lastPrebuiltIdx},_createItem:function(a,b){if(a<1)return;var c=document.createElement("li");c.id=this._carouselElemID+"-item-"+a;if(typeof(b)==="string"){c.innerHTML=b}else{c.appendChild(b)}return c},_insertAfterItem:function(a,b){return this._insertBeforeItem(a+1,b)},_insertBeforeItem:function(a,b){var c=this.getItem(a);var d=this.cfg.getProperty("size");if(d!=this.UNBOUNDED_SIZE){this.cfg.setProperty("size",d+1,true)}for(var i=this._lastPrebuiltIdx;i>=a;i--){var e=this.getItem(i);if(this._isValidObj(e)){e.id=this._carouselElemID+"-item-"+(i+1)}}var f=this._createItem(a,b);var g=this.carouselList.insertBefore(f,c);this._lastPrebuiltIdx+=1;return f},insertAfterEnd:function(a){return this.insertAfter(this.cfg.getProperty("size"),a)},_position:function(a,b){var c=this._priorFirstVisible;if(a>c){var d=a-c;this._scrollNextInc(d,b)}else{var e=c-a;this._scrollPrevInc(e,b)}},_scrollPrev:function(e,a){if(e!==null){a.stopAutoPlay()}a._scrollPrevInc(a.cfg.getProperty("scrollInc"),(a.cfg.getProperty("animationSpeed")!==0))},_scrollNext:function(e,a){if(e!==null){a.stopAutoPlay()}a._scrollNextInc(a.cfg.getProperty("scrollInc"),(a.cfg.getProperty("animationSpeed")!==0))},_handleAnimationComplete:function(a,b,c){var d=c[0];var e=c[1];d._animationCompleteEvt.fire(e)},_areAllItemsLoaded:function(a,b){var c=true;for(var i=a;i<=b;i++){var d=this.getItem(i);if(!this._isValidObj(d)){this._prebuildLiElem(i);c=false}else if(this._isValidObj(d.placeholder)){c=false}}return c},_prebuildItems:function(a,b){for(var i=a;i<=b;i++){var c=this.getItem(i);if(!this._isValidObj(c)){this._prebuildLiElem(i)}}},_isExtraRevealed:function(){return(this.cfg.getProperty("revealAmount")>0)},_scrollNextInc:function(a,b){if(this._scrollNextAnim.isAnimated()||this._scrollPrevAnim.isAnimated()){return false}var c=this.cfg.getProperty("numVisible");var d=this._priorFirstVisible;var e=this._priorLastVisible;var f=this.cfg.getProperty("size");var g=this._calculateAllowableScrollExtent();if(this.cfg.getProperty("wrap")&&e==g.end){this.scrollTo(g.start);return}var h=d+a;var i=h+c-1;if(i>g.end){i=g.end;h=i-c+1}a=h-d;this.cfg.setProperty("firstVisible",h,true);if(a>0){if(this._isValidObj(this.cfg.getProperty("loadNextHandler"))){var j=this._calculateVisibleExtent(h,i);var k=(e+1)<j.start?(e+1):j.start;var l=this._areAllItemsLoaded(k,j.end);this._loadNextHandlerEvt.fire(j.start,j.end,l)}if(b){var m={points:{by:[-this.scrollAmountPerInc*a,0]}};if(this.isVertical()){m={points:{by:[0,-this.scrollAmountPerInc*a]}}}this._scrollNextAnim=new YAHOO.util.Motion(this.carouselList,m,this.cfg.getProperty("animationSpeed"),this.cfg.getProperty("animationMethod"));if(this.cfg.getProperty("animationCompleteHandler")){this._scrollNextAnim.onComplete.subscribe(this._handleAnimationComplete,[this,"next"])}this._scrollNextAnim.animate()}else{if(this.isVertical()){var n=$D.getY(this.carouselList);$D.setY(this.carouselList,n-this.scrollAmountPerInc*a)}else{var o=$D.getX(this.carouselList);$D.setX(this.carouselList,o-this.scrollAmountPerInc*a)}}}this._priorFirstVisible=h;this._priorLastVisible=i;this._enableDisableControls();return false},_scrollPrevInc:function(a,b){if(this._scrollNextAnim.isAnimated()||this._scrollPrevAnim.isAnimated()){return false}var c=this.cfg.getProperty("numVisible");var d=this._priorFirstVisible;var e=this._priorLastVisible;var f=this.cfg.getProperty("size");var g=d-a;var h=this._calculateAllowableScrollExtent();g=(g<h.start)?h.start:g;var i=g+c-1;if(i>h.end){i=h.end;g=i-c+1}a=d-g;this.cfg.setProperty("firstVisible",g,true);if(a>0){if(this._isValidObj(this.cfg.getProperty("loadPrevHandler"))){var j=this._calculateVisibleExtent(g,i);var k=(d-1)>j.end?(d-1):j.end;var l=this._areAllItemsLoaded(j.start,k);this._loadPrevHandlerEvt.fire(j.start,j.end,l)}if(b){var m={points:{by:[this.scrollAmountPerInc*a,0]}};if(this.isVertical()){m={points:{by:[0,this.scrollAmountPerInc*a]}}}this._scrollPrevAnim=new YAHOO.util.Motion(this.carouselList,m,this.cfg.getProperty("animationSpeed"),this.cfg.getProperty("animationMethod"));if(this.cfg.getProperty("animationCompleteHandler")){this._scrollPrevAnim.onComplete.subscribe(this._handleAnimationComplete,[this,"prev"])}this._scrollPrevAnim.animate()}else{if(this.isVertical()){var n=$D.getY(this.carouselList);$D.setY(this.carouselList,n+this.scrollAmountPerInc*a)}else{var o=$D.getX(this.carouselList);$D.setX(this.carouselList,o+this.scrollAmountPerInc*a)}}}this._priorFirstVisible=g;this._priorLastVisible=i;this._enableDisableControls();return false},_enableDisableControls:function(){var a=this.cfg.getProperty("firstVisible");var b=this.getLastVisible();var c=this._calculateAllowableScrollExtent();if(this._prevEnabled){if(a===c.start){this._disablePrev()}}if(this._prevEnabled===false){if(a>c.start){this._enablePrev()}}if(this._nextEnabled){if(b===c.end){this._disableNext()}}if(this._nextEnabled===false){if(b<c.end){this._enableNext()}}},_loadInitial:function(){var a=this.cfg.getProperty("firstVisible");this._priorLastVisible=this.getLastVisible();if(this._loadInitHandlerEvt){var b=this._calculateVisibleExtent(a,this._priorLastVisible);var c=this._areAllItemsLoaded(1,b.end);this._loadInitHandlerEvt.fire(b.start,b.end,c)}if(this.cfg.getProperty("autoPlay")!==0){this._autoPlayTimer=this.startAutoPlay()}this._enableDisableControls()},_calculateAllowableScrollExtent:function(){var a=this.cfg.getProperty("scrollBeforeAmount");var b=this.cfg.getProperty("scrollAfterAmount");var c=this.cfg.getProperty("size");var d={start:1-a,end:c+b};return d},_calculateVisibleExtent:function(a,b){if(!a){a=this.cfg.getProperty("firstVisible");b=this.getLastVisible()}var c=this.cfg.getProperty("size");a=a<1?1:a;b=b>c?c:b;var d={start:a,end:b};this._firstItemRevealed=-1;this._lastItemRevealed=-1;if(this._isExtraRevealed()){if(a>1){this._firstItemRevealed=a-1;d.start=this._firstItemRevealed}if(b<c){this._lastItemRevealed=b+1;d.end=this._lastItemRevealed}}return d},_disablePrev:function(){this._prevEnabled=false;if(this._prevButtonStateHandlerEvt){this._prevButtonStateHandlerEvt.fire(false,this._carouselPrev)}if(this._isValidObj(this._carouselPrev)){$E.removeListener(this._carouselPrev,"click",this._scrollPrev)}},_enablePrev:function(){this._prevEnabled=true;if(this._prevButtonStateHandlerEvt){this._prevButtonStateHandlerEvt.fire(true,this._carouselPrev)}if(this._isValidObj(this._carouselPrev)){$E.addListener(this._carouselPrev,"click",this._scrollPrev,this)}},_disableNext:function(){if(this.cfg.getProperty("wrap")){return}this._nextEnabled=false;if(this._isValidObj(this._nextButtonStateHandlerEvt)){this._nextButtonStateHandlerEvt.fire(false,this._carouselNext)}if(this._isValidObj(this._carouselNext)){$E.removeListener(this._carouselNext,"click",this._scrollNext)}},_enableNext:function(){this._nextEnabled=true;if(this._isValidObj(this._nextButtonStateHandlerEvt)){this._nextButtonStateHandlerEvt.fire(true,this._carouselNext)}if(this._isValidObj(this._carouselNext)){$E.addListener(this._carouselNext,"click",this._scrollNext,this)}},_isValidObj:function(a){if(null==a){return false}if("undefined"==typeof(a)){return false}return true}};
