if(!Array.prototype.indexOf){Array.prototype.indexOf=function(C,B){if(B==null){B=0}else{if(B<0){B=Math.max(0,this.length+B)}}for(var A=B;A<this.length;A++){if(this[A]===C){return A}}return -1}}if(!Array.prototype.lastIndexOf){Array.prototype.lastIndexOf=function(C,B){if(B==null){B=this.length-1}else{if(B<0){B=Math.max(0,this.length+B)}}for(var A=B;A>=0;A--){if(this[A]===C){return A}}return -1}}if(!Array.prototype.forEach){Array.prototype.forEach=function(C,D){var A=this.length;for(var B=0;B<A;B++){C.call(D,this[B],B,this)}}}if(!Array.prototype.filter){Array.prototype.filter=function(D,E){var A=this.length;var C=[];for(var B=0;B<A;B++){if(D.call(E,this[B],B,this)){C.push(this[B])}}return C}}if(!Array.prototype.map){Array.prototype.map=function(D,E){var A=this.length;var C=[];for(var B=0;B<A;B++){C.push(D.call(E,this[B],B,this))}return C}}if(!Array.prototype.some){Array.prototype.some=function(C,D){var A=this.length;for(var B=0;B<A;B++){if(C.call(D,this[B],B,this)){return true}}return false}}if(!Array.prototype.every){Array.prototype.every=function(C,D){var A=this.length;for(var B=0;B<A;B++){if(!C.call(D,this[B],B,this)){return false}}return true}}Array.prototype.contains=function(A){return this.indexOf(A)!=-1};Array.prototype.copy=function(A){return this.concat()};Array.prototype.insertAt=function(B,A){this.splice(A,0,B)};Array.prototype.insertBefore=function(C,B){var A=this.indexOf(B);if(A==-1){this.push(C)}else{this.splice(A,0,C)}};Array.prototype.removeAt=function(A){this.splice(A,1)};Array.prototype.remove=function(B){var A=this.indexOf(B);if(A!=-1){this.splice(A,1)}};if(!String.prototype.toQueryParams){String.prototype.toQueryParams=function(){var E={};var G=this.trim().split("&");var A=/\b=(?!=)/;for(var C=0;C<G.length;C++){var F=G[C].split(A);var B=decodeURIComponent(F[0]);var D=F[1]?decodeURIComponent(F[1]):undefined;if(E[B]!==undefined){if(E[B].constructor!=Array){E[B]=[E[B]]}if(D){E[B].push(D)}}else{E[B]=D}}return E}}if(!String.prototype.trim){String.prototype.trim=function(){var A=/^\s+|\s+$/g;return function(){return this.replace(A,"")}}()}if(!String.prototype.replaceAll){String.prototype.replaceAll=function(B,A){return this.replace(new RegExp(B,"gm"),A)}}Math.randomInt=function(A){return Math.floor(Math.random()*(A+1))};$D=YAHOO.util.Dom;$E=YAHOO.util.Event;$=$D.get;TB={};TB.namespace=function(){var A=arguments,E=null,C,B,D;for(C=0;C<A.length;C=C+1){D=A[C].split(".");E=TB;for(B=(D[0]=="TB")?1:0;B<D.length;B=B+1){E[D[B]]=E[D[B]]||{};E=E[D[B]]}}return E};TB.namespace("env");TB.env={hostname:"taobao.com",debug:false,lang:"zh-cn"};TB.namespace("locale");TB.locale={Messages:{},getMessage:function(A){return TB.locale.Messages[A]||A},setMessage:function(A,B){TB.locale.Messages[A]=B}};$M=TB.locale.getMessage;TB.trace=function(A){if(!TB.env.debug){return }if(window.console){window.console.debug(A)}else{alert(A)}};TB.init=function(){this.namespace("widget","dom","bom","util","form","anim");if(location.hostname.indexOf("taobao.com")==-1){TB.env.hostname=location.hostname;TB.env.debug=true}var A=document.getElementsByTagName("script");var C=/tbra(?:[\w\.\-]*?)\.js(?:$|\?(.*))/;var E;for(var B=0;B<A.length;++B){if(E=C.exec(A[B].src)){TB.env["path"]=A[B].src.substring(0,E.index);if(E[1]){var D=E[1].toQueryParams();for(n in D){if(n=="t"||n=="timestamp"){TB.env["timestamp"]=parseInt(D[n]);continue}TB.env[n]=D[n]}}}}document.write('<script type="text/javascript" src="'+TB.env["path"]+"locale/"+TB.env.lang.toLowerCase()+".js"+(TB.env.timestamp?"?t="+TB.env.timestamp+".js":"")+'"><\/script>');document.write('<link type="text/css" rel="stylesheet" href="'+TB.env["path"]+"assets/tbra.css"+(TB.env.timestamp?"?t="+TB.env.timestamp+".css":"")+'" />')};TB.init();TB.common={trim:function(A){return A.replace(/(^\s*)|(\s*$)/g,"")},escapeHTML:function(B){var C=document.createElement("div");var A=document.createTextNode(B);C.appendChild(A);return C.innerHTML},unescapeHTML:function(A){var B=document.createElement("div");B.innerHTML=A.replace(/<\/?[^>]+>/gi,"");return B.childNodes[0]?B.childNodes[0].nodeValue:""},stripTags:function(A){return A.replace(/<\/?[^>]+>/gi,"")},toArray:function(B,D){var C=[];for(var A=D||0;A<B.length;A++){C[C.length]=B[A]}return C},applyIf:function(C,A){if(C&&A&&typeof A=="object"){for(var B in A){if(!YAHOO.lang.hasOwnProperty(C,B)){C[B]=A[B]}}}return C},apply:function(C,A){if(C&&A&&typeof A=="object"){for(var B in A){C[B]=A[B]}}return C},formatMessage:function(D,A,B){var C=/\{([\w-]+)?\}/g;return function(G,E,F){return G.replace(C,function(H,I){return F?F(E[I],I):E[I]})}}()};TB.applyIf=TB.common.applyIf;TB.apply=TB.common.apply;(function(){var E=navigator.userAgent.toLowerCase();var B=E.indexOf("opera")!=-1,G=E.indexOf("safari")!=-1,A=!B&&!G&&E.indexOf("gecko")>-1,C=!B&&E.indexOf("msie")!=-1,F=!B&&E.indexOf("msie 6")!=-1,D=!B&&E.indexOf("msie 7")!=-1;TB.bom={isOpera:B,isSafari:G,isGecko:A,isIE:C,isIE6:F,isIE7:D,getCookie:function(H){var I=document.cookie.match("(?:^|;)\\s*"+H+"=([^;]*)");return I?unescape(I[1]):""},setCookie:function(J,L,H,K,M){L=escape(L);L+=(K)?"; domain="+K:"";L+=(M)?"; path="+M:"";if(H){var I=new Date();I.setTime(I.getTime()+(H*86400000));L+="; expires="+I.toGMTString()}document.cookie=J+"="+L},removeCookie:function(H){this.setCookie(H,"",-1)},pickDocumentDomain:function(){var K=arguments[1]||location.hostname;var J=K.split("."),H=J.length;var I=arguments[0]||(H<3?0:1);if(I>=H||H-I<2){I=H-2}return J.slice(I).join(".")},addBookmark:function(I,H){if(window.sidebar){window.sidebar.addPanel(I,H,"")}else{if(document.external){window.external.AddFavorite(H,I)}else{}}}}})();TB.dom={insertAfter:function(B,A){return $D.insertAfter(B,A)},getAncestorByTagName:function(B,A){return $D.getAncestorByTagName(B,A)},getAncestorByClassName:function(B,A){return $D.getAncestorByClassName(B,A)},getNextSibling:function(A){return $D.getNextSibling(A)},getPreviousSibling:function(A){return $D.getPreviousSibling(A)},getFieldLabelHtml:function(E,D){var B=$(E),F=(D||B.parentNode).getElementsByTagName("label");for(var C=0;C<F.length;C++){var A=F[C].htmlFor||F[C].getAttribute("for");if(A==B.id){return F[C].innerHTML}}return null},getIframeDocument:function(B){var A=$(B);return A.contentWindow?A.contentWindow.document:A.contentDocument},setFormAction:function(E,C){E=$(E);var B=E.elements["action"];var D;if(B){var A=E.removeChild(B);D=function(){E.appendChild(A)}}E.action=C;if(D){D()}return true},addCSS:function(A,C){C=C||document;var B=C.createElement("style");B.type="text/css";if(B.styleSheet){B.styleSheet.cssText=A}else{B.appendChild(C.createTextNode(A))}C.getElementsByTagName("head")[0].appendChild(B)},getScriptParams:function(C){var F=/\?(.*?)($|\.js)/;var B;if(YAHOO.lang.isObject(C)&&C.tagName&&C.tagName.toLowerCase()=="script"){if(C.src&&(B=C.src.match(F))){console.debug(B);return B[1].toQueryParams()}}else{if(YAHOO.lang.isString(C)){C=new RegExp(C,"i")}var A=document.getElementsByTagName("script");var G,E;for(var D=0;D<A.length;++D){E=A[D].src;if(E&&C.test(E)&&(B=E.match(F))){return B[1].toQueryParams()}}}}};TB.anim.Highlight=function(B,A){if(!B){return }this.init(B,A)};TB.anim.Highlight.defConfig={startColor:"#ffff99",duration:0.5,keepBackgroundImage:true};TB.anim.Highlight.prototype.init=function(E,D){var G=YAHOO.util;D=TB.applyIf(D||{},TB.anim.Highlight.defConfig);var A={backgroundColor:{from:D.startColor}};var F=new G.ColorAnim(E,A,D.duration);var B=F.getAttribute("backgroundColor");F.attributes["backgroundColor"]["to"]=B;if(D.keepBackgroundImage){var C=$D.getStyle(E,"background-image");F.onComplete.subscribe(function(){$D.setStyle(E,"background-image",C)})}this.onComplete=F.onComplete;this.animate=function(){$D.setStyle(E,"background-image","none");F.animate()}};TB.widget.InputHint=new function(){var B={hintMessage:"",hintClass:"InputHint",appearOnce:false};var D=/^\s*$/;var A=function(E,F){F.disappear()};var C=function(E,F){F.appear()};this.decorate=function(E,F){E=$(E);F=TB.applyIf(F||{},B);var H=F.hintMessage||E.title;var G={};G.disappear=function(){if(H==E.value){E.value="";$D.removeClass(E,F.hintClass)}};G.appear=function(){if(D.test(E.value)||H==E.value){E.value=H;$D.addClass(E,F.hintClass)}};E.setAttribute("title",H);$E.on(E,"focus",A,G);$E.on(E,"drop",A,G);if(!F.appearOnce){$E.on(E,"blur",C,G)}G.appear();return G}};TB.widget.SimplePopup=new function(){var C=YAHOO.util;var H,B;var F={position:"right",autoFit:true,eventType:"mouse",delay:0.2,disableClick:true,width:200,height:200};var D=function(J,K){if(J.contains&&K!=null){return J.contains(K)}else{while(K){if(K==J){return true}K=K.parentNode}return false}};var G=function(J){var K=$E.getTarget(J);if(G._target==K){this.popup.style.display=="block"?this.hide():this.show()}else{this.show()}$E.preventDefault(J);G._target=K};var A=function(K){clearTimeout(B);var J=this;H=setTimeout(function(){J.show()},this.config.delay*1000);if(this.config.disableClick&&!this.trigger.onclick){this.trigger.onclick=function(L){$E.preventDefault($E.getEvent(L))}}};var E=function(J){clearTimeout(B);$E.preventDefault(J)};var I=function(J){clearTimeout(H);$E.preventDefault(J);if(!D(this.popup,$E.getRelatedTarget(J))){this.delayHide()}};this.decorate=function(M,K,L){if(YAHOO.lang.isArray(M)||(YAHOO.lang.isObject(M)&&M.length)){for(var N=0;N<M.length;N++){this.decorate(M[N],K,L)}return }M=$(M);K=$(K);if(!M||!K){return }L=TB.applyIf(L||{},F);var P={};var J=new C.CustomEvent("onShow",P,false,C.CustomEvent.FLAT);if(L.onShow){J.subscribe(L.onShow)}var O=new C.CustomEvent("onHide",P,false,C.CustomEvent.FLAT);if(L.onHide){O.subscribe(L.onHide)}if(L.eventType=="mouse"){$E.on(M,"mouseover",A,P,true);$E.on(M,"mouseout",I,P,true);if(!$E.getListeners(K,"mouseover")){$E.on(K,"mouseover",E)}if(!$E.getListeners(K,"mouseout")){$E.on(K,"mouseout",I,P,true)}}else{if(L.eventType=="click"){$E.on(M,"click",G,P,true)}}TB.apply(P,{popup:K,trigger:M,config:L,show:function(){this.hide();var Y=$D.getXY(this.trigger);if(YAHOO.lang.isArray(this.config.offset)){Y[0]+=parseInt(this.config.offset[0]);Y[1]+=parseInt(this.config.offset[1])}var V=this.trigger.offsetWidth,R=this.trigger.offsetHeight;var Z=L.width,W=L.height;var Q=$D.getViewportWidth(),X=$D.getViewportHeight();var T=Math.max(document.documentElement.scrollLeft,document.body.scrollLeft);var b=Math.max(document.documentElement.scrollTop,document.body.scrollTop);var S=Y[0],a=Y[1];if(L.position=="left"){S=Y[0]-Z}else{if(L.position=="right"){S=Y[0]+V}else{if(L.position=="bottom"){a=a+R}else{if(L.position=="top"){a=a-W;if(a<0){a=0}}}}}if(this.config.autoFit){if(a-b+W>X){a=X-W+b-2;if(a<0){a=0}}}this.popup.style.position="absolute";this.popup.style.top=a+"px";this.popup.style.left=S+"px";if(this.config.effect){if(this.config.effect=="fade"){this.popup.style.display="block";$D.setStyle(this.popup,"opacity",0);var U=new C.Anim(this.popup,{opacity:{to:1}},0.4);U.animate()}}else{this.popup.style.display="block"}J.fire()},hide:function(){this.popup.style.display="none";O.fire()},delayHide:function(){var Q=this;B=setTimeout(function(){Q.hide()},this.config.delay*1000)}});$D.setStyle(K,"display","none");return P}};TB.widget.SimpleRating=new function(){var defConfig={rateUrl:"",rateParams:"",scoreParamName:"score",topScore:5,currentRatingClass:"current-rating"};var rateHandler=function(ev,handle){$E.stopEvent(ev);var aEl=$E.getTarget(ev);var score=parseInt(aEl.innerHTML);try{aEl.blur()}catch(e){}handle.rate(score)};var updateCurrentRating=function(currentRatingLi,avg,config){if(currentRatingLi){currentRatingLi.innerHTML=avg}$D.setStyle(currentRatingLi,"width",avg*100/config.topScore+"%")};this.decorate=function(ratingContainer,config){ratingContainer=$(ratingContainer);config=TB.applyIf(config||{},defConfig);var currentRatingLi=$D.getElementsByClassName(config.currentRatingClass,"li",ratingContainer)[0];var onRateEvent=new YAHOO.util.CustomEvent("onRate",null,false,YAHOO.util.CustomEvent.FLAT);if(config.onRate){onRateEvent.subscribe(config.onRate)}var handle={};handle.init=function(avg){updateCurrentRating(currentRatingLi,avg,config)};handle.update=function(ret){if(ret&&ret.Average&&currentRatingLi){updateCurrentRating(currentRatingLi,ret.Average,config)}$E.purgeElement(ratingContainer,true,"click");for(var lis=ratingContainer.getElementsByTagName("li"),i=lis.length-1;i>0;i--){ratingContainer.removeChild(lis[i])}onRateEvent.fire(ret)};handle.rate=function(score){var indicator=TB.util.Indicator.attach(ratingContainer,{message:$M("pleaseWait")});indicator.show();ratingContainer.style.display="none";var postData=config.scoreParamName+"="+score;if(config.rateParams){postData+="&"+config.rateParams}YAHOO.util.Connect.asyncRequest("POST",config.rateUrl,{success:function(req){indicator.hide();ratingContainer.style.display="";var ret=eval("("+req.responseText+")");if(ret.Error){alert(ret.Error.Message);return }else{handle.update(ret)}},failure:function(req){indicator.hide();ratingContainer.style.display="";TB.trace($M("ajaxError"))}},postData)};handle.onRate=function(callback){if(YAHOO.lang.isFunction(callback)){onRateEvent.subscribe(callback)}};var triggers=ratingContainer.getElementsByTagName("a");for(var i=0;i<triggers.length;i++){$E.on(triggers[i],"click",rateHandler,handle)}return handle}};TB.widget.SimpleScroll=new function(){var Y=YAHOO.util;var defConfig={delay:2,speed:20,startDelay:2,direction:"vertical",disableAutoPlay:false,distance:"auto",scrollItemCount:1};this.decorate=function(container,config){container=$(container);config=TB.applyIf(config||{},defConfig);var step=2;if(config.speed<20){step=5}if(config.lineHeight){config.distance=config.lineHeight}var scrollTimeId=null,startTimeId=null,startDelayTimeId=null;var isHorizontal=(config.direction.toLowerCase()=="horizontal")||(config.direction.toLowerCase()=="h");var handle={};handle._distance=0;handle.scrollable=true;handle.distance=config.distance;handle._distance=0;handle.suspend=false;handle.paused=false;var _onScrollEvent=new Y.CustomEvent("_onScroll",handle,false,Y.CustomEvent.FLAT);_onScrollEvent.subscribe(function(){var curLi=container.getElementsByTagName("li")[0];if(!curLi){this.scrollable=false;return }this.distance=(config.distance=="auto")?curLi[isHorizontal?"offsetWidth":"offsetHeight"]:config.distance;with(container){if(isHorizontal){this.scrollable=(scrollWidth-scrollLeft-offsetWidth)>=this.distance}else{this.scrollable=(scrollHeight-scrollTop-offsetHeight)>=this.distance}}});var onScrollEvent=new Y.CustomEvent("onScroll",handle,false,Y.CustomEvent.FLAT);if(config.onScroll){onScrollEvent.subscribe(config.onScroll)}else{onScrollEvent.subscribe(function(){for(var i=0;i<config.scrollItemCount;i++){container.appendChild(container.getElementsByTagName("li")[0])}container[isHorizontal?"scrollLeft":"scrollTop"]=0})}var scroll=function(){if(handle.suspend){return }handle._distance+=step;var _d;if((_d=handle._distance%handle.distance)<step){container[isHorizontal?"scrollLeft":"scrollTop"]+=(step-_d);clearInterval(scrollTimeId);onScrollEvent.fire();_onScrollEvent.fire();startTimeId=null;if(handle.scrollable&&!handle.paused){handle.play()}}else{container[isHorizontal?"scrollLeft":"scrollTop"]+=step}};var start=function(){if(handle.paused){return }handle._distance=0;scrollTimeId=setInterval(scroll,config.speed)};$E.on(container,"mouseover",function(){handle.suspend=true});$E.on(container,"mouseout",function(){handle.suspend=false});TB.apply(handle,{subscribeOnScroll:function(func,override){if(override===true&&onScrollEvent.subscribers.length>0){onScrollEvent.unsubscribeAll()}onScrollEvent.subscribe(func)},pause:function(){this.paused=true;clearTimeout(startTimeId);startTimeId=null},play:function(){this.paused=false;if(startDelayTimeId){clearTimeout(startDelayTimeId)}if(!startTimeId){startTimeId=setTimeout(start,config.delay*1000)}}});handle.onScroll=handle.subscribeOnScroll;_onScrollEvent.fire();if(!config.disableAutoPlay){startDelayTimeId=setTimeout(function(){handle.play()},config.startDelay*1000)}return handle}};(function(){var A=YAHOO.util;TB.widget.Slide=function(B,C){this.init(B,C)};TB.widget.Slide.defConfig={slidesClass:"Slides",triggersClass:"SlideTriggers",currentClass:"Current",eventType:"click",autoPlayTimeout:5,disableAutoPlay:false};TB.widget.Slide.prototype={init:function(B,C){this.container=$(B);this.config=TB.applyIf(C||{},TB.widget.Slide.defConfig);try{this.slidesUL=$D.getElementsByClassName(this.config.slidesClass,"ul",this.container)[0];this.slides=$D.getChildren(this.slidesUL);if(this.slides.length==0){throw new Error()}}catch(D){throw new Error("can't find slides!")}this.delayTimeId=null;this.autoPlayTimeId=null;this.curSlide=-1;this.sliding=false;this.pause=false;this.onSlide=new A.CustomEvent("onSlide",this,false,A.CustomEvent.FLAT);if(YAHOO.lang.isFunction(this.config.onSlide)){this.onSlide.subscribe(this.config.onSlide,this,true)}this.initSlides();this.initTriggers();if(this.slides.length>0){this.play(1)}if(!this.config.disableAutoPlay){this.autoPlay()}if(YAHOO.lang.isFunction(this.config.onInit)){this.config.onInit.call(this)}},initTriggers:function(){var D=document.createElement("ul");this.container.appendChild(D);for(var C=0;C<this.slides.length;C++){var B=document.createElement("li");B.innerHTML=C+1;D.appendChild(B)}D.className=this.config.triggersClass;this.triggersUL=D;if(this.config.eventType=="mouse"){$E.on(this.triggersUL,"mouseover",this.mouseHandler,this,true);$E.on(this.triggersUL,"mouseout",function(E){clearTimeout(this.delayTimeId);this.pause=false},this,true)}else{$E.on(this.triggersUL,"click",this.clickHandler,this,true)}},initSlides:function(){$E.on(this.slides,"mouseover",function(){this.pause=true},this,true);$E.on(this.slides,"mouseout",function(){this.pause=false},this,true);$D.setStyle(this.slides,"display","none")},clickHandler:function(D){var C=$E.getTarget(D);var B=parseInt(TB.common.stripTags(C.innerHTML));while(C!=this.container){if(C.nodeName.toUpperCase()=="LI"){if(!this.sliding){this.play(B,true)}break}else{C=C.parentNode}}},mouseHandler:function(E){var D=$E.getTarget(E);var B=parseInt(TB.common.stripTags(D.innerHTML));while(D!=this.container){if(D.nodeName.toUpperCase()=="LI"){var C=this;this.delayTimeId=setTimeout(function(){C.play(B,true);C.pause=true},(C.sliding?0.5:0.1)*1000);break}else{D=D.parentNode}}},play:function(E,C){E=E-1;if(E==this.curSlide){return }var B=this.curSlide>=0?this.curSlide:0;if(C&&this.autoPlayTimeId){clearInterval(this.autoPlayTimeId)}var D=this.triggersUL.getElementsByTagName("li");D[B].className="";D[E].className=this.config.currentClass;this.slide(E);this.curSlide=E;if(C&&!this.config.disableAutoPlay){this.autoPlay()}},slide:function(C){var B=this.curSlide>=0?this.curSlide:0;this.sliding=true;$D.setStyle(this.slides[B],"display","none");$D.setStyle(this.slides[C],"display","block");this.sliding=false;this.onSlide.fire(C)},autoPlay:function(){var B=this;var C=function(){if(!B.pause&&!B.sliding){var D=(B.curSlide+1)%B.slides.length+1;B.play(D,false)}};this.autoPlayTimeId=setInterval(C,this.config.autoPlayTimeout*1000)}};TB.widget.ScrollSlide=function(B,C){this.init(B,C)};YAHOO.extend(TB.widget.ScrollSlide,TB.widget.Slide,{initSlides:function(){TB.widget.ScrollSlide.superclass.initSlides.call(this);$D.setStyle(this.slides,"display","")},slide:function(E){var B=this.curSlide>=0?this.curSlide:0;var C={scroll:{by:[0,this.slidesUL.offsetHeight*(E-B)]}};var D=new A.Scroll(this.slidesUL,C,0.5,A.Easing.easeOutStrong);D.onComplete.subscribe(function(){this.sliding=false;this.onSlide.fire(E)},this,true);D.animate();this.sliding=true}});TB.widget.FadeSlide=function(B,C){this.init(B,C)};YAHOO.extend(TB.widget.FadeSlide,TB.widget.Slide,{initSlides:function(){TB.widget.FadeSlide.superclass.initSlides.call(this);$D.setStyle(this.slides,"position","absolute");$D.setStyle(this.slides,"top",this.config.slideOffsetY||0);$D.setStyle(this.slides,"left",this.config.slideOffsetX||0);$D.setStyle(this.slides,"z-index",1)},slide:function(D){if(this.curSlide==-1){$D.setStyle(this.slides[D],"display","block")}else{var B=this.slides[this.curSlide];$D.setStyle(B,"display","block");$D.setStyle(B,"z-index",10);var C=new A.Anim(B,{opacity:{to:0}},0.5,A.Easing.easeNone);C.onComplete.subscribe(function(){$D.setStyle(B,"z-index",1);$D.setStyle(B,"display","none");$D.setStyle(B,"opacity",1);this.sliding=false;this.onSlide.fire(D)},this,true);$D.setStyle(this.slides[D],"display","block");C.animate();this.sliding=true}}})})();TB.widget.SimpleSlide=new function(){this.decorate=function(A,B){if(!A){return }B=B||{};if(B.effect=="scroll"){if(TB.bom.isGecko){if(YAHOO.util.Dom.get(A).getElementsByTagName("iframe").length>0){new TB.widget.Slide(A,B);return }}new TB.widget.ScrollSlide(A,B)}else{if(B.effect=="fade"){new TB.widget.FadeSlide(A,B)}else{new TB.widget.Slide(A,B)}}}};TB.widget.SimpleTab=new function(){var C=YAHOO.util;var A={eventType:"click",currentClass:"Current",tabClass:"",autoSwitchToFirst:true,stopEvent:true,delay:0.1};var B=function(F){var D=[];if(!F){return D}for(var E=0,G=F.childNodes;E<G.length;E++){if(G[E].nodeType==1){D[D.length]=G[E]}}return D};this.decorate=function(D,G){D=$(D);G=TB.applyIf(G||{},A);var K={};var L=B(D);var F=L.shift(0);var E=F.getElementsByTagName("li");var I,N;if(G.tabClass){I=$D.getElementsByClassName(G.tabClass,"*",D)}else{I=TB.common.toArray(F.getElementsByTagName("a"))}var O=new C.CustomEvent("onSwitch",null,false,C.CustomEvent.FLAT);if(G.onSwitch){O.subscribe(G.onSwitch)}var J=function(Q){if(N){M()}var P=I.indexOf(this);K.switchTab(P);if(G.stopEvent){try{$E.stopEvent(Q)}catch(R){}}return !G.stopEvent};var H=function(P){var Q=this;N=setTimeout(function(){J.call(Q,P)},G.delay*1000);if(G.stopEvent){$E.stopEvent(P)}return !G.stopEvent};var M=function(){clearTimeout(N)};if(G.eventType=="mouse"){$E.on(I,"focus",J);$E.on(I,"mouseover",G.delay?H:J);$E.on(I,"mouseout",M)}else{$E.on(I,"click",J)}TB.apply(K,{switchTab:function(P){$D.setStyle(L,"display","none");$D.removeClass(E,G.currentClass);$D.addClass(E[P],G.currentClass);$D.setStyle(L[P],"display","block");O.fire(P)},subscribeOnSwitch:function(P){O.subscribe(P)}});K.onSwitch=K.subscribeOnSwitch;$D.setStyle(L,"display","none");if(G.autoSwitchToFirst){K.switchTab(0)}return K}};TB.util.CountdownTimer=new function(){var F=YAHOO.util;var E=60;var D=E*60;var G=D*24;var C={formatStyle:"short",formatPattern:"",hideZero:true,timeoutText:"timeoutText",updatable:true};var A=function(H){return((H<10)?"0":"")+H};var B=function(H){return function(J,I){switch(I){case"d":return parseInt(H/G);case"dd":return A(parseInt(H/G));case"hh":return A(parseInt(H%G/D));case"h":return parseInt(H%G/D);case"mm":return A(parseInt(H%G%D/E));case"m":return parseInt(H%G%D/E);case"ss":return A(parseInt(H%G%D%E));case"s":return parseInt(H%G%D%E)}}};this.attach=function(H,I,K){H=$(H);I=parseInt(I);K=TB.applyIf(K||{},C);var N={};var O=new F.CustomEvent("onStart",null,false,F.CustomEvent.FLAT);if(K.onStart){O.subscribe(K.onStart)}var J=new F.CustomEvent("onEnd",null,false,F.CustomEvent.FLAT);if(K.onEnd){J.subscribe(K.onEnd)}var L=parseInt(new Date().getTime()/1000);var M=L+I;var P=function(){N.update()};N.update=function(){var T=K.formatPattern,R={},S=1;if(K.formatStyle=="long"){T="{d}"+$M("day")+"{hh}"+$M("hour")+"{mm}"+$M("minute")+"{ss}"+$M("second")}var Q=M-parseInt(new Date().getTime()/1000);if(Q<=0){H.innerHTML=$M(K.timeoutText);J.fire();return }else{if(Q>G){if(K.formatStyle=="short"){T="{d}"+$M("day")+"{hh}"+$M("hour");S=Math.floor(Q%G%D)||D}}else{if(Q>D){if(K.formatStyle=="short"){T="{hh}"+$M("hour")+"{mm}"+$M("minute");S=Math.floor(Q%D%E)||E}else{if(K.formatStyle=="long"&&K.hideZero){T="{hh}"+$M("hour")+"{mm}"+$M("minute")+"{ss}"+$M("second")}}}else{if(Q>0){if(K.formatStyle=="short"||(K.formatStyle=="long"&&K.hideZero)){T="{mm}"+$M("minute")+"{ss}"+$M("second")}}}}}H.innerHTML=TB.common.formatMessage(T,R,B(Q));if(K.updatable&&S>0){setTimeout(P,S*1000)}};N.init=function(){this.update();O.fire()};N.init();return N}};TB.util.Indicator=new function(){var A={message:"loading",useShim:false,useIFrame:false,centerIndicator:true};var B=function(D,C){shim=document.createElement("div");shim.className="tb-indic-shim";$D.setStyle(shim,"display","none");D.parentNode.insertBefore(shim,D);if(C){var E=document.createElement("iframe");E.setAttribute("frameBorder",0);E.className="tb-indic-shim-iframe";D.parentNode.insertBefore(E,D)}return shim};this.attach=function(F,D){F=$(F);D=TB.applyIf(D||{},A);var C=document.createElement("div");C.className="tb-indic";$D.setStyle(C,"display","none");$D.setStyle(C,"position","static");C.innerHTML="<span>"+$M(D.message)+"</span>";if(D.useShim){var G=B(F,D.useIFrame);G.appendChild(C)}else{F.parentNode.insertBefore(C,F)}var E={};E.show=function(I){if(D.useShim){var H=$D.getRegion(F);var K=C.parentNode;$D.setStyle(K,"display","block");$D.setXY(K,[H[0],H[1]]);$D.setStyle(K,"width",(H.right-H.left)+"px");$D.setStyle(K,"height",(H.bottom-H.top)+"px");if(D.useIFrame){var J=K.nextSibling;$D.setStyle(J,"width",(H.right-H.left)+"px");$D.setStyle(J,"height",(H.bottom-H.top)+"px");$D.setStyle(J,"display","block")}$D.setStyle(C,"display","block");$D.setStyle(C,"position","absolute");if(D.centerIndicator){$D.setStyle(C,"top","50%");$D.setStyle(C,"left","50%");C.style.marginTop=-(C.offsetHeight/2)+"px";C.style.marginLeft=-(C.offsetWidth/2)+"px"}}else{$D.setStyle(C,"display","");if(I){$D.setStyle(C,"position","absolute");$D.setXY(C,I)}}};E.hide=function(){if(D.useShim){var I=C.parentNode;$D.setStyle(C,"display","none");$D.setStyle(I,"display","none");if(D.useIFrame){$D.setStyle(C.parentNode.nextSibling,"display","none")}try{if(D.useIFrame){I.parentNode.removeChild(I.nextSibling)}I.parentNode.removeChild(I)}catch(H){}}else{$D.setStyle(C,"display","none");try{C.parentNode.removeChild(C)}catch(H){}}};return E}};TB.util.Pagination=new function(){var PAGE_SEPARATOR="...";var defConfig={pageUrl:"",prevPageClass:"PrevPage",noPrevClass:"NoPrev",prevPageText:"prevPageText",nextPageClass:"NextPage",nextPageText:"nextPageText",noNextClass:"NoNext",currPageClass:"CurrPage",pageParamName:"page",appendParams:"",pageBarMode:"bound",showIndicator:true,cachePageData:false};var cancelHandler=function(ev){$E.stopEvent(ev)};var pageHandler=function(ev,args){$E.stopEvent(ev);var target=$E.getTarget(ev);args[1].gotoPage(args[0])};var buildBoundPageList=function(pageIndex,pageCount){var l=[];var leftStart=1;var leftEnd=2;var mStart=pageIndex-2;var mEnd=pageIndex+2;var rStart=pageCount-1;var rEnd=pageCount;if(mStart<=leftEnd){leftStart=0;leftEnd=0;mStart=1}if(mEnd>=rStart){rStart=0;rEnd=0;mEnd=pageCount}if(leftEnd>leftStart){for(var i=leftStart;i<=leftEnd;++i){l[l.length]=""+i}if((leftEnd+1)<mStart){l[l.length]=PAGE_SEPARATOR}}for(var i=mStart;i<=mEnd;++i){l[l.length]=""+i}if(rEnd>rStart){if((mEnd+1)<rStart){l[l.length]=PAGE_SEPARATOR}for(var i=rStart;i<=rEnd;++i){l[l.length]=""+i}}return l};var buildPageEntry=function(idx,config){var liEl=document.createElement("li");if(idx!=PAGE_SEPARATOR){$D.addClass(liEl,(idx=="prev")?config.prevPageClass:(idx=="next")?config.nextPageClass:"");var aEl=document.createElement("a");aEl.setAttribute("title",(idx=="prev")?$M(config.prevPageText):(idx=="next")?$M(config.nextPageText):""+idx);aEl.href=buildPageUrl(idx,config)+"&t="+new Date().getTime();aEl.innerHTML=(idx=="prev")?$M(config.prevPageText):(idx=="next")?$M(config.nextPageText):idx;liEl.appendChild(aEl)}else{liEl.innerHTML=PAGE_SEPARATOR}return liEl};var buildPageUrl=function(idx,config){var url=config.pageUrl+(config.pageUrl.lastIndexOf("?")!=-1?"&":"?")+config.pageParamName+"="+idx;if(config.appendParams){url+="&"+config.appendParams}return url};this.attach=function(pageBarContainer,pageDataContainer,config){pageBarContainer=$(pageBarContainer);pageDataContainer=$(pageDataContainer);config=TB.applyIf(config||{},defConfig);if(config.cachePageData){var pageDataCache={}}var ulEl=document.createElement("ul");pageBarContainer.appendChild(ulEl);var pageLoadEvent=new YAHOO.util.CustomEvent("pageLoad",null,false,YAHOO.util.CustomEvent.FLAT);var handle={};handle.rebuildPageBar=function(pageObj){if(!pageObj){return }this.pageIndex=parseInt(pageObj.PageIndex);this.totalCount=parseInt(pageObj.TotalCount);this.pageCount=parseInt(pageObj.PageCount);this.pageSize=parseInt(pageObj.PageSize);ulEl.innerHTML="";var list=this.repaginate();var prevLiEl=buildPageEntry("prev",config);if(!this.isPrevPageAvailable()){$D.addClass(prevLiEl,config.noPrevClass);$E.on(prevLiEl,"click",cancelHandler)}else{$E.on(prevLiEl,"click",pageHandler,[this.pageIndex-1,this])}ulEl.appendChild(prevLiEl);for(var i=0;i<list.length;i++){var liEl=buildPageEntry(list[i],config);if(list[i]==this.pageIndex){$D.addClass(liEl,config.currPageClass);$E.on(liEl,"click",cancelHandler)}else{$E.on(liEl,"click",pageHandler,[list[i],this])}ulEl.appendChild(liEl)}var nextLiEl=buildPageEntry("next",config);if(!this.isNextPageAvailable()){$D.addClass(nextLiEl,config.noNextClass);$E.on(nextLiEl,"click",cancelHandler)}else{$E.on(nextLiEl,"click",pageHandler,[this.pageIndex+1,this])}ulEl.appendChild(nextLiEl)};handle.repaginate=function(){var mode=config.pageBarMode;if(mode=="bound"){return buildBoundPageList(parseInt(this.pageIndex),parseInt(this.pageCount))}else{if(mode=="line"){var l=[];for(var i=1;i<=this.pageCount;i++){l.push(i)}return l}else{if(mode=="eye"){return[]}}}};handle.gotoPage=function(idx){this.disablePageBar();if(config.showIndicator){$D.setStyle(pageDataContainer,"display","none");var indicator=TB.util.Indicator.attach(pageDataContainer,{message:$M("loading")});indicator.show()}var url=buildPageUrl(idx,config);if(config.cachePageData){if(pageDataCache[url]){handle.showPage(pageDataCache[url]);return }}YAHOO.util.Connect.asyncRequest("GET",url+"&t="+new Date().getTime(),{success:function(req){var resultSet=eval("("+req.responseText+")");handle.showPage(resultSet.Pagination);if(config.cachePageData){pageDataCache[url]=resultSet.Pagination}if(config.showIndicator){indicator.hide();$D.setStyle(pageDataContainer,"display","block")}},failure:function(req){if(config.showIndicator){$D.setStyle(pageDataContainer,"display","block");indicator.hide()}handle.rebuildPageBar();alert($M("ajaxError"))}})};handle.showPage=function(pageObj){this._showPage(pageObj);this.rebuildPageBar(pageObj);pageLoadEvent.fire(pageObj)};handle._showPage=function(pageObj){if(pageObj.PageData&&YAHOO.lang.isString(pageObj.PageData)){pageDataContainer.innerHTML=pageObj.PageData}};handle.isNextPageAvailable=function(){return this.pageIndex<this.pageCount};handle.isPrevPageAvailable=function(){return this.pageIndex>1};handle.disablePageBar=function(){$D.addClass(pageBarContainer,"Disabled");$E.purgeElement(pageBarContainer,true,"click");var els=TB.common.toArray(pageBarContainer.getElementsByTagName("a"));els.forEach(function(el,i){$E.on(el,"click",cancelHandler);el.disabled=1})};handle.onPageLoad=function(callback){if(YAHOO.lang.isFunction(callback)){pageLoadEvent.subscribe(callback)}};handle.setAppendParams=function(params){config.appendParams=params};return handle}};TB.util.QueryData=function(){this.data=[];this.addField=function(A){for(var B=0;B<arguments.length;B++){var C=arguments[B];if(C){this.add(C.name,encodeURIComponent(C.value))}}};this.add=function(A,B){this.data.push({"name":A,"value":B})};this.get=function(A){for(var B=0;B<this.data.length;B++){if(this.data[B].name===A){return this.data[B].value}}return null};this.toQueryString=function(){var A=this.data.map(function(C,B){return C.name+"="+C.value});return A.join("&")}};TB.form.CheckboxGroup=new function(){var E=YAHOO.util;var B={checkAllBox:"CheckAll",checkAllBoxClass:"tb:chack-all",checkOnInit:true};var D=function(G,F){return G.checked};var A=function(G,F){if(G.type&&G.type.toLowerCase()=="checkbox"){G.checked=true}};var C=function(G,F){if(G.type&&G.type.toLowerCase()=="checkbox"){G.checked=false}};this.attach=function(K,G){G=TB.applyIf(G||{},B);var J={};var H=new E.CustomEvent("onCheck",J,false,E.CustomEvent.FLAT);var I=[];if(K){if(K.length){I=TB.common.toArray(K)}else{I[0]=K}}var L=[];if(G.checkAllBoxClass){L=$D.getElementsByClassName(G.checkAllBoxClass,null,I[0].form)}if($(G.checkAllBox)){L.push($(G.checkAllBox))}var F=function(){var O=I.filter(D);if(I.length==0){L.forEach(C)}else{L.forEach((O.length==I.length)?A:C)}J._checkedBoxCount=O.length};var M=function(O){var P=$E.getTarget(O);F();H.fire(P);return true};TB.apply(J,{_checkedBoxCount:0,onCheck:function(O){H.subscribe(O)},isCheckAll:function(){return this._checkedBoxCount==I.length},isCheckNone:function(){return this._checkedBoxCount==0},isCheckSome:function(){return this._checkedBoxCount!=0},isCheckSingle:function(){return this._checkedBoxCount==1},isCheckMulti:function(){return this._checkedBoxCount>1},toggleCheckAll:function(){var O=I.every(D);I.forEach(O?C:A);if(I.length==0){L.forEach(C)}else{L.forEach(O?C:A)}J._checkedBoxCount=(O)?0:I.length;I.forEach(function(P){H.fire(P)})},toggleChecked:function(O){O.checked=!O.checked;F();H.fire(O)},getCheckedBoxes:function(){return I.filter(D)}});$E.on(I,"click",M);if(G.onCheck&&YAHOO.lang.isFunction(G.onCheck)){H.subscribe(G.onCheck,J,true)}if(L.length>0){$E.on(L,"click",J.toggleCheckAll)}if(G.checkOnInit){F();var N=function(){I.forEach(function(O){H.fire(O)})};setTimeout(N,10)}return J}};TB.form.TagAssistor=new function(){var B={separator:" ",selectedClass:"Selected"};var A=function(E,D){return E.indexOf(TB.common.trim(D.innerHTML))!=-1};var C=function(D,E){var F=D.value.replace(/\s+/g," ").trim();if(F.length>0){return F.split(E)}else{return[]}};this.attach=function(E,F,G){E=$(E);F=$(F);G=TB.applyIf(G||{},B);var H=TB.common.toArray(F.getElementsByTagName("a"));var J=function(L){var K=C(E,G.separator);var M=$E.getTarget(L);if(A(K,M)){K.remove(TB.common.trim(M.innerHTML))}else{K.push(TB.common.trim(M.innerHTML))}D(K);E.value=K.join(G.separator)};var D=function(K){H.forEach(function(M,L){if(A(K,M)){$D.addClass(M,G.selectedClass)}else{$D.removeClass(M,G.selectedClass)}})};var I={};I.init=function(){var K=C(E,G.separator);H.forEach(function(M,L){if(A(K,M)){$D.addClass(M,G.selectedClass)}$E.on(M,"click",J)});$E.on(E,"keyup",function(M){var L=C(E,G.separator);D(L)})};I.init()}}
