function TabView(d,e,c){this.tp=new Template(e,d);this.tabs=[];this.views=[];this.selectedIx=-1;this.tabChange=c;var b=this;var a=0;this.tp.getEL("tabview_tab",function(f){this.tabs.push(f);f.setProperty("jwtabviewix",a);f.addEvent("mouseover",function(h){var g=parseInt(this.getProperty("jwtabviewix"));b.selectTab(g);h.stop()});f.addEvent("click",function(g){g.stop()});a++},this);this.tp.getEL("tabview_view",function(f){f.style.display="none";this.views.push(f)},this);if(this.tabs.length!=this.views.length){return}if(this.tabs.length>0){this.selectTab(0)}}TabView.prototype={selectTab:function(a){if(a!=this.selectedIx){this.views[a].style.display="block";if(this.selectedIx!=-1){this.views[this.selectedIx].style.display="none";this.tabChange({prevTabIx:this.selectedIx,nextTabIx:a,prevTabEL:this.tabs[this.selectedIx],nextTabEL:this.tabs[a]})}else{this.tabChange({prevTabIx:null,nextTabIx:a,prevTabEL:null,nextTabEL:this.tabs[a]})}this.selectedIx=a}}};var Page={init:function(){TvBox.init();new TabView($("ranking"),$("ranking").innerHTML,function(a){if(a.prevTabEL!=null){a.prevTabEL.className=""}a.nextTabEL.className="now"})}};var TvBox={itemCount:0,btnsELs:[],boxEL:null,selectedIndex:-1,animEnd:false,itemTime:3000,animCurrentIx:1,oneLoad:true,_sid:null,init:function(){this.boxEL=$("tv_box");var b=this.boxEL.getElements("div");this.itemCount=b.length;$("tv_box").appendChild(b[0].cloneNode(true));var c=[];for(var a=0;a<this.itemCount;a++){c.push('<a href="javascript:;" jsvalue="'+a+'"></a>')}$("tv_btns").innerHTML=c.join("");this.btnsELs=$("tv_btns").getElements("a");for(var a=0;a<this.itemCount;a++){this.btnsELs[a].addEvent("click",function(e){e.stop();var d=parseInt(this.getAttribute("jsvalue"));this.blur();clearTimeout(TvBox._sid);TvBox.boxEL.scrollTop=0;TvBox.animCurrentIx=d;TvBox.setSelectedIndex(d);TvBox._sid=setTimeout(TvBox.itemAnim,40)})}this.setSelectedIndex(0);this._sid=setTimeout(this.itemAnim,this.itemTime)},setSelectedIndex:function(a){if(this.selectedIndex!=-1){this.btnsELs[this.selectedIndex].className=""}this.selectedIndex=a;this.btnsELs[this.selectedIndex].className="now"},itemAnim:function(){if(TvBox.oneLoad){TvBox.boxEL.scrollTop=0;TvBox.oneLoad=false}TvBox.boxEL.scrollTop+=8;if(TvBox.boxEL.scrollTop==TvBox.animCurrentIx*80){TvBox.animCurrentIx++;if(TvBox.animCurrentIx==TvBox.itemCount+1){TvBox.animCurrentIx=1;TvBox.setSelectedIndex(0);TvBox.animEnd=true}else{TvBox.setSelectedIndex(TvBox.animCurrentIx-1)}if(TvBox.animEnd){TvBox.boxEL.scrollTop=0;TvBox.animEnd=false}TvBox._sid=setTimeout(TvBox.itemAnim,TvBox.itemTime)}else{TvBox._sid=setTimeout(TvBox.itemAnim,40)}}};