(function(){window.Config={version:"1.6.5 Build 200908121015",url:"{dataSrc : \"/data/<#=boardId#>/<#=type#>/<#=myId#>_<#=page#>.html\",\t\t\tmelody : \"/reply/melody.jsp\",\t\t\tmodifyNickname : \"/reply/alterNickname.jsp\",\t\t\tnewPost : \"/mem/<#=postId#>\",\t\t\tlogin : \"http://<#=host#>/reply/check.jsp?board=<#=boardId#>&threadid=<#=threadId#>&type=<#=type#>\",\t\t\tlogout : \"http://reg.163.com/Logout.jsp?username=<#=userName#>&url=<#=url#>\",\t\t\tsupport : \"/reply/upvote/<#=boardId#>/<#=threadId#>_<#=id#>\",\t\t\tagainst : \"/reply/against/<#=boardId#>/<#=threadId#>_<#=id#>\",\t\t\tpost : \"/reply/dopost.jsp\",\t\t\tfav : \"http://<#=host#>/<#=boardId#>/<#=threadId#>/<#=id#>.html\",\t\t\twatering : \"/viewReplyTree.jsp?userid=<#=userName#>\",\t\t\treport : \"http://bbs.163.com/bbs/addcharge.jsp?title=<#=title#>&reason=<#=reason#>&btype=r&url=http://<#=host#>/<#=boardId#>/<#=threadId#>/<#=id#>.html&anchor=<#=threadId#>_<#=id#>&isg=<#=isGame#>\"}",favDocTitle:"\u300a<#=title#>\u300b\u7684\u7f51\u6613\u8ddf\u8d34",nicknameTips:{theDefault:"\u8ddf\u8d34\u6635\u79f0\u4fee\u6539\u540e\uff0c\u8bba\u575b\u6635\u79f0\u4e5f\u4f1a\u53d8\u54e6",invalid:"\u6635\u79f0\u5305\u542b\u975e\u6cd5\u5b57\u7b26",empty:"\u6635\u79f0\u4e0d\u80fd\u4e3a\u7a7a",senting:"\u63d0\u4ea4\u4e2d...",failed:"\u4fee\u6539\u5931\u8d25\uff0c\u8bf7\u91cd\u65b0\u5c1d\u8bd5",success:"\u4fee\u6539\u6210\u529f"},replyTips:{theDefault:"\u6587\u660e\u4e0a\u7f51\uff0c\u767b\u5f55\u53d1\u8d34",bodyEmpty:"\u8bf7\u586b\u5199\u5185\u5bb9",hasReply:"\u6c34\u4e0d\u662f\u8fd9\u4e48\u704c\u6ef4\uff0c\u559d\u53e3\u8336\u6b47\u4e00\u5206\u949f\u5427\uff01",toReport:"\u8bf7\u586b\u5199\u4e3e\u62a5\u539f\u56e0",tooMuch:"\u60a8\u7684\u56de\u590d\u8d85\u51fa\u5185\u5bb9\u9650\u5236",noSelf:"\u8ddf\u8d34\u53d1\u5e03\u4e2d\uff0c\u8bf7\u5237\u65b0\u540e\u91cd\u8bd5",errId:"\u9519\u8bef\u7684\u5f15\u7528\u7f16\u53f7",userEmpty:"\u8bf7\u5148\u767b\u5f55\u6216\u8f93\u5165\u6635\u79f0\u518d\u53d1\u8d34",nicknameMax:"\u6635\u79f0\u4e0d\u80fd\u8d85\u8fc716\u4e2a\u5b57\u7b26",needLogin:"\u8bf7\u767b\u5f55\u540e\u53d1\u8d34",noReply:"\u76ee\u524d\u6ca1\u6709\u8ddf\u8d34\uff0c\u6b22\u8fce\u4f60\u53d1\u8868\u89c2\u70b9",noHot:"\u76ee\u524d\u6ca1\u6709\u70ed\u95e8\u8ddf\u8d34",noNew:"",noSupport:"\u76ee\u524d\u6ca1\u6709\u652f\u6301\u6570\u5927\u4e8e\u201c2\u201d\u7684\u8ddf\u8d34",noAgainst:"\u76ee\u524d\u6ca1\u6709\u53cd\u5bf9\u6570\u5927\u4e8e\u652f\u6301\u6570\u7684\u8ddf\u8d34"},loginTips:{userNameEmpty:"\u8bf7\u586b\u5199\u901a\u884c\u8bc1\u5e10\u53f7",passwordEmpty:"\u8bf7\u586b\u5199\u5bc6\u7801",loginFirst:"\u8bf7\u5148\u767b\u5f55"},cookie:{domain:document.location.host.replace(/^comment/i,""),postTime:"my_posttime_<#=threadId#>",newPost:"my_comment_<#=threadId#>",nickname:"NTES_REPLY_NICKNAME",toMain:"toMain",toReply:"toReply"},maxFloor:50,userNameLengthLimit:16,needUserName:true,cacheTimeout:120000,pageSize:30,abstractSize:20,isGame:"n"};$.util.isFunction=function($){return Object.prototype.toString.call($)==="[object Function]"};$.event.getDelegate=function($,A,B){try{return $[this.eventsWrapper][A][B[this.idName]]}catch(_){}return B};$.event.removeEvent=function(A,_,B){return $.dom.eachNode(A,function(_,A){A=$.event.getDelegate(this,_,A);if(this.detachEvent)this.detachEvent("on"+_,A);else if(this.removeEventListener)this.removeEventListener(_,A,false)},[_,B])};window.removeEvent=document.removeEvent=$.element.removeEvent=function(_,A){return $.event.removeEvent(this,_,A)};$.element.attr=function(_,A){if(A!==undefined)return $.dom.eachNode(this,function(_,A){this[_]=$.util.isFunction(A)?A.call(this):A},arguments);else return isArray(this)?this[0][_]:this[_]};String.prototype.right=function($){return this.slice(-$)};var toTwoDigit=function($){return $<10?"0"+$:$.toString()};Date.prototype.format=function(F){var C=this.getFullYear(),B=this.getMonth()+1,E=this.getDate(),D=this.getHours(),_=D>12?D-12:D,$=this.getMinutes(),A=this.getSeconds();return F.replace(/[ymdhsHM]+/g,function(F){switch(F){case"yyyy":return C;case"yy":return C.toString().right(2);case"MM":return toTwoDigit(B);case"M":return B;case"dd":return toTwoDigit(E);case"d":return E;case"HH":return toTwoDigit(D);case"H":return D;case"hh":return toTwoDigit(_);case"h":return _;case"mm":return toTwoDigit($);case"m":return $;case"ss":return toTwoDigit(A);case"s":return A;default:return F}})};$.dom.replaceNode=function($,_){if($.replaceNode)$.replaceNode(_);else if($.parentNode.replaceChild)$.parentNode.replaceChild(_,$)};$.style.getCurrentStyle=function(B,_,$){var A=B.nodeType?B:B[0];return(A.currentStyle||($||window).getComputedStyle(A,null))[_]};$.ui.Template={_cache:{},get:function($){return this._cache[$]==null?"":this._cache[$]},parse:function(A,_){return $.util.parseTpl(this.get(A),_)},load:function(){var _=$("#templates > div"),A=_.length;while(--A>=0)this._cache[_[A].title]=_[A].innerHTML.replace(/(?:^\s*<!--)|(?:-->\s*$)/g,"")}};$.ui.DragHandler=function(A,I){this.constructor=arguments.callee;var B=$.style.getCurrentStyle(A,"position").toLowerCase()==="fixed",H={x:A.offsetLeft||0-(B?body.scrollLeft:0),y:A.offsetTop||0-(B?body.scrollTop:0)},J,E,D,F;function G($){var _={x:Math.max(0,Math.min(doc.scrollWidth-A.offsetWidth,$.pageX-J.x)),y:Math.max(0,Math.min(doc.scrollHeight-A.offsetHeight,$.pageY-J.y))};A.style.left=_.x+"px";A.style.top=_.y+"px";H={x:_.x-(B?body.scrollLeft:0),y:_.y-(B?body.scrollTop:0)};D&&D(A,this,_);$.cancelBubble=true}function _(){if(A.releaseCapture)A.releaseCapture();else if(window.captureEvents)window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);body.removeEvent("mousemove",G);body.removeEvent("mouseup",_);F&&F(A)}function C($){if(A.setCapture)A.setCapture();else if(window.captureEvents)window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);J={x:$.pageX-A.offsetLeft,y:$.pageY-A.offsetTop};body.addEvent("mousemove",G);body.addEvent("mouseup",_);E&&E(A,this);$.preventDefault()}this.setOnDragStart=function($){E=$};this.setOnMove=function($){onMove=$};this.setOnStopMove=function($){onStopMove=$};this.init=function(){$.event.addEvent(I,"mousedown",C)}};$.ui.Win=function(B){if(!arguments.length)return;var _=this;_.constructor=arguments.callee;_._wrapper=B;_._isShowed=$.style.getCurrentStyle(B,"visibility").toLowerCase()!="hidden";_._isFixed=$.style.getCurrentStyle(B,"position").toLowerCase()=="fixed";(new $.ui.DragHandler(B,B.$("> .title"))).init();var A=_.hide.bind(_);B.$("a.close, input.close").addEvent("click",function(){A();return false})};$.ui.Win.prototype={show:function(E,C){var _=this;if(!_._isShow){var A=_._wrapper;if($.browser.msie&&$.browser.version<7){_._tempTop=doc.scrollTop;_._tempScroll=_._scroll.bind(_);window.addEvent("scroll",_._tempScroll)}var B,D;if(_._isFixed){B=isNaN(E)?parseInt((doc.clientWidth-A.offsetWidth)/2):E-doc.scrollLeft;D=isNaN(C)?parseInt((doc.clientHeight-A.offsetHeight)/2.3):C-doc.scrollTop}else{B=isNaN(E)?parseInt((doc.clientWidth-A.offsetWidth)/2+doc.scrollLeft):E;D=isNaN(C)?parseInt((doc.clientHeight-A.offsetHeight)/2.3+doc.scrollTop):C}A.style.left=B+"px";A.style.top=D+"px";A.style.visibility="visible";_._isShowed=true}},hide:function(){var _=this;if(_._isShowed){$.style.addCss(_._wrapper,"visibility:hidden;left:0;top:0;");_._tempScroll&&window.removeEvent("scroll",_._tempScroll);_._isShowed=false}},_scroll:function(){var $=this;$._wrapper.style.top=parseInt($._wrapper.style.top)+doc.scrollTop-$._tempTop;$._tempTop=doc.scrollTop}};var doc=document.documentElement,body=$(document.body),Html={_ENTITYREGEX:/<|>|"|&|'| /g,_ENTITIES:{"<":"&lt;",">":"&gt;","\"":"&quot;","&":"&amp;","'":"&#39"," ":"&nbsp;"},encode:function($){return $.replace(this._ENTITYREGEX,function($){return Html._ENTITIES[$]||""})}},SimpleTpl={_re:/<#=(\w+)#>/g,parse:function(_,$){return $?String(_).replace(this._re,function(_,A){return $[A]!=null?$[A]:_}):_}},Visitor={account:"",nickname:"",hasLogin:false,init:function(){var _=this,A=$.cookie.get("P_INFO");if(A!=""){A=A.split("|");if(A.length>3){_.account=A[0].replace(/@163\.com$/i,"");_.hasLogin=_.account!=""&&0==A[2]}}_.nickname=$.cookie.get(Config.cookie.nickname);if(_.hasLogin&&""==_.nickname)_.nickname=_.account},modifyNickname:function(C,B,A){var _;if(""==C)_=Config.nicknameTips.empty;else if(/[<>"'&]/.test(C))_=Config.nicknameTips.invalid;if(_)A&&A(_);else $.ajax.send(Config.url.modifyNickname,"POST",{nickname:C},{timeout:20000,onSuccess:function(D){var $=D.responseText;if($!=""){switch($){case"-1":_=Config.loginTips.loginFirst;break;case"-2":_=Config.nicknameTips.empty;break;default:$=$.split(":");_=2==$.length?$[1]:Config.nicknameTips.failed}A&&A(_)}else{Visitor.nickname=C;B&&B(Config.nicknameTips.success)}},onError:function($){A&&A($.responseText)},onTimeout:function($){A&&A($.responseText)}})}},reFrom=/^(.*?)(?:\s|&nbsp;)/i;reNickname=/<a[^<>]*>(.*?)<\/a>/i,reIp=/<span[^<>]*>(.*?)<\/span>/i,reMobile=/^(TELE_)?(.*?)(_\{\})?$/,reMailUser=/^([^@]+@[^@]+?)(?:\.\w*)?$/;function Tie(A){var $=this;$.data=A;$.length=0;$.hasSupport=false;$.hasAgainst=false;$.isMobile=false;$.author="";$.ip="";$.isNew=A.isNew||false;while($.data[++$.length]!=null);$.length=$.length-1;if($.length){var _=$.data[$.length];if(_.p){$.id=_.p;$.id=$.id.indexOf("_")>=0?$.id.split("_")[1]:$.id}if($.id==null)throw"Invalid tie id";$.postTime=_.t;$.againstCount=_.a||0;$.supportCount=_.v||0;if(_.l!=null)$.isShrink=_.l==="1";else $.isShrink=$.length>=4;if(reFrom.test(_.f))$.from=RegExp.$1;if(reNickname.test(_.f))$.nickname=RegExp.$1;else if(reIp.test(_.f))$.ip=RegExp.$1;if(reMobile.test(_.u)){if(RegExp.$1)$.isMobile=true;if($.nickname!=null)$.author=RegExp.$2}if($.nickname==null)$.nickname=$.author;Tie.data[$.id]=$}else throw"Empty reply data"}Tie.prototype={expand:function(){$("#tie_"+this.id+" div.body").attr("innerHTML",this.toWholeFloor());return false},toFloor:function(A){var _=this;if(null==A)A=_.isShrink;if(_.length==1)return $.ui.Template.parse("oneLayerTie",_.data["1"]);else return _[A&&_.length>2?"toSummaryFloor":"toWholeFloor"]()},toWholeFloor:function(){var _,A=this,D,B,C;for(D=1,C=A.length;D<=C;D++){B={content:A.data[D].b,innerFloor:_||"",seq:D};if(D<C){B.author=A.data[D].f;_=$.ui.Template.parse("wholeFloor",B)}else{B.author=A.author;B.from=A.from;B.ip=A.ip;_=$.ui.Template.parse("lastFloor",B)}}return _},toSummaryFloor:function(){var _={from:this.from,ip:this.ip,author:this.data["1"].f,content:this.data["1"].b,lastContent:this.data[this.length].b,id:this.id};return $.ui.Template.parse("summaryFloor",_)},support:function(){var B=this;if(!B.hasSupport){var _=$("#tie_"+B.id+" li.support"),C=_.$("a")[0],A=_.$("span")[0];Tie.sendVote(Config.url.support.replace("<#=id#>",B.id),C,"\u5df2\u652f\u6301",A);B.hasSupport=true}return false},against:function(){var B=this;if(!B.hasAgainst){var _=$("#tie_"+B.id+" li.against"),C=_.$("a")[0],A=_.$("span")[0];Tie.sendVote(Config.url.against.replace("<#=id#>",B.id),C,"\u5df2\u53cd\u5bf9",A);B.hasAgainst=true}return false},report:function(){var $=prompt(Config.replyTips.toReport,"");$=null==$?"":$.trim();if($!=""){var A=this.data[this.length],_;_={id:this.id,title:encodeURIComponent(A.b.replace(/<[^>]*>/g,"").right(Config.abstractSizegth)),reason:$};document.location.href=SimpleTpl.parse(Config.url.report,_)}return false},quote:function(){var _=this;if(!Tie.isTimeout())alert(Config.replyTips.hasReply);else if("0"==_.id)alert(Config.replyTips.noSelf);else if(_.length>=Config.maxFloor)alert(Config.replyTips.tooMuch);else{var B=$("#quote"),A=B.value;if(/_$/.test(A))B.value+=_.id;else B.value=A.replace(/[^_]+$/,_.id);$("#quoteId").value=_.id;quoteWin.show();if(Visitor.hasLogin)$("#quoteBody").focus();else $("#quoteLogin input[name=username]")[0].focus()}return false},addToFav:function(){var A=$("#addToFav"),_=A.$("a.favUrl")[0],B=Config.url.fav.replace("<#=id#>",this.id);_.href=B;_.innerHTML=B;if(window.clipboardData){window.clipboardData.clearData();window.clipboardData.setData("Text",B+"#\r\n"+Config.favDocTitle);A.$("span.success")[0].style.display="";A.$("span.failed, p.replyCopy").addCss("display:none;")}else{A.$("span.success")[0].style.display="none";A.$("span.failed")[0].style.display=""}favWin.show();return false},toAdminMode:function(){var _=$("#tie_"+this.id+" ul.operations")[0];if(_)_.innerHTML+=$.ui.Template.parse("adminLinks",{id:this.id})},del:function(){Admin.delPost(this.id);return false},setScore:function(){Admin.setScore(this.data[this.length].v,this.id);return false}};Tie.buildFloors=function(D,F){if(D&&D.length){var G=-1,E=D.length,C,A={},B=[];while(++G<E){try{C=new Tie(D[G])}catch(_){C=null}if(C&&!A[C.id]){A[C.id]=true;C.body=C.toFloor(F?0:null);B[G]=$.ui.Template.parse("tie",C)}}return B.join("")}else return""};Tie.sendVote=function(D,B,_,A){$.ajax.send(D,"POST",null,{timeout:15000});var C=A.innerHTML,E=document.createElement("span");E.innerHTML=_;E.className="visited";$.dom.replaceNode(B,E);A.innerHTML=isNaN(C)?1:parseInt(C)+1};Tie.buildPages=function(C,B){var _=Math.ceil(C/Config.pageSize),D,A;data={pages:[{text:"\u4e0a\u4e00\u9875",page:B-1,isOff:B==1},{text:"1",page:1}],currentPage:B};if(_<=5){for(D=2;D<=_;D++)data.pages.push({text:D,page:D})}else if(B>=5){if(6==B)data.pages.push({text:2,page:2});else if(B>5)data.pages.push(null);A=Math.min(_,B+3);for(D=B-3;D<=A;D++)data.pages.push({text:D,page:D});if(D<_)data.pages.push(null)}else{for(D=2;D<=5;D++)data.pages.push({text:D,page:D});data.pages.push(null)}data.pages.push({text:"\u4e0b\u4e00\u9875",page:B+1,isOff:B==_});return $.ui.Template.parse("pages",data)};Tie.getInputValues=function(A){var C,B,_,D;if("y"==Config.isGame)C=$("#"+A+"GameUser");else if(!Visitor.hasLogin){alert(Config.replyTips.needLogin);$("#"+A+"Login input[name=username]")[0].focus();return}if(C){B=C.value.trim();if(""==B)D=Config.replyTips.userEmpty;else if(B.length>Config.userNameLengthLimit)D=Config.replyTips.nicknameMax;else if(/<|>/.test(B))D=Config.nicknameTips.invalid;if(D){alert(D);C.focus();return}$.cookie.set(Config.cookie.nickname,B,30*24*60,".163.com","/")}var E=$("#"+A+"Body"),_=E.value.trim();if(_==Config.replyTips.theDefault||""==_)D=Config.replyTips.bodyEmpty;else if(_.length>1000)D=Config.replyTips.tooMuch;if(D){alert(D);E.focus();return}if(!Tie.isTimeout())return alert(Config.replyTips.hasReply);return values={nickname:B,body:_}};Tie.ajaxPost=function(B){var A=Tie.getInputValues(B);if(!A)return false;var _={"f":"\u7f51\u6613\u7f51\u53cb <span>ip\uff1a*.*.*.*\uff1a</span>","v":"0","t":(new Date()).format("yyyy-MM-dd HH:mm:ss"),"b":A.body.trim(),"a":"0","p":"0","l":"0"};Tie.lastPostTime=+new Date;if("reply"==B)Tie.newReply={"1":_};else if("quote"==B){var C=Tie.data[$("#quoteId").value],D=[];if(!C){alert(Config.replyTips.errId);return false}for(var E=1;E<=C.length;E++)D[E]=C.data[E];D[E]=_;Tie.newReply=D}$.ajax.send(Config.url.post,"POST",{board:$("#boardId").value,quote:"quote"==B?$("#quote").value:"",url:$("#postUrl").value,threadid:$("#threadId").value,hidename:false,username:A.nickname!=null?A.nickname:"",body:_.b});if("quote"==B)quoteWin.hide();_.b=Html.encode(_.b);if(Tie.encodeContent)_.b=Tie.encodeContent(_.b);$("#"+B+"Body").value=Config.replyTips.theDefault;Tie.setPostTime()};Tie.normalPost=function(A){var _=Tie.getInputValues(A);if(!_)return false;if(_.nickname!=null)$("#"+A+"UserName").value=_.nickname;$.cookie.set(Config.cookie.toMain,1,0.4,Config.cookie.domain,"/")};Tie.setPostTime=function(){$.cookie.set(Config.cookie.postTime,+new Date,1,Config.cookie.domain,"/")};Tie.isTimeout=function(){return""==$.cookie.get(Config.cookie.postTime)};Tie.data={};window.Tie=Tie;function Page(boardId,threadId,type){if(!arguments.length)return;var t=this;t.constructor=arguments.callee;t._cache={};t._timerId=null;t._type=type?type.toLowerCase():"df";t._boardId=boardId;t._threadId=threadId;var title=$("h1 a")[0].innerHTML,conf={url:document.location,host:document.location.host,boardId:boardId,threadId:threadId.replace(/_.*$/,""),myId:threadId,type:type,title:title.replace(/"/g,"\\\""),isGame:Config.isGame};eval("Config.url = "+SimpleTpl.parse(Config.url,conf));conf.title=title;Config.favDocTitle=SimpleTpl.parse(Config.favDocTitle,conf);Config.cookie.newPost=SimpleTpl.parse(Config.cookie.newPost,conf);Config.cookie.postTime=SimpleTpl.parse(Config.cookie.postTime,conf);$("input[name=board]").attr("value",conf.boardId);$("input[name=threadid]").attr("value",conf.threadId);$("input[name=url]").attr("value","http://"+conf.host+"/"+conf.boardId+"/"+conf.threadId+".html");$("#quote").value=conf.threadId+"_";$("#addToFav span.docTitle")[0].innerHTML=Config.favDocTitle;$("form.login input[name=url]").attr("value",Config.url.login);var replySubmit=function(_,B){if("df"==type){_.preventDefault();if(Tie.ajaxPost(B)!==false){t.showPage(1);var A=$("#mainReplies");window.scrollTo(A.offsetLeft,A.offsetTop)}}else return Tie.normalPost(B)};$("#replyForm").addEvent("submit",replySubmit,"reply");$("#quoteForm").addEvent("submit",replySubmit,"quote");if(Visitor.hasLogin){var tempObj={userName:Visitor.account};$("a.toWaterList").attr("href",SimpleTpl.parse(Config.url.watering,tempObj));$("a.logout").attr("href",SimpleTpl.parse(Config.url.logout,tempObj))}if(!t._timerId)t._clearCache()}Page.prototype={showPage:function(A){var _=this;$("div.replies").attr("innerHTML",$.ui.Template.get("loadingReply"));A=A||1;if(!_._cache[A])$.ajax.importJs(Config.url.dataSrc.replace("<#=page#>",A),function(){if("undefined"===typeof replyData)alert("\u8bfb\u53d6\u8ddf\u8d34\u6570\u636e\u51fa\u9519\uff0c\u8bf7\u5237\u65b0\u9875\u9762\u91cd\u8bd5");else{replyData.page=A;_._cache[A]=replyData;_._processData(replyData)}}.bind(_),"utf-8");else _._processData(_._cache[A]);return false},_clearCache:function(){var $=this;$._cache.length=0;if(!Tie.lastPostTime||(Tie.lastPostTime&&+new Date-Tie.lastPostTime>=Config.cacheTimeout))Tie.newReply=null;$._timerId=setTimeout($._clearCache.bind($),Config.cacheTimeout)},_processData:function(D){var B=this;Tie.data={};B.initView&&B.initView(D);if(Visitor.hasLogin){var A=B._boardId,C=B._threadId;$.ajax.importJs(Config.url.melody,function(){if("undefined"!==typeof Admin){Admin.boardId=A;Admin.threadId=C}})}var _;if($.cookie.get(Config.cookie.toMain)!=""){_=$("#mainReplies");$.cookie.del(Config.cookie.toMain)}else if($.cookie.get(Config.cookie.toReply)!=""){_=$("#replyForm");$.cookie.del(Config.cookie.toReply)}if(_)window.scrollTo(_.offsetLeft,_.offsetTop);else window.scrollTo(0,0)}};function DefaultPage(_,B){var A=this;A._hotReplies=$("#hotReplies");A._mainReplies=$("#mainReplies");Page.call(A,_,B,"df")}DefaultPage.prototype=new Page;DefaultPage.prototype.showPage=function(D){var A=this,E,C,B;if(1==D){E=$.cookie.get(Config.cookie.newPost);if(E){$.ajax.importJs(SimpleTpl.parse(Config.url.newPost,{postId:E}),function(){if(typeof newReplyData!="undefined")Tie.newReply=newReplyData;C=true;clearTimeout(B)});B=setTimeout(function(){C=true},20000)}}var _=function(){if((E&&C)||!E)Page.prototype.showPage.call(A,D);else setTimeout(_,500)};_();return false};DefaultPage.prototype.initView=function(B){var J=this._hotReplies,A=this._mainReplies;if(B.page>1){J.style.display="none";A.$("div.title").removeCss("blue")}else{J.style.display="block";A.$("div.title").addCss("blue");if(Tie.newReply&&(!B.newPosts||B.newPosts[0]!=Tie.newReply)){Tie.newReply.isNew=true;var I=[Tie.newReply];if(B.newPosts){var C=B.newPosts.length;for(var E=0;E<C;E++)I[E+1]=B.newPosts[E]}B.newPosts=I}}var K=B.newPosts&&B.newPosts.length,_=B.hotPosts&&B.hotPosts.length,G=J.$("> .replies")[0],D=A.$("> .replies")[0],H,F;if(_&&K){H=Tie.buildFloors(B.hotPosts,true);F=Tie.buildFloors(B.newPosts)}else if(!_&&!K){var L=$.ui.Template.parse("noContent",{tips:Config.replyTips.noReply});H=F=L}else if(!_&&K){H=$.ui.Template.parse("noContent",{tips:Config.replyTips.noHot});F=Tie.buildFloors(B.newPosts)}else if(_&&!K){H=Tie.buildFloors(B.hotPosts);F=$.ui.Template.parse("noContent",{tips:Config.replyTips.noNew})}if(1==B.page)G.innerHTML=H;D.innerHTML=F;$("ul.pages").attr("innerHTML",Tie.buildPages(B.thread.tcount,B.page));$("strong.total").attr("innerHTML",B.thread.rcount);$("strong.displayCount").attr("innerHTML",B.thread.tcount)};function AttitudePage(A,C,_){var B=this;B._mainWrapper=$("#mainReplies > .replies")[0];B._attitude=_;Page.call(B,A,C,_)}AttitudePage.prototype=new Page;AttitudePage.prototype.initView=function(A){var _=this;if(A.hotVotePost&&A.hotVotePost.length)_._mainWrapper.innerHTML=Tie.buildFloors(A.hotVotePost);else _._mainWrapper.innerHTML=$.ui.Template.parse("noContent",{tips:Config.replyTips["vt"==_._attitude?"noSupport":"noAgainst"]});$("ul.pages").attr("innerHTML",Tie.buildPages(A.hotVotePostCount,A.page))};function SinglePage(_,B){var A=this;A._mainReplies=$("#mainReplies");A._singleTie=$("#wonderfulReply > .replies")[0];Page.call(A,_,B,"re")}SinglePage.prototype=new Page;SinglePage.prototype.initView=function(_){var $=this,A=$._mainReplies.$("> .replies")[0];$._singleTie.innerHTML=_.postData?Tie.buildFloors([_.postData]):"";if(_.newVoteList&&_.newVoteList.length)A.innerHTML=Tie.buildFloors(_.newVoteList);else mainReplies.style.display="none"};window.Page=Page;window.DefaultPage=DefaultPage;window.AttitudePage=AttitudePage;window.SinglePage=SinglePage;var regLink=$("form a.register");for(var i=0;i<regLink.length;i++)regLink[i].href+=document.location.href;$("textarea[name=body]").attr("value",Config.replyTips.theDefault).addEvent("focus",function(){this.style.color="#000";if(this.value===Config.replyTips.theDefault)this.value=""}).addEvent("blur",function(){if(this.value===""||this.value==Config.replyTips.theDefault){this.style.color="";this.value=Config.replyTips.theDefault}});Visitor.init();if(Visitor.hasLogin){$("div.nicknameLogin, form.login").addCss("display:none;");$("div.logon").addCss("display:block;");$("strong.userName").attr("innerHTML",Visitor.nickname)}else{$("form.login").addEvent("submit",function(_){var A=$("input[name=username]",this)[0],C=$("input[name=password]",this)[0],B;if(""===A.value.trim()){alert(Config.loginTips.userNameEmpty);A.focus();B=true}else if(""===C.value.trim()){alert(Config.loginTips.passwordEmpty);C.focus();B=true}else $.cookie.set(Config.cookie.toReply,1);return!B});var toNicknameMode=function(_,B){_.preventDefault();$("#"+B+"Login").addCss("display:none");var A=$("#"+B+"Nickname");A.addCss("display:block");A.$("input[name=nickname]")[0].focus()},toLoginMode=function(_,A){_.preventDefault();$("#"+A+"Nickname").addCss("display:none");var B=$("#"+A+"Login");B.addCss("display:block");B.$("input[name=username]")[0].focus()};$("#replyLogin a.toNicknameMode").addEvent("click",toNicknameMode,"reply");$("#replyNickname a.toLoginMode").addEvent("click",toLoginMode,"reply");$("#quoteLogin a.toNicknameMode").addEvent("click",toNicknameMode,"quote");$("#quoteNickname a.toLoginMode").addEvent("click",toLoginMode,"quote");$("input[name=nickname], input[name=gameUser]").attr("value",Visitor.nickname);$("input[name=username]").attr("value",Visitor.account)}var quoteReply=$("#quoteReply"),addToFav=$("#addToFav"),myNickname=$("#myNickname"),quoteWin,favWin,nicknameWin;if(quoteReply)quoteWin=new $.ui.Win(quoteReply);if(addToFav){favWin=new $.ui.Win(addToFav);addToFav.$("input.toConfirm").addEvent("click",favWin.hide.bind(favWin))}if(myNickname){nicknameWin=new $.ui.Win(myNickname);$("#modifyNickname")&&$("#modifyNickname").addEvent("click",function(_){_.preventDefault();$("#nicknameTips").removeCss("error").innerHTML=Config.nicknameTips.theDefault;nicknameWin.show(_.pageX,_.pageY);$("#newNickname").focus()});myNickname.$("form").addEvent("submit",function(_){_.preventDefault();var B=$("#newNickname"),C=B.value.trim(),A=$("#nicknameTips");A.innerHTML=Config.nicknameTips.senting;Visitor.modifyNickname(C,function(_){alert(_);nicknameWin.hide();$("strong.userName").attr("innerHTML",C)},function($){A.addCss("error");A.innerHTML=$})})}$.ui.Template.load()})()