YAHOO.namespace("extension");YAHOO.extension.Carousel=function(B,A){this.init(B,A)};YAHOO.extension.Carousel.prototype={UNBOUNDED_SIZE:1000000,init:function(N,J){var I=this;this.getCarouselItem=this.getItem;var B="carousel-list";var C="carousel-clip-region";var F="carousel-next";var E="carousel-prev";this._carouselElemID=N;this.carouselElem=YAHOO.util.Dom.get(N);this._prevEnabled=true;this._nextEnabled=true;this.cfg=new YAHOO.util.Config(this);this.cfg.addProperty("scrollBeforeAmount",{value:0,handler:function(P,O,Q){},validator:I.cfg.checkNumber});this.cfg.addProperty("scrollAfterAmount",{value:0,handler:function(P,O,Q){},validator:I.cfg.checkNumber});this.cfg.addProperty("loadOnStart",{value:true,handler:function(P,O,Q){},validator:I.cfg.checkBoolean});this.cfg.addProperty("orientation",{value:"horizontal",handler:function(P,O,Q){I.reload()},validator:function(O){if(typeof O=="string"){return("horizontal,vertical".indexOf(O.toLowerCase())!=-1)}else{return false}}});this.cfg.addProperty("size",{value:this.UNBOUNDED_SIZE,handler:function(P,O,Q){I.reload()},validator:I.cfg.checkNumber});this.cfg.addProperty("numVisible",{value:3,handler:function(P,O,Q){I.reload()},validator:I.cfg.checkNumber});this.cfg.addProperty("firstVisible",{value:1,handler:function(P,O,Q){I.moveTo(O[0])},validator:I.cfg.checkNumber});this.cfg.addProperty("scrollInc",{value:3,handler:function(P,O,Q){},validator:I.cfg.checkNumber});this.cfg.addProperty("animationSpeed",{value:0.25,handler:function(P,O,Q){I.animationSpeed=O[0]},validator:I.cfg.checkNumber});this.cfg.addProperty("animationMethod",{value:YAHOO.util.Easing.easeOut,handler:function(P,O,Q){}});this.cfg.addProperty("animationCompleteHandler",{value:null,handler:function(P,O,Q){if(I._animationCompleteEvt){I._animationCompleteEvt.unsubscribe(I._currAnimationCompleteHandler,I)}I._currAnimationCompleteHandler=O[0];if(I._currAnimationCompleteHandler){if(!I._animationCompleteEvt){I._animationCompleteEvt=new YAHOO.util.CustomEvent("onAnimationComplete",I)}I._animationCompleteEvt.subscribe(I._currAnimationCompleteHandler,I)}}});this.cfg.addProperty("autoPlay",{value:0,handler:function(Q,O,R){var P=O[0];if(P>0){I.startAutoPlay()}else{I.stopAutoPlay()}}});this.cfg.addProperty("wrap",{value:false,handler:function(P,O,Q){},validator:I.cfg.checkBoolean});this.cfg.addProperty("navMargin",{value:0,handler:function(P,O,Q){I.calculateSize()},validator:I.cfg.checkNumber});this.cfg.addProperty("revealAmount",{value:0,handler:function(P,O,Q){I.reload()},validator:I.cfg.checkNumber});this.cfg.addProperty("prevElementID",{value:null,handler:function(P,O,Q){if(I._carouselPrev){YAHOO.util.Event.removeListener(I._carouselPrev,"click",I._scrollPrev)}I._prevElementID=O[0];if(I._prevElementID==null){I._carouselPrev=YAHOO.util.Dom.getElementsByClassName(E,"div",I.carouselElem)[0]}else{I._carouselPrev=YAHOO.util.Dom.get(I._prevElementID)}YAHOO.util.Event.addListener(I._carouselPrev,"click",I._scrollPrev,I)}});this.cfg.addProperty("prevElement",{value:null,handler:function(P,O,Q){if(I._carouselPrev){YAHOO.util.Event.removeListener(I._carouselPrev,"click",I._scrollPrev)}I._prevElementID=O[0];if(I._prevElementID==null){I._carouselPrev=YAHOO.util.Dom.getElementsByClassName(E,"div",I.carouselElem)[0]}else{I._carouselPrev=YAHOO.util.Dom.get(I._prevElementID)}YAHOO.util.Event.addListener(I._carouselPrev,"click",I._scrollPrev,I)}});this.cfg.addProperty("nextElementID",{value:null,handler:function(P,O,Q){if(I._carouselNext){YAHOO.util.Event.removeListener(I._carouselNext,"click",I._scrollNext)}I._nextElementID=O[0];if(I._nextElementID==null){I._carouselNext=YAHOO.util.Dom.getElementsByClassName(F,"div",I.carouselElem)}else{I._carouselNext=YAHOO.util.Dom.get(I._nextElementID)}if(I._carouselNext){YAHOO.util.Event.addListener(I._carouselNext,"click",I._scrollNext,I)}}});this.cfg.addProperty("nextElement",{value:null,handler:function(P,O,Q){if(I._carouselNext){YAHOO.util.Event.removeListener(I._carouselNext,"click",I._scrollNext)}I._nextElementID=O[0];if(I._nextElementID==null){I._carouselNext=YAHOO.util.Dom.getElementsByClassName(F,"div",I.carouselElem)}else{I._carouselNext=YAHOO.util.Dom.get(I._nextElementID)}if(I._carouselNext){YAHOO.util.Event.addListener(I._carouselNext,"click",I._scrollNext,I)}}});this.cfg.addProperty("disableSelection",{value:true,handler:function(P,O,Q){},validator:I.cfg.checkBoolean});this.cfg.addProperty("loadInitHandler",{value:null,handler:function(P,O,Q){if(I._loadInitHandlerEvt){I._loadInitHandlerEvt.unsubscribe(I._currLoadInitHandler,I)}I._currLoadInitHandler=O[0];if(I._currLoadInitHandler){if(!I._loadInitHandlerEvt){I._loadInitHandlerEvt=new YAHOO.util.CustomEvent("onLoadInit",I)}I._loadInitHandlerEvt.subscribe(I._currLoadInitHandler,I)}}});this.cfg.addProperty("loadNextHandler",{value:null,handler:function(P,O,Q){if(I._loadNextHandlerEvt){I._loadNextHandlerEvt.unsubscribe(I._currLoadNextHandler,I)}I._currLoadNextHandler=O[0];if(I._currLoadNextHandler){if(!I._loadNextHandlerEvt){I._loadNextHandlerEvt=new YAHOO.util.CustomEvent("onLoadNext",I)}I._loadNextHandlerEvt.subscribe(I._currLoadNextHandler,I)}}});this.cfg.addProperty("loadPrevHandler",{value:null,handler:function(P,O,Q){if(I._loadPrevHandlerEvt){I._loadPrevHandlerEvt.unsubscribe(I._currLoadPrevHandler,I)}I._currLoadPrevHandler=O[0];if(I._currLoadPrevHandler){if(!I._loadPrevHandlerEvt){I._loadPrevHandlerEvt=new YAHOO.util.CustomEvent("onLoadPrev",I)}I._loadPrevHandlerEvt.subscribe(I._currLoadPrevHandler,I)}}});this.cfg.addProperty("prevButtonStateHandler",{value:null,handler:function(P,O,Q){if(I._currPrevButtonStateHandler){I._prevButtonStateHandlerEvt.unsubscribe(I._currPrevButtonStateHandler,I)}I._currPrevButtonStateHandler=O[0];if(I._currPrevButtonStateHandler){if(!I._prevButtonStateHandlerEvt){I._prevButtonStateHandlerEvt=new YAHOO.util.CustomEvent("onPrevButtonStateChange",I)}I._prevButtonStateHandlerEvt.subscribe(I._currPrevButtonStateHandler,I)}}});this.cfg.addProperty("nextButtonStateHandler",{value:null,handler:function(P,O,Q){if(I._currNextButtonStateHandler){I._nextButtonStateHandlerEvt.unsubscribe(I._currNextButtonStateHandler,I)}I._currNextButtonStateHandler=O[0];if(I._currNextButtonStateHandler){if(!I._nextButtonStateHandlerEvt){I._nextButtonStateHandlerEvt=new YAHOO.util.CustomEvent("onNextButtonStateChange",I)}I._nextButtonStateHandlerEvt.subscribe(I._currNextButtonStateHandler,I)}}});if(J){this.cfg.applyConfig(J)}YAHOO.util.Event.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=YAHOO.util.Dom.getElementsByClassName(B,"ul",this.carouselElem)[0];if(this._nextElementID==null){this._carouselNext=YAHOO.util.Dom.getElementsByClassName(F,"div",this.carouselElem)[0]}else{this._carouselNext=YAHOO.util.Dom.get(this._nextElementID)}if(this._prevElementID==null){this._carouselPrev=YAHOO.util.Dom.getElementsByClassName(E,"div",this.carouselElem)[0]}else{this._carouselPrev=YAHOO.util.Dom.get(this._prevElementID)}this._clipReg=YAHOO.util.Dom.getElementsByClassName(C,"div",this.carouselElem)[0];if(this.isVertical()){YAHOO.util.Dom.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){YAHOO.util.Event.addListener(this._carouselNext,"click",this._scrollNext,this)}if(this._carouselPrev){YAHOO.util.Event.addListener(this._carouselPrev,"click",this._scrollPrev,this)}var H=this.cfg.getProperty("loadInitHandler");if(H){this._loadInitHandlerEvt=new YAHOO.util.CustomEvent("onLoadInit",this);this._loadInitHandlerEvt.subscribe(H,this)}var L=this.cfg.getProperty("loadNextHandler");if(L){this._loadNextHandlerEvt=new YAHOO.util.CustomEvent("onLoadNext",this);this._loadNextHandlerEvt.subscribe(L,this)}var M=this.cfg.getProperty("loadPrevHandler");if(M){this._loadPrevHandlerEvt=new YAHOO.util.CustomEvent("onLoadPrev",this);this._loadPrevHandlerEvt.subscribe(M,this)}var K=this.cfg.getProperty("animationCompleteHandler");if(K){this._animationCompleteEvt=new YAHOO.util.CustomEvent("onAnimationComplete",this);this._animationCompleteEvt.subscribe(K,this)}var A=this.cfg.getProperty("prevButtonStateHandler");if(A){this._prevButtonStateHandlerEvt=new YAHOO.util.CustomEvent("onPrevButtonStateChange",this);this._prevButtonStateHandlerEvt.subscribe(A,this)}var G=this.cfg.getProperty("nextButtonStateHandler");if(G){this._nextButtonStateHandlerEvt=new YAHOO.util.CustomEvent("onNextButtonStateChange",this);this._nextButtonStateHandlerEvt.subscribe(G,this)}var D=this._calculateVisibleExtent();YAHOO.util.Event.onAvailable(this._carouselElemID+"-item-"+D.start,this._calculateSize,this);if(this.cfg.getProperty("loadOnStart")){this._loadInitial()}},_handleMouseDownForSelection:function(A){if(this.cfg.getProperty("disableSelection")){YAHOO.util.Event.preventDefault(A);YAHOO.util.Event.stopPropagation(A)}},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(B){if(this._isValidObj(B)){this.cfg.setProperty("numVisible",B)}this.clear();var A=this._calculateVisibleExtent();YAHOO.util.Event.onAvailable(this._carouselElemID+"-item-"+A.start,this._calculateSize,this);this._loadInitial()},load:function(){var A=this._calculateVisibleExtent();YAHOO.util.Event.onAvailable(this._carouselElemID+"-item-"+A.start,this._calculateSize,this);this._loadInitial()},addItem:function(C,B,D){if(C>this.cfg.getProperty("size")){return null}var E=this.getItem(C);if(!this._isValidObj(E)){E=this._createItem(C,B);this.carouselList.appendChild(E)}else{if(this._isValidObj(E.placeholder)){var A=this._createItem(C,B);this.carouselList.replaceChild(A,E);E=A}}if(this._isValidObj(D)){YAHOO.util.Dom.addClass(E,D)}if(this.isVertical()){setTimeout(function(){E.style.display="block"},1)}return E},insertBefore:function(B,D){if(B>=this.cfg.getProperty("size")){return null}if(B<1){B=1}var A=B-1;if(A>this._lastPrebuiltIdx){this._prebuildItems(this._lastPrebuiltIdx,B)}var C=this._insertBeforeItem(B,D);this._enableDisableControls();return C},insertAfter:function(B,D){if(B>this.cfg.getProperty("size")){B=this.cfg.getProperty("size")}var A=B+1;if(A>this._lastPrebuiltIdx){this._prebuildItems(this._lastPrebuiltIdx,A+1)}var C=this._insertAfterItem(B,D);if(A>this.cfg.getProperty("size")){this.cfg.setProperty("size",A,true)}this._enableDisableControls();return C},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 C=this;var B=function(){C.scrollNext()};this._autoPlayTimer=setTimeout(B,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=YAHOO.util.Dom.get(B);return C},show:function(){YAHOO.util.Dom.setStyle(this.carouselElem,"display","block");this.calculateSize()},hide:function(){YAHOO.util.Dom.setStyle(this.carouselElem,"display","none")},calculateSize:function(){var f=this.carouselList.childNodes;var Q=null;for(var a=0;a<f.length;a++){Q=f[a];if(Q.tagName=="LI"||Q.tagName=="li"){break}}var Z=this.cfg.getProperty("navMargin");var h=this.cfg.getProperty("numVisible");var H=this.cfg.getProperty("firstVisible");var d=this._getStyleVal(Q,"paddingLeft");var W=this._getStyleVal(Q,"paddingRight");var c=this._getStyleVal(Q,"marginLeft");var V=this._getStyleVal(Q,"marginRight");var U=this._getStyleVal(Q,"paddingTop");var C=this._getStyleVal(Q,"paddingBottom");var T=this._getStyleVal(Q,"marginTop");var A=this._getStyleVal(Q,"marginBottom");YAHOO.util.Dom.removeClass(this.carouselList,"carousel-vertical");YAHOO.util.Dom.removeClass(this.carouselList,"carousel-horizontal");if(this.isVertical()){var S=d+W+c+V;YAHOO.util.Dom.addClass(this.carouselList,"carousel-vertical");var F=U+C+T+A;var J=this._getStyleVal(this.carouselList,"paddingTop");var Y=this._getStyleVal(this.carouselList,"paddingBottom");var I=this._getStyleVal(this.carouselList,"marginTop");var X=this._getStyleVal(this.carouselList,"marginBottom");var g=J+Y+I+X;var O=(this._isExtraRevealed())?(this.cfg.getProperty("revealAmount")+(F)/2):0;var D=this._getStyleVal(Q,"height",true);this.scrollAmountPerInc=(D+F);var E=this._getStyleVal(Q,"width");this.carouselElem.style.width=(E+S)+"px";this._clipReg.style.height=(this.scrollAmountPerInc*h+O*2+g)+"px";this.carouselElem.style.height=(this.scrollAmountPerInc*h+O*2+Z*2+g)+"px";var b=(this._isExtraRevealed())?(O-(Math.abs(T-A)+Math.abs(U-C))/2):0;YAHOO.util.Dom.setStyle(this.carouselList,"position","relative");YAHOO.util.Dom.setStyle(this.carouselList,"top",""+b+"px");var M=YAHOO.util.Dom.getY(this.carouselList);YAHOO.util.Dom.setY(this.carouselList,M-this.scrollAmountPerInc*(H-1))}else{YAHOO.util.Dom.addClass(this.carouselList,"carousel-horizontal");var R=this._getStyleVal(this.carouselList,"paddingLeft");var L=this._getStyleVal(this.carouselList,"paddingRight");var P=this._getStyleVal(this.carouselList,"marginLeft");var K=this._getStyleVal(this.carouselList,"marginRight");var G=R+L+P+K;var e=c+V;var S=e+W+d;var O=(this._isExtraRevealed())?(this.cfg.getProperty("revealAmount")+(S)/2):0;var E=Q.offsetWidth;this.scrollAmountPerInc=E+e;this._clipReg.style.width=(this.scrollAmountPerInc*h+O*2)+"px";this.carouselElem.style.width=(this.scrollAmountPerInc*h+Z*2+O*2+G)+"px";var B=(this._isExtraRevealed())?(O-(Math.abs(V-c)+Math.abs(W-d))/2-(P+R)):0;YAHOO.util.Dom.setStyle(this.carouselList,"position","relative");YAHOO.util.Dom.setStyle(this.carouselList,"left",""+B+"px");var N=YAHOO.util.Dom.getX(this.carouselList);YAHOO.util.Dom.setX(this.carouselList,N-this.scrollAmountPerInc*(H-1))}},setProperty:function(C,B,A){this.cfg.setProperty(C,B,A)},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 B=this.cfg.getProperty("firstVisible");var A=this.cfg.getProperty("numVisible");return B+A-1},_getStyleVal:function(A,C,D){var B=YAHOO.util.Dom.getStyle(A,C);var E=D?parseFloat(B):parseInt(B,10);if(C=="height"&&isNaN(E)){E=A.offsetHeight}else{if(isNaN(E)){E=0}}return E},_calculateSize:function(A){A.calculateSize();A.show()},_removeChildrenFromNode:function(B){if(!this._isValidObj(B)){return }var A=B.childNodes.length;while(B.hasChildNodes()){B.removeChild(B.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(B,A){if(B<1){return }var C=document.createElement("li");C.id=this._carouselElemID+"-item-"+B;if(typeof (A)==="string"){C.innerHTML=A}else{C.appendChild(A)}return C},_insertAfterItem:function(B,A){return this._insertBeforeItem(B+1,A)},_insertBeforeItem:function(G,A){var B=this.getItem(G);var D=this.cfg.getProperty("size");if(D!=this.UNBOUNDED_SIZE){this.cfg.setProperty("size",D+1,true)}for(var C=this._lastPrebuiltIdx;C>=G;C--){var F=this.getItem(C);if(this._isValidObj(F)){F.id=this._carouselElemID+"-item-"+(C+1)}}var H=this._createItem(G,A);var E=this.carouselList.insertBefore(H,B);this._lastPrebuiltIdx+=1;return H},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(B,A){if(B!==null){A.stopAutoPlay()}A._scrollPrevInc(A.cfg.getProperty("scrollInc"),(A.cfg.getProperty("animationSpeed")!==0))},_scrollNext:function(B,A){if(B!==null){A.stopAutoPlay()}A._scrollNextInc(A.cfg.getProperty("scrollInc"),(A.cfg.getProperty("animationSpeed")!==0))},_handleAnimationComplete:function(C,B,A){var E=A[0];var D=A[1];E._animationCompleteEvt.fire(D)},_areAllItemsLoaded:function(D,C){var A=true;for(var B=D;B<=C;B++){var E=this.getItem(B);if(!this._isValidObj(E)){this._prebuildLiElem(B);A=false}else{if(this._isValidObj(E.placeholder)){A=false}}}return A},_prebuildItems:function(C,B){for(var A=C;A<=B;A++){var D=this.getItem(A);if(!this._isValidObj(D)){this._prebuildLiElem(A)}}},_isExtraRevealed:function(){return(this.cfg.getProperty("revealAmount")>0)},_scrollNextInc:function(E,J){if(this._scrollNextAnim.isAnimated()||this._scrollPrevAnim.isAnimated()){return false}var N=this.cfg.getProperty("numVisible");var L=this._priorFirstVisible;var I=this._priorLastVisible;var O=this.cfg.getProperty("size");var A=this._calculateAllowableScrollExtent();if(this.cfg.getProperty("wrap")&&I==A.end){this.scrollTo(A.start);return }var K=L+E;var G=K+N-1;if(G>A.end){G=A.end;K=G-N+1}E=K-L;this.cfg.setProperty("firstVisible",K,true);if(E>0){if(this._isValidObj(this.cfg.getProperty("loadNextHandler"))){var D=this._calculateVisibleExtent(K,G);var F=(I+1)<D.start?(I+1):D.start;var H=this._areAllItemsLoaded(F,D.end);this._loadNextHandlerEvt.fire(D.start,D.end,H)}if(J){var M={points:{by:[-this.scrollAmountPerInc*E,0]}};if(this.isVertical()){M={points:{by:[0,-this.scrollAmountPerInc*E]}}}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 B=YAHOO.util.Dom.getY(this.carouselList);YAHOO.util.Dom.setY(this.carouselList,B-this.scrollAmountPerInc*E)}else{var C=YAHOO.util.Dom.getX(this.carouselList);YAHOO.util.Dom.setX(this.carouselList,C-this.scrollAmountPerInc*E)}}}this._priorFirstVisible=K;this._priorLastVisible=G;this._enableDisableControls();return false},_scrollPrevInc:function(G,J){if(this._scrollNextAnim.isAnimated()||this._scrollPrevAnim.isAnimated()){return false}var N=this.cfg.getProperty("numVisible");var L=this._priorFirstVisible;var I=this._priorLastVisible;var O=this.cfg.getProperty("size");var K=L-G;var A=this._calculateAllowableScrollExtent();K=(K<A.start)?A.start:K;var F=K+N-1;if(F>A.end){F=A.end;K=F-N+1}G=L-K;this.cfg.setProperty("firstVisible",K,true);if(G>0){if(this._isValidObj(this.cfg.getProperty("loadPrevHandler"))){var E=this._calculateVisibleExtent(K,F);var C=(L-1)>E.end?(L-1):E.end;var H=this._areAllItemsLoaded(E.start,C);this._loadPrevHandlerEvt.fire(E.start,E.end,H)}if(J){var M={points:{by:[this.scrollAmountPerInc*G,0]}};if(this.isVertical()){M={points:{by:[0,this.scrollAmountPerInc*G]}}}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 B=YAHOO.util.Dom.getY(this.carouselList);YAHOO.util.Dom.setY(this.carouselList,B+this.scrollAmountPerInc*G)}else{var D=YAHOO.util.Dom.getX(this.carouselList);YAHOO.util.Dom.setX(this.carouselList,D+this.scrollAmountPerInc*G)}}}this._priorFirstVisible=K;this._priorLastVisible=F;this._enableDisableControls();return false},_enableDisableControls:function(){var C=this.cfg.getProperty("firstVisible");var A=this.getLastVisible();var B=this._calculateAllowableScrollExtent();if(this._prevEnabled){if(C===B.start){this._disablePrev()}}if(this._prevEnabled===false){if(C>B.start){this._enablePrev()}}if(this._nextEnabled){if(A===B.end){this._disableNext()}}if(this._nextEnabled===false){if(A<B.end){this._enableNext()}}},_loadInitial:function(){var C=this.cfg.getProperty("firstVisible");this._priorLastVisible=this.getLastVisible();if(this._loadInitHandlerEvt){var A=this._calculateVisibleExtent(C,this._priorLastVisible);var B=this._areAllItemsLoaded(1,A.end);this._loadInitHandlerEvt.fire(A.start,A.end,B)}if(this.cfg.getProperty("autoPlay")!==0){this._autoPlayTimer=this.startAutoPlay()}this._enableDisableControls()},_calculateAllowableScrollExtent:function(){var D=this.cfg.getProperty("scrollBeforeAmount");var A=this.cfg.getProperty("scrollAfterAmount");var B=this.cfg.getProperty("size");var C={start:1-D,end:B+A};return C},_calculateVisibleExtent:function(D,A){if(!D){D=this.cfg.getProperty("firstVisible");A=this.getLastVisible()}var B=this.cfg.getProperty("size");D=D<1?1:D;A=A>B?B:A;var C={start:D,end:A};this._firstItemRevealed=-1;this._lastItemRevealed=-1;if(this._isExtraRevealed()){if(D>1){this._firstItemRevealed=D-1;C.start=this._firstItemRevealed}if(A<B){this._lastItemRevealed=A+1;C.end=this._lastItemRevealed}}return C},_disablePrev:function(){this._prevEnabled=false;if(this._prevButtonStateHandlerEvt){this._prevButtonStateHandlerEvt.fire(false,this._carouselPrev)}if(this._isValidObj(this._carouselPrev)){YAHOO.util.Event.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)){YAHOO.util.Event.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)){YAHOO.util.Event.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)){YAHOO.util.Event.addListener(this._carouselNext,"click",this._scrollNext,this)}},_isValidObj:function(A){if(null==A){return false}if("undefined"==typeof (A)){return false}return true}};String.prototype.parseURL=function(G){var C=this,H=/^((?:ht|f|nn)tps?)\:\/\/(?:([^\:\@]*)(?:\:([^\@]*))?\@)?([^\/]*)([^\?\#]*)(?:\?([^\#]*))?(?:\#(.*))?$/,B=[null,"scheme","user","pass","host","path","query","fragment"],E=C.match(H),D,F,A={};if(E==null){return A}for(D=1;D<B.length;D++){if(E[D]!=undefined){A[B[D]]=E[D]}}if(A.path==""){A.path="/"}if(G!=undefined&&E[6]!=undefined){var F=E[6];A.query={};F=F.split("&");for(var D=0;D<F.length;D++){F[D]=F[D].split("=",2);A.query[unescape(F[D][0])]=unescape(F[D][1])}}return A};var error=function(A){};var showURL=function(B){var C=YAHOO.lang.JSON.parse(B.responseText);if(C.error==undefined){var A='<a href="http://youtube.com/get_video.php?video_id='+C.video_id+"&sk="+C.sk+"&fmt_map="+C.fmt_map+"&t="+C.t+"&hl="+C.hl+"&plid="+C.plid+'"><img class="download-image" src="images/Save.gif" alt="" onmouseover="showDesc(\'download the FLV version of the video file\');" onmouseout="showDesc(\'\');" /></a>';A+='<a href="http://youtube.com/get_video.php?video_id='+C.video_id+"&sk="+C.sk+"&fmt_map="+C.fmt_map+"&t="+C.t+"&hl="+C.hl+"&plid="+C.plid+'&fmt=18"><img class="mp4-image" src="images/mp4.gif" alt="" onmouseover="showDesc(\'download the MP4 version of the video file\');" onmouseout="showDesc(\'\');" /></a>';A+='<a href="http://youtube.com/get_video.php?video_id='+C.video_id+"&sk="+C.sk+"&fmt_map="+C.fmt_map+"&t="+C.t+"&hl="+C.hl+"&plid="+C.plid+'&fmt=17"><img class="3gp-image" src="images/cellphone_48.gif" alt="" onmouseover="showDesc(\'download the 3GP version of the video file, perfect for your mobile phone\');" onmouseout="showDesc(\'\');" /></a>';A+='<a href="#" onclick="ui.showEmailForm();"><img class="email-image" src="images/Email.gif" alt="email" onmouseover="showDesc(\'email download link to your friend\');" onmouseout="showDesc(\'\');" /></a>';YAHOO.util.Dom.get("download").innerHTML=A;YAHOO.util.Dom.setStyle("download","display","block");YAHOO.util.Dom.get("currentVideoLink").value="http://youtube.com/get_video.php?video_id="+C.video_id+"&sk="+C.sk+"&fmt_map="+C.fmt_map+"&t="+C.t+"&hl="+C.hl+"plid="+C.plid}else{YAHOO.util.Dom.setStyle("download","display","none")}};var showDetails=function(B){var C=YAHOO.lang.JSON.parse(B.responseText);if(C.error==undefined){var A='<div class="video-thumb">';A+='<img src="'+C.thumbnail+'" alt="" onclick="showVideo(\''+C.id+"', '"+C.title+'\');" "'+C.watchURL+'" />';A+='<p class="view-video"><a href="#" onclick="ui.showVideoPanel(\''+C.id+"', '"+C.title+'\');" "'+C.watchURL+'">view video</a></p>';A+="</div>";A+='<div class="video-details">';A+='<p class="video-title"><a href="#" onclick="ui.showVideoPanel(\''+C.id+"', '"+C.title+'\');" "'+C.watchURL+'" >'+C.title+"</a></p>";A+='<p class="video-description">'+C.description+"</p>";A+="</div>"}else{var A='<div class="error"><img src="images/Warning.gif" alt="error" style="float:left;margin-right: 30px;" />'+C.error+"</div>";YAHOO.util.Dom.setStyle("download","display","none")}YAHOO.util.Dom.get("results").innerHTML=A;YAHOO.util.Dom.setStyle("results","display","block")};var callbackURL={success:showURL,failure:error,cache:true};var callbackDetails={success:showDetails,failure:error,cache:true};var getURL=function(){var B=YAHOO.util.Dom.get("url").value;var D=B.parseURL();if(D.host==undefined){YAHOO.util.Dom.get("results").innerHTML='<div class="error"><img src="images/Warning.gif" alt="error" style="float:left;margin-right: 30px;" />Sorry, won\'t generate the link if you don\'t tell us what you want. Example of a valid URL is : <br/>http://www.youtube.com/watch?v=sE6SR65yTWI </div>';YAHOO.util.Dom.setStyle("results","display","block")}else{if(D.host=="www.youtube.com"||D.host=="youtube.com"){var C=YAHOO.util.Connect.asyncRequest("GET","youtube.py?video="+B,callbackURL);var A=YAHOO.util.Connect.asyncRequest("GET","getDetails.php?video="+B,callbackDetails);YAHOO.util.Dom.get("results").innerHTML='<div class="loading">please wait...<br/><img src="images/loading.gif" alt="loading" /></div>';YAHOO.util.Dom.get("download").innerHTML='<div class="loading">generating download link, patience my friend, is a virtue.<br/><img src="images/loading.gif" alt="loading" /></div>';YAHOO.util.Dom.setStyle("results","display","block");YAHOO.util.Dom.setStyle("download","display","block")}else{YAHOO.util.Dom.get("results").innerHTML='<div class="error"><img src="images/Warning.gif" alt="error" style="float:left;margin-right: 30px;" />Sorry, only YouTube is supported for the time being. Example of a valid URL is : <br/>http://www.youtube.com/watch?v=sE6SR65yTWI </div>';YAHOO.util.Dom.setStyle("results","display","block")}}};YAHOO.util.Event.onAvailable("search",function(){YAHOO.util.Event.addListener("search","click",getURL)});var handlePrevButtonState=function(C,A){var B=A[0];var D=A[1];if(B){D.src="images/Back.gif"}else{D.src="images/Back.gif"}};var handleNextButtonState=function(D,B){var C=B[0];var A=B[1];if(C){A.src="images/Next.gif"}else{A.src="images/Next.gif"}};var pageLoad=function(){var A=new YAHOO.extension.Carousel("carousel",{numVisible:6,animationSpeed:0.5,scrollInc:1,navMargin:0,autoPlay:0,prevElement:"prev-arrow",nextElement:"next-arrow",prevButtonStateHandler:handlePrevButtonState,nextButtonStateHandler:handleNextButtonState})};var initPopularCarousel=function(){var A=new YAHOO.extension.Carousel("carouselpopular",{numVisible:5,animationSpeed:0.5,scrollInc:1,navMargin:0,autoPlay:0,prevElement:"prev-arrow-popular",nextElement:"next-arrow-popular",prevButtonStateHandler:handlePrevButtonState,nextButtonStateHandler:handleNextButtonState})};YAHOO.util.Event.addListener(window,"load",pageLoad);YAHOO.util.Event.addListener(window,"load",initPopularCarousel);var showVideo=function(A,B){var C=new YAHOO.widget.Panel("panel2",{width:"445px",height:"344px",visible:false,draggable:false,close:true,modal:true,fixedcenter:true});C.setHeader(B);C.setBody('<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/7tQk8pKnnVY&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/'+A+'&hl=en&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object>');C.setFooter('<div style="text-align:center;">&copy;2008 f-lv.com</div>');C.render("bd");C.show()};var showDesc=function(A){YAHOO.util.Dom.get("f-lv-desc").innerHTML=A};var ui={callbackEmail:{success:function(B){ui.hideLoadingPanel();var A=YAHOO.lang.JSON.parse(B.responseText);ui.showDialogInfo(A.message)},failure:function(A){}},init:function(){this.dialogEmail=new YAHOO.widget.Dialog("emailForm",{width:"30em",fixedcenter:true,visible:false,modal:true,constraintoviewport:true,buttons:[{text:"Submit",handler:ui.handleSubmitEmail,isDefault:true},{text:"Cancel",handler:function(){this.cancel()}}]});this.dialogEmail.render("bd");this.dialogInfo=new YAHOO.widget.SimpleDialog("simpledialog1",{width:"300px",fixedcenter:true,visible:false,draggable:false,close:true,modal:true,icon:YAHOO.widget.SimpleDialog.ICON_HELP,constraintoviewport:true,buttons:[{text:"close",handler:function(){this.hide()},isDefault:true}]});this.dialogInfo.setHeader("f-lv.com");this.dialogInfo.render("bd");this.loadingPanel=new YAHOO.widget.Panel("wait",{width:"240px",fixedcenter:true,close:false,draggable:false,zindex:4,modal:true,visible:false});this.loadingPanel.setHeader("please wait for the postmaster...");this.loadingPanel.setBody('<div style="text-align:center;"><img src="images/loading.gif" alt="loading" /></div>');this.loadingPanel.render("bd");this.panelVideo=new YAHOO.widget.Panel("panelVideo",{width:"445px",height:"344px",visible:false,draggable:false,close:true,modal:true,fixedcenter:true});this.panelVideo.setFooter('<div style="text-align:center;">&copy;2008 f-lv.com</div>');this.panelVideo.render("bd")},showDialogInfo:function(A){this.dialogInfo.setBody(A);this.dialogInfo.show()},showLoadingPanel:function(){this.loadingPanel.show()},hideLoadingPanel:function(){this.loadingPanel.hide()},showEmailForm:function(){this.dialogEmail.show()},hideEmailForm:function(){this.dialogEmail.cancel()},showVideoPanel:function(A,B){this.panelVideo=new YAHOO.widget.Panel("panel2",{width:"445px",height:"344px",visible:false,draggable:false,close:true,modal:true,fixedcenter:true});this.panelVideo.setHeader(B);this.panelVideo.setBody('&nbsp;<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/'+A+'&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/'+A+'&hl=en&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object>');this.panelVideo.setFooter('<div style="text-align:center;">&copy;2008 f-lv.com</div>');this.panelVideo.render("bd");this.panelVideo.show()},handleSubmitEmail:function(){var C=encodeURIComponent(YAHOO.util.Dom.get("currentVideoLink").value);var B=YAHOO.util.Dom.get("yourname").value;var E=YAHOO.util.Dom.get("friendAddress").value;if(B!=""&&ui.validEmail(E)){var A="link="+C+"&senderName="+B+"&email="+E;var D=YAHOO.util.Connect.asyncRequest("POST","sendEmail.php",ui.callbackEmail,A);ui.hideEmailForm();ui.showLoadingPanel()}else{ui.showDialogInfo("Please enter both, your name and a valid email address")}},validEmail:function(A){var C=false;var B=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;if(B.test(A)){return true}else{return false}}};




