﻿var new_bestAnswerHasSelectOne=false;var currentButton=null;var zzqqDialog=null;var zzQzoneDialog=null;var checkboxList=new Array();var Link;function vote(vote_url){Zhishi.Ajax.sendRequest("GET",vote_url+"&r="+Math.random(),{onSuccess:function(data){var rsp=eval(data);if(rsp[0]==1){alert("\u64cd\u4f5c\u6210\u529f。");window.location.href=rsp[1]}else{alert(rsp[1])}}})}function addFavourite(a){Zhishi.Ajax.sendRequest("GET",a+"&r="+Math.random(),{onSuccess:function(b){alert(b);window.location.reload()}})}function addEditorRecommend(a){Zhishi.Ajax.sendRequest("GET",a+"&r="+Math.random(),{onSuccess:function(b){alert(b);window.location.reload()}})}function addEditorPendingRecommend(a){Zhishi.Ajax.sendRequest("GET",a+"&r="+Math.random(),{onSuccess:function(b){alert(b);window.location.reload()}})}function zzQQ(a){zzqqDialog=new Zhishi.Dialog("\u8f6c\u8f7d\u5230QQ\u8d44\u6599\u5361",340,390,true,a);zzqqDialog.show()}function zzQzone(a){zzQzoneDialog=new Zhishi.Dialog("\u8f6c\u8f7d\u5230QQ\u7a7a\u95f4",620,436,true,a);zzQzoneDialog.show()}var setMyDescription_url="";function updatePersonalDesc(userDesc){var desc=userDesc.value;if(desc.length>100){alert("\u4e2a\u4eba\u8bf4\u660e\u4e0d\u80fd\u8d85\u8fc7100\u5b57。");userDesc.select();return}Zhishi.Ajax.sendRequest("GET",setMyDescription_url+encodeURIComponent(desc),{onSuccess:function(data){var x=eval(data);if(x){alert(x[1])}}})}function ctrlSetDesc(a,b){if(b.ctrlKey&&(b.keyCode==13)){updatePersonalDesc(a)}}function impeach_fun(fm){if(fm.desc.value.length>100){alert("\u68c0\u4e3e\u8bf4\u660e\u4e0d\u80fd\u8d85\u8fc7100\u5b57。");fm.desc.select();return}var sURL="/vote?";var voteValue="";var vVote=fm.vote;for(var i=0;i<fm.vote.length;i++){if(fm.vote[i].checked){voteValue=fm.vote[i].value}}if(voteValue==""){alert("\u8bf7\u9009\u62e9\u68c0\u4e3e\u7c7b\u578b。");return}sURL+=("vote="+voteValue);sURL+=("&qid="+fm.qid.value);sURL+=("&aid="+fm.aid.value);sURL+=("&uid="+fm.uid.value);sURL+=("&sid="+fm.sid.value);sURL+=("&url="+encodeURIComponent(fm.url.value));sURL+=("&desc="+encodeURIComponent(fm.desc.value));Zhishi.Ajax.sendRequest("GET",sURL,{onSuccess:function(data){var rsp=eval(data);if(rsp[0]==1){alert("\u68c0\u4e3e\u6210\u529f，\u6211\u4eec\u4f1a\u5c3d\u5feb\u5904\u7406，\u611f\u8c22\u60a8\u7684\u5173\u6ce8！")}else{alert(rsp[1])}}});window.close()}Zhishi.Validator.AnswerQuestion={clickSubmitButton:false,answerContentRequired:function(){if(Editor.getPlainTextValue().trim()==""&&!Editor.hasImage()){return false}else{return true}},verCodeRequired:function(){if(verCode.form.name=="answerQuestion"){if(verCode.value==""||verCode.value==verCodeTipText){return false}else{return true}}else{if(document.answerSupplementForm.contentSupplement.checked){if(verCode.value==""||verCode.value==verCodeTipText){return false}else{return true}}return true}},supplementContentRequired:function(){if(document.answerSupplementForm&&document.answerSupplementForm.contentSupplement){if(document.answerSupplementForm.contentSupplement.checked){if(Editor.getPlainTextValue().trim()==""&&!Editor.hasImage()){return false}else{document.answerSupplementForm.answerSupplementContent.value=Editor.getValue();document.answerSupplementForm.editorStats.value=Editor.Util.getCountInfo();document.answerSupplementForm.useTime1.value=Editor.Util.getEditorTime()}}}return true},beforeSubmit:function(a){if(a&&a.form&&a.form.name!="answerQuestion"){return true}if(a&&a.id=="myAnswerContent"&&get("verCode")!=null){return true}Zhishi.Ajax.sendRequest("GET",Zhishi.loginStateUrl,{onSuccess:function(c){if(c=="1"){Zhishi.Validator.AnswerQuestion.clickSubmitButton=true;document.answerQuestion.editorStats.value=Editor.Util.getCountInfo();document.answerQuestion.useTime.value=Editor.Util.getEditorTime();document.answerQuestion.myAnswerContent.value=Editor.getValue();document.answerQuestion.submit()}else{if(c=="0"){if(document.answerQuestion.showVerifyCode){document.answerQuestion.showVerifyCode.value="F"}var d=get("answerSubmit");var b=Zhishi.Login.loginList.length;d.setAttribute("wenwenid",b);d.addClassName("login_norefresh");Zhishi.Login.loginList[b]=function(){Zhishi.Validator.AnswerQuestion.clickSubmitButton=true;document.answerQuestion.editorStats.value=Editor.Util.getCountInfo();document.answerQuestion.useTime.value=Editor.Util.getEditorTime();document.answerQuestion.myAnswerContent.value=Editor.getValue();document.answerQuestion.submit()};Zhishi.Login.openLoginDialog(d);return true}}}})}};Zhishi.Validator.AnswerPKQuestion={answerContentRequired:function(){if(Editor.getPlainTextValue().trim()==""&&!Editor.hasImage()){return false}else{return true}},reasonRadioRequiredValidate:function(){var b=document.getElementsByName("reasonOption");if(b&&b.length){for(var a=0;a<b.length;a++){if(b[a].checked){return true}}}get("reasonInput_err_msg").innerHTML="\u8bf7\u60a8\u9009\u62e9\u5b8c\u5584\u7684\u7406\u7531!";get("reasonInput_err_msg").style.display="block";return false},reasonInputRequiredValidate:function(){if($("pk_other").checked){var a=$("reasonInput").value;if(!a){return false}a=a.trim();if(!a||a.length<1){return false}}return true},reasonInputLengthValidate:function(){if($("pk_other").checked){var a=$("reasonInput").value;if(!a){return false}a=a.trim();if(!a||a.length<1||a.length>20){return false}}return true},beforeSubmit:function(a){if(a&&a.form&&a.form.name!="answerPKQuestion"){return true}Zhishi.Ajax.sendRequest("GET",Zhishi.loginStateUrl,{onSuccess:function(c){if(c=="1"){document.answerPKQuestion.myAnswerPKContent.value=Editor.getValue();window.onbeforeunload=function(){};document.answerPKQuestion.submit()}else{if(c=="0"){var d=get("answerPKSubmit");var b=Zhishi.Login.loginList.length;d.setAttribute("wenwenid",b);d.addClassName("login_norefresh");Zhishi.Login.loginList[b]=function(){document.answerPKQuestion.myAnswerPKContent.value=Editor.getValue();document.answerPKQuestion.submit()};Zhishi.Login.openLoginDialog(d);return true}}}})}};function focusVerCode(){if(verCode.value==verCodeTipText){verCode.maxLength=4;verCode.value="";verCode.style.color="#000"}}function blurVerCode(){if(verCode.value.trim()==""){verCode.maxLength=6;verCode.value=verCodeTipText;verCode.style.color="#ACA899"}}function supplementStart(){if(supplementTime==0){supplementTime=new Date()}}function supplementEnd(){var a=new Date(),d=0;if(supplementTime!=0){d=a.getTime()-supplementTime.getTime()}d=d<0?0:parseInt(d/1000);document.answerSupplementForm.useTime1.value=d;return true}function answerStart(){if(answerTime==0){answerTime=new Date()}if(!text){return}if(text.value==tipText){text.value=""}text.style.color="#000000"}function answerEnd(){if(answerTime!=0){var a=new Date();var d=a.getTime()-answerTime.getTime();d=d<0?0:parseInt(d/1000);document.answerQuestion.useTime.value=d}}function blurMethod(){if(text&&text.value==""){text.value=tipText;text.style.color="#ACA899"}}function onAnswerSubmit(a,b){if(b.ctrlKey&&b.keyCode==13){document.getElementById(a).click();return false}return true}function initAnswerQuestion(){var b=document.getElementById("answerQuestionDiv");if(!b){return}var a=document.answerQuestion;if(!a){return}if(a.verifyCode&&verCode){verCode=a.verifyCode;blurVerCode();Zhishi.Event.attachEventListener(verCode,"focus",focusVerCode,false);Zhishi.Event.attachEventListener(verCode,"blur",blurVerCode,false)}Editor.init("myAnswerContent",{width:685,height:165,hasStateBar:true,onCtrlEnter:function(){document.getElementById("answerSubmit").click()},toolBar:"answerToolBar"});if(Zhishi.Browser.isIE6&&Editor.getSelf()&&$("answer_text_tips")){$("answer_text_tips").className="text_tips_for_ie6"}if($("meAnswer")){Zhishi.Event.attachEventListener($("meAnswer"),"click",function(){Editor.focus(true)},false)}var c=function(){var f=document.lemmaCreateForm;if(Editor.getSelf()!=null){var d=Editor.getPlainTextValue().trim();var e=Editor.hasImage();if((d!=""||e)&&Editor.id=="myAnswerContent"&&!Zhishi.Validator.AnswerQuestion.clickSubmitButton){return"【\u63d0\u793a】\u672a\u4fdd\u5b58\u7684\u5185\u5bb9\u5c06\u4f1a\u4e22\u5931"}}};if(document.answerQuestion&&document.answerQuestion.myAnswerContent){Editor.setValue(document.answerQuestion.myAnswerContent.value)}window.onbeforeunload=c}function answerSupplement(){var a=document.getElementById("divAnswerSupplement");a.style.display="block";document.answerSupplementForm.answerSupplementContent.focus()}function initMySupplementContent(){if(!document.answerSupplementForm){return}if(document.answerSupplementForm.answerSupplementContent&&document.answerSupplementForm.answerSupplementContent.value!=""){var b=document.answerSupplementForm.teamId;var a=document.answerSupplementForm.contentSupplement;var c=document.answerSupplementForm.origTableNameS;if((b.value==null||b.value=="")||c.value!="X"){if(a){a.checked=true}}}showMySupplementContent()}function showMySupplementContent(){var b=null;var a=document.getElementById("answerQuestionDiv");if(document.answerSupplementForm){b=document.answerSupplementForm.supplementSubmit;if(document.answerSupplementForm.verifyCode1&&verCode){verCode=document.answerSupplementForm.verifyCode1;blurVerCode();Zhishi.Event.attachEventListener(verCode,"focus",focusVerCode,false);Zhishi.Event.attachEventListener(verCode,"blur",blurVerCode,false)}}if(document.answerSupplementForm&&document.answerSupplementForm.contentSupplement){if(document.answerSupplementForm.contentSupplement.checked){document.getElementById("showSC").style.display="block";if(b!=null){b.disabled=false}var c=Editor.getSelf();if(c!=null){if(c.id=="myAnswerContent"&&document.answerQuestion&&document.answerQuestion.myAnswerContent){document.answerQuestion.myAnswerContent.value=Editor.getValue()}c.parentNode.removeChild(c)}if(a){a.style.display="none"}Editor.init("answerSupplementContent",{width:658,height:165,hasStateBar:true,onCtrlEnter:function(){document.getElementById("supplementSubmit").click()},toolBar:"answerToolBar"});if(Zhishi.Browser.isIE6&&Editor.getSelf()&&$("supplementAnswer_text_tips")){$("supplementAnswer_text_tips").className="text_tips_for_ie6"}if(document.answerSupplementForm.answerSupplementContent){Editor.setValue(document.answerSupplementForm.answerSupplementContent.value)}setTimeout(Editor.focus,10)}else{document.getElementById("showSC").style.display="none";var c=Editor.getSelf();if(c!=null){if(c.id=="answerSupplementContent"){document.answerSupplementForm.answerSupplementContent.value=Editor.getValue()}c.parentNode.removeChild(c)}setTimeout(function(){window.focus()},10);if(a){a.style.display="block";initAnswerQuestion()}}}checkIsDisabled()}function initAnswerPKQuestion(){Editor.init("myAnswerPKContent",{width:685,height:165,hasStateBar:true,onCtrlEnter:function(){document.getElementById("answerPKSubmit").click()}});if(Zhishi.Browser.isIE6&&Editor.getSelf()&&$("answerpk_text_tips")){$("answerpk_text_tips").className="text_tips_for_ie6"}var a=function(){if(Editor.getSelf()!=null){var b=Editor.getPlainTextValue().trim();var c=Editor.hasImage();if((b!=""||c)&&Editor.id=="myAnswerPKContent"){return"【\u63d0\u793a】\u672a\u4fdd\u5b58\u7684\u5185\u5bb9\u5c06\u4f1a\u4e22\u5931"}}};window.onbeforeunload=a;Editor.focus()}function checkIsDisabled(){var a=null;if(document.answerSupplementForm){a=document.answerSupplementForm.supplementSubmit}if(a==null){return}if(document.answerSupplementForm.contentSupplement!=null){if(document.answerSupplementForm.contentSupplement.checked){a.disabled=false;return}}if(document.answerSupplementForm.anonymousSupplement!=null){if(document.answerSupplementForm.anonymousSupplement.checked){a.disabled=false;return}else{a.disabled=true;return}}else{a.disabled=true;return}}function initSupplementQuestion(){var b=document.getElementsByTagName("input");for(var a=0;a<b.length;a++){if(b[a].type=="checkbox"&&b[a].id.indexOf("checkAnswerPanel")==0){checkboxList.push(b[a])}}if(document.supplementQuestion&&document.supplementQuestion.mySupplementContent!=null&&document.supplementQuestion.mySupplementContent.value!=""){if(document.supplementQuestion.contentSupplement){document.supplementQuestion.contentSupplement.checked=true}}showSupplementQuestionContent();toggleCheckBoxExceptThis()}Zhishi.Validator.SupplementQuestion={supplementContentRequired:function(){var a=document.supplementQuestion;if(a.contentSupplement&&a.contentSupplement.checked){if(Editor.id=="mySupplementContent"&&(Editor.getPlainTextValue().trim()==""&&!Editor.hasImage())){a.mySupplementContent.value="";return false}}return true},setSupplementQuestion:function(){if(Editor.id=="mySupplementContent"){document.supplementQuestion.mySupplementContent.value=Editor.getValue();document.supplementQuestion.editorStats.value=Editor.Util.getCountInfo()}return true}};function toggleCheckBoxExceptThis(c){for(var a=0;a<checkboxList.length;a++){if(c&&checkboxList[a].id.indexOf(c)>0){continue}if(checkboxList[a].checked){var b=checkboxList[a].id.substr(16);checkboxList[a].checked=false;hideFollowPanel(b)}}}function showSupplementQuestionContent(){if(document.supplementQuestion==null){return}var a=document.supplementQuestion.supplementSubmit;if(document.supplementQuestion&&document.supplementQuestion.contentSupplement){toggleCheckBoxExceptThis();if(document.supplementQuestion.contentSupplement.checked){document.getElementById("showSC").style.display="block";if(a!=null){a.disabled=false}var b=Editor.getSelf();if(b!=null){b.parentNode.removeChild(b)}Editor.init("mySupplementContent",{width:658,height:165,hasStateBar:true,onCtrlEnter:function(){document.getElementById("supplementSubmit").click()}});if(Zhishi.Browser.isIE6&&Editor.getSelf()&&$("supplementQuestion_text_tips")){$("supplementQuestion_text_tips").className="text_tips_for_ie6"}setTimeout(Editor.focus,10)}else{document.getElementById("showSC").style.display="none";var b=Editor.getSelf();if(b!=null){document.supplementQuestion.mySupplementContent.value=Editor.getValue();b.parentNode.removeChild(b)}setTimeout(function(){window.focus()},10)}}checkIsSupplementQuestionDisabled()}function checkIsSupplementQuestionDisabled(){var a=document.supplementQuestion.supplementSubmit;if(a==null){return}if(document.supplementQuestion.contentSupplement!=null){if(document.supplementQuestion.contentSupplement.checked){a.disabled=false;return}}if(document.supplementQuestion.offerSupplement!=null){if(document.supplementQuestion.offerSupplement.checked){a.disabled=false;return}}if(document.supplementQuestion.broadcastSupplement!=null){if(document.supplementQuestion.broadcastSupplement.checked){a.disabled=false;return}}if(document.supplementQuestion.anonymousSupplement!=null){if(document.supplementQuestion.anonymousSupplement.checked){a.disabled=false;return}else{a.disabled=true;return}}else{a.disabled=true;return}}function getDisabled(){return document.supplementQuestion.supplementSubmit.disabled}function setCookie(b,c,a){var d=new Date();d.setDate(d.getDate()+a);document.cookie=b+"="+escape(c)+((a==null)?"":";expires="+d.toGMTString())}function getCookie(a){if(document.cookie.length>0){c_start=document.cookie.indexOf(a+"=");if(c_start!=-1){c_start=c_start+a.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1){c_end=document.cookie.length}return unescape(document.cookie.substring(c_start,c_end))}}return""}var getShowNum=function(a){try{return new Number(document.getElementById(a).innerHTML)}catch(b){return 0}};var getExpectedNum=function(a){try{return new Number(getCookie(a))}catch(b){return 0}};var setExpectedNum=function(a,b){setCookie(a,b)};var _show="";var goodOrBad=0;var showResult=function(rstMsg){if(_show){var area=get(_show);area.setStyle("opacity",100);var rsp=null;try{rsp=eval(rstMsg)}catch(e){rsp=eval(this.errMsg)}if(rsp!=null){var code=rsp[0];var msg=rsp[1];area.innerHTML=msg;area.style.display="block";if(code==0){try{var cid=area.id+goodOrBad;var num=parseInt(getExpectedNum(cid),10);setExpectedNum(cid,(num+addNumber));expectNum(cid)}catch(e){}}else{if(code==2){window.location.href=loginUrl}}}window.setTimeout(function(){var e=new Zhishi.Effect(area,"opacity","100","0",1);e.start()},1000)}};var evaluateAnswer=function(c,d,a){if(a){var b=a+d;setExpectedNum(b,Math.max(getShowNum(b),getExpectedNum(b)));goodOrBad=d;_show=a;if(c){new WenwenAjaxEvent(c,showResult).notify()}}};var expectNum=function(a){try{document.getElementById(a).innerHTML=Math.max(getShowNum(a),getExpectedNum(a))}catch(b){}};function followAskEnd(b){if(null==b){return}var c=b.id.substring(3);ansAuthorId=c.split("_")[0];if(Editor.getPlainTextValue().trim()==""&&!Editor.hasImage()){var d=get("errors"+ansAuthorId);if(null!=d){d.overwriteClassName("field_err");d.innerHTML="\u60a8\u8fd8\u6ca1\u6709\u8f93\u5165\u4efb\u4f55\u5185\u5bb9！";d.style.display="block"}Editor.focus()}else{var e=Editor.Util.getEditorTime();var f=c.split("_")[1];var j=Editor.getValue();j=nomalizeText(j);j=j.replace(/[^\u0000-\u00FF]/g,function(k){return escape(k).replace(/(%u)(\w{4})/gi,"\\u$2")});var h=Editor.Util.getCountInfo();var a=["{",'userId:"',uin,'",userName:','""',",toUserId:",'"',ansAuthorId,'"',",questionId:",questionId,",seconds:",e,",replyId:",f,',origTableName:"',faOrigTableName,'",editorStats:"',h,'",origTmpId:',faOrigTmpId,',content:"',j,'"}'].join("");var g="api/answer/follow?format=json";var i={onSuccess:postCallBack,para:b,contentType:"application/json; charset=UTF-8",postdata:a,raw:true};Zhishi.Ajax.sendRequest("POST",g,i)}return false}function displayResult(){resetFollowErrorTip("errors"+ansAuthorId);var a=$("answerFrame"+ansAuthorId);var b=$("checkAnswerPanel"+ansAuthorId);var c=$("text"+ansAuthorId);c.value="";a.style.display="none";b.checked=false}function postCallBack(jsonData,o){var json=eval("("+jsonData+")");if(json.success){document.location="FollowComplete.e?sp="+questionId}else{var tempIds=o.id.substring(3);ansAuthorId=tempIds.split("_")[0];var errorO=$("errors"+ansAuthorId);errorO.innerHTML=json.message;errorO.overwriteClassName("field_err");errorO.style.display="block";Editor.focus()}}function toggleAnswerPanel(f){toggleCheckBoxExceptThis(f);if($("contentSupplement")&&$("contentSupplement").checked){$("contentSupplement").checked=false;document.getElementById("showSC").style.display="none";var c=Editor.getSelf();if(c!=null){document.supplementQuestion.mySupplementContent.value=Editor.getValue();c.parentNode.removeChild(c)}setTimeout(function(){window.focus()},10)}var d=$("checkAnswerPanel"+f);var e="text"+f;var b=$("answerFrame"+f);if(d.checked){b.style.display="block";var a=$(e);if(a!=null){var c=Editor.getSelf();if(c!=null){c.parentNode.removeChild(c)}Editor.init(e,{width:658,height:165,hasStateBar:true});if(Zhishi.Browser.isIE6&&Editor.getSelf()&&$("follow_text_tips"+f)){$("follow_text_tips"+f).className="text_tips_for_ie6"}setTimeout(Editor.focus,10)}setTimeout(function(){resetFollowErrorTip("errors"+f)},0)}else{hideFollowPanel(f)}}function hideFollowPanel(b){resetFollowErrorTip("errors"+b);$("answerFrame"+b).style.display="none";var a=Editor.getSelf();if(a!=null){$("text"+b).value=Editor.getValue();a.parentNode.removeChild(a);$("checkAnswerPanel"+b).checked=false}setTimeout(function(){window.focus()},10)}function resetFollowErrorTip(b){var a=get(b);if(null!=a){a.overwriteClassName("pump_tips");a.innerHTML='\u5bf9\u540c\u4e00\u56de\u7b54\u8005\u7684\u8ffd\u95ee\u8d85\u8fc73\u6b21\u540e\u6bcf\u6b21\u5c06\u6d88\u801710\u79ef\u5206  <a href="http://cache.soso.com/wenwen/help/help_ask_03.htm" target="_blank">\u4e86\u89e3\u8be6\u60c5</a>';a.style.display="block"}}function nomalizeText(a){a=a.replace(/\\/g,"\\\\");a=a.replace(/\"/g,'\\"');a=a.replace(/\r/g,"\\r");a=a.replace(/\n/g,"\\n");return a}var rateTips=["(\u6162)","(\u8f83\u6162)","(\u4e00\u822c)","(\u8f83\u5feb)","(\u5f88\u5feb)"];var attiTips=["(\u6577\u884d)","(\u8f83\u6577\u884d)","(\u4e00\u822c)","(\u8f83\u8ba4\u771f)","(\u5f88\u8ba4\u771f)"];Zhishi.SelectBestAnswer={bestAnswerHasSelectOne:false,answerId:0,answerNum:0,width:401,height:362,giftHeight:168,bestAnswerDialog:null,solvedType:0,originalType:0,rateIndex:0,attiIndex:0,rateDivs:null,attiDivs:null,rateTip:null,attiTip:null,init:function(a){Zhishi.SelectBestAnswer.bestAnswerHasSelectOne=false;Zhishi.SelectBestAnswer.answerNum=a;Zhishi.SelectBestAnswer.answerId=0;Zhishi.SelectBestAnswer.width=401;Zhishi.SelectBestAnswer.height=362;Zhishi.SelectBestAnswer.giftHeight=168;Zhishi.SelectBestAnswer.bestAnswerDialog=null;Zhishi.SelectBestAnswer.rateIndex="0";Zhishi.SelectBestAnswer.attiIndex="0";document.bestAnswerForm.bestAnswerId1.value="0";document.bestAnswerForm.bestAnswerStarLevel1.value="0";document.bestAnswerForm.bestAnswerMsg1.value="S";document.bestAnswerForm.bestAnswerGift1.value="0";document.bestAnswerForm.originalType1.value="0";document.bestAnswerForm.solvedType1.value="0";document.bestAnswerForm.authorRate1.value="0";document.bestAnswerForm.authorAttitude1.value="0";document.bestAnswerForm.bestAnswerId2.value="0";document.bestAnswerForm.bestAnswerStarLevel2.value="0";document.bestAnswerForm.bestAnswerMsg2.value="S";document.bestAnswerForm.bestAnswerGift2.value="0";document.bestAnswerForm.originalType2.value="0";document.bestAnswerForm.solvedType2.value="0";document.bestAnswerForm.authorRate2.value="0";document.bestAnswerForm.authorAttitude2.value="0"},updateSolvedType:function(a){Zhishi.SelectBestAnswer.solvedType=a},updateOriginalType:function(a){Zhishi.SelectBestAnswer.originalType=a},initRateEvent:function(){Zhishi.SelectBestAnswer.rateIndex="0";var d=document.chooseStarForm;var c=d.getElementsByTagName("DIV");var b=d.getElementsByTagName("SPAN");if(c){Zhishi.SelectBestAnswer.rateDivs=new Array();for(var a=0;a<c.length;a++){if(c[a]&&c[a].className.indexOf(" ratestar")>0){Zhishi.SelectBestAnswer.rateDivs.push(c[a])}}}if(b){for(var a=0;a<b.length;a++){if(b[a]&&b[a].className.indexOf(" ratestar")>0){Zhishi.SelectBestAnswer.rateTip=b[a];break}}}if(Zhishi.SelectBestAnswer.rateDivs){for(var a=0;a<Zhishi.SelectBestAnswer.rateDivs.length;a++){if(Zhishi.SelectBestAnswer.rateDivs[a]){Zhishi.Event.attachEventListener(Zhishi.SelectBestAnswer.rateDivs[a],"click",Zhishi.SelectBestAnswer.clickRate.bind(null,get(Zhishi.SelectBestAnswer.rateDivs[a]).id),false)}Zhishi.Event.attachEventListener(Zhishi.SelectBestAnswer.rateDivs[a],"mouseover",Zhishi.SelectBestAnswer.mouseoverRate.bind(null,get(Zhishi.SelectBestAnswer.rateDivs[a]).id),false);Zhishi.Event.attachEventListener(Zhishi.SelectBestAnswer.rateDivs[a],"mouseout",Zhishi.SelectBestAnswer.mouseoutRate.bind(null,get(Zhishi.SelectBestAnswer.rateDivs[a]).id),false)}Zhishi.SelectBestAnswer.defaultRate()}},initAttiEvent:function(){Zhishi.SelectBestAnswer.attiIndex="0";var d=document.chooseStarForm;var c=d.getElementsByTagName("DIV");var b=d.getElementsByTagName("SPAN");if(c){Zhishi.SelectBestAnswer.attiDivs=new Array();for(var a=0;a<c.length;a++){if(c[a]){if(c[a]&&c[a].className.indexOf(" attistar")>0){Zhishi.SelectBestAnswer.attiDivs.push(c[a])}}}}if(b){for(var a=0;a<b.length;a++){if(b[a]&&b[a].className.indexOf(" attistar")>0){Zhishi.SelectBestAnswer.attiTip=b[a];break}}}if(Zhishi.SelectBestAnswer.attiDivs){for(var a=0;a<Zhishi.SelectBestAnswer.attiDivs.length;a++){Zhishi.Event.attachEventListener(Zhishi.SelectBestAnswer.attiDivs[a],"click",Zhishi.SelectBestAnswer.clickAtti.bind(null,get(Zhishi.SelectBestAnswer.attiDivs[a]).id),false);Zhishi.Event.attachEventListener(Zhishi.SelectBestAnswer.attiDivs[a],"mouseover",Zhishi.SelectBestAnswer.mouseoverAtti.bind(null,get(Zhishi.SelectBestAnswer.attiDivs[a]).id),false);Zhishi.Event.attachEventListener(Zhishi.SelectBestAnswer.attiDivs[a],"mouseout",Zhishi.SelectBestAnswer.mouseoutAtti.bind(null,get(Zhishi.SelectBestAnswer.attiDivs[a]).id),false)}}Zhishi.SelectBestAnswer.defaultAtti()},clickRate:function(a){if(a){Zhishi.SelectBestAnswer.rateIndex=a;Zhishi.SelectBestAnswer.setRate(a)}},mouseoverRate:function(a){if(a){Zhishi.SelectBestAnswer.setRate(a)}},mouseoutRate:function(a){if(a){Zhishi.SelectBestAnswer.setRate(Zhishi.SelectBestAnswer.rateIndex)}},clickAtti:function(a){if(a){Zhishi.SelectBestAnswer.attiIndex=a;Zhishi.SelectBestAnswer.setAtti(a)}},mouseoverAtti:function(a){if(a){Zhishi.SelectBestAnswer.setAtti(a)}},mouseoutAtti:function(a){if(a){Zhishi.SelectBestAnswer.setAtti(Zhishi.SelectBestAnswer.attiIndex)}},setRate:function(b){Zhishi.SelectBestAnswer.defaultRate();if(b>=1&&b<=5){for(var a=0;a<b;a++){Zhishi.SelectBestAnswer.rateDivs[a].className="ico_star";if(Zhishi.SelectBestAnswer.rateTip){Zhishi.SelectBestAnswer.rateTip.style.display="block";Zhishi.SelectBestAnswer.rateTip.innerHTML=rateTips[a]}}}},setAtti:function(b){Zhishi.SelectBestAnswer.defaultAtti();if(b>=1&&b<=5){for(var a=0;a<b;a++){Zhishi.SelectBestAnswer.attiDivs[a].className="ico_star";if(Zhishi.SelectBestAnswer.attiTip){Zhishi.SelectBestAnswer.attiTip.style.display="block";Zhishi.SelectBestAnswer.attiTip.innerHTML=attiTips[a]}}}},defaultRate:function(){if(Zhishi.SelectBestAnswer.rateDivs){for(var a=0;a<=4;a++){Zhishi.SelectBestAnswer.rateDivs[a].className="ico_gray_star"}}if(Zhishi.SelectBestAnswer.rateTip){Zhishi.SelectBestAnswer.rateTip.style.display="none"}},defaultAtti:function(){if(Zhishi.SelectBestAnswer.attiDivs){for(var a=0;a<=4;a++){Zhishi.SelectBestAnswer.attiDivs[a].className="ico_gray_star"}}if(Zhishi.SelectBestAnswer.attiTip){Zhishi.SelectBestAnswer.attiTip.style.display="none"}},getGiftItems:function(){var e=document.chooseStarForm;var c=e.getElementsByTagName("li");var b=new Array();if(c){for(var d=0;d<c.length;d++){var a=c[d];if(a.className&&(" "+a.className+" ").indexOf(" gift_item ")>=0){b.push(a)}}}return b},initChooseGiftEvent:function(){var b=Zhishi.SelectBestAnswer.getGiftItems();if(!b){return false}for(var c=0;c<b.length;c++){var a=b[c];Zhishi.SelectBestAnswer.clickGiftEvent=Zhishi.SelectBestAnswer.clickGift.bind(a);Zhishi.Event.attachEventListener(a,"click",Zhishi.SelectBestAnswer.clickGiftEvent,false);if(Zhishi.Browser.isIE6){Zhishi.SelectBestAnswer.mouseOverGiftEvent=Zhishi.SelectBestAnswer.mouseOverGift.bind(a);Zhishi.SelectBestAnswer.mouseOutGiftEvent=Zhishi.SelectBestAnswer.mouseOutGift.bind(a);Zhishi.Event.attachEventListener(a,"mouseover",Zhishi.SelectBestAnswer.mouseOverGiftEvent,false);Zhishi.Event.attachEventListener(a,"mouseout",Zhishi.SelectBestAnswer.mouseOutGiftEvent,false)}}return true},isSelectGift:function(a){if(a.className&&(" "+a.className+" ").indexOf(" selected ")>=0){return true}else{return false}},selectGift:function(c,a){if(a){get(c).addClassName("selected");var b=c.getElementsByTagName("div");if(b&&b.length>0){get(b[0]).addClassName("select")}}else{get(c).removeClassName("selected");var b=c.getElementsByTagName("div");if(b&&b.length>0){get(b[0]).removeClassName("select")}}},clickGift:function(){var b=Zhishi.SelectBestAnswer.getGiftItems();if(!b){return false}for(var c=0;c<b.length;c++){var a=b[c];if(a==this){if(Zhishi.SelectBestAnswer.isSelectGift(a)){Zhishi.SelectBestAnswer.selectGift(a,false)}else{Zhishi.SelectBestAnswer.selectGift(a,true)}}else{Zhishi.SelectBestAnswer.selectGift(a,false)}}return false},mouseOverGift:function(){get(this).addClassName("gift_hover")},mouseOutGift:function(){get(this).removeClassName("gift_hover")},clickGiftEvent:function(){},mouseOverGiftEvent:function(){},mouseOutGiftEvent:function(){},getGiftDiv:function(e){var c=document.chooseStarForm;var b=c.getElementsByTagName("div");if(b){for(var a=0;a<b.length;a++){var d=b[a];if(d.id==e){return d}}}},expandGifts:function(){var d=Zhishi.SelectBestAnswer.getGiftDiv("collapseGift");var b=Zhishi.SelectBestAnswer.getGiftDiv("expandGift");if(!d||!b){return false}get(d).hide();get(b).show();var c=Zhishi.SelectBestAnswer.width;var a=Zhishi.SelectBestAnswer.height+Zhishi.SelectBestAnswer.giftHeight;Zhishi.SelectBestAnswer.bestAnswerDialog.resize(c,a);return false},collapseGifts:function(){var d=Zhishi.SelectBestAnswer.getGiftDiv("collapseGift");var b=Zhishi.SelectBestAnswer.getGiftDiv("expandGift");if(!b||!d){return false}get(b).hide();get(d).show();var c=Zhishi.SelectBestAnswer.width;var a=Zhishi.SelectBestAnswer.height;Zhishi.SelectBestAnswer.bestAnswerDialog.resize(c,a);return false},click:function(e){if(!e||e<=0){return}if(Zhishi.SelectBestAnswer.answerNum<=0){return}Zhishi.SelectBestAnswer.answerId=e;var b=document.getElementById("choose_button");if(!b){return}if(!Zhishi.SelectBestAnswer.bestAnswerHasSelectOne&&Zhishi.SelectBestAnswer.answerNum>1){b.innerHTML=document.getElementById("choose_one").innerHTML;Zhishi.SelectBestAnswer.height=385}else{b.innerHTML=document.getElementById("choose_two").innerHTML;Zhishi.SelectBestAnswer.height=368}var c=Zhishi.SelectBestAnswer.width;var a=Zhishi.SelectBestAnswer.height;var d='<form name="chooseStarForm" onsubmit="return false;">';d+=document.getElementById("selectBestAnswerTemplate").innerHTML;d+="</form>";Zhishi.SelectBestAnswer.bestAnswerDialog=new Zhishi.Dialog("\u91c7\u7eb3\u6ee1\u610f\u7b54\u6848",c,a,false,d);Zhishi.SelectBestAnswer.bestAnswerDialog.afterClose=function(){var g=document.chooseStarForm;g.parentNode.removeChild(g)};Zhishi.SelectBestAnswer.bestAnswerDialog.show();Zhishi.SelectBestAnswer.initChooseGiftEvent();Zhishi.SelectBestAnswer.initRateEvent();Zhishi.SelectBestAnswer.initAttiEvent()},getGiftId:function(){var b=Zhishi.SelectBestAnswer.getGiftItems();if(!b){return 0}for(var c=0;c<b.length;c++){var a=b[c];if(Zhishi.SelectBestAnswer.isSelectGift(a)){return a.id.substr(4)}}return 0},validateInput:function(){var a=document.chooseStarForm;if(a.thankswords.value.length>40){alert("\u60a8\u8f93\u5165\u7684\u611f\u8a00\u8d85\u8fc740\u5b57，\u8bf7\u4fee\u6539！");a.thankswords.focus();a.thankswords.select();return false}if(Zhishi.SelectBestAnswer.answerId<=0){alert("\u9009\u62e9\u6ee1\u610f\u7b54\u6848\u9519\u8bef!");return false}return true},getStartlevel:function(){var c=document.chooseStarForm;if(c.starLevel){var b=c.starLevel.length;for(var a=0;a<b;a++){if(c.starLevel[a].checked){return c.starLevel[a].value}}}return 3},selectOnlyOne:function(){var a=document.chooseStarForm;if(!Zhishi.SelectBestAnswer.validateInput()){return false}document.bestAnswerForm.bestAnswerId1.value=Zhishi.SelectBestAnswer.answerId;document.bestAnswerForm.bestAnswerStarLevel1.value=Zhishi.SelectBestAnswer.getStartlevel();document.bestAnswerForm.bestAnswerMsg1.value="S"+a.thankswords.value;document.bestAnswerForm.bestAnswerGift1.value=Zhishi.SelectBestAnswer.getGiftId();document.bestAnswerForm.originalType1.value=Zhishi.SelectBestAnswer.originalType;document.bestAnswerForm.solvedType1.value=Zhishi.SelectBestAnswer.solvedType;document.bestAnswerForm.authorRate1.value=Zhishi.SelectBestAnswer.rateIndex;document.bestAnswerForm.authorAttitude1.value=Zhishi.SelectBestAnswer.attiIndex;document.bestAnswerForm.bestAnswerId2.value="0";document.bestAnswerForm.bestAnswerStarLevel2.value="0";document.bestAnswerForm.bestAnswerMsg2.value="S";document.bestAnswerForm.bestAnswerGift2.value="0";document.bestAnswerForm.originalType2.value="0";document.bestAnswerForm.solvedType2.value="0";document.bestAnswerForm.authorRate2.value="0";document.bestAnswerForm.authorAttitude2.value="0";document.getElementById("b"+Zhishi.SelectBestAnswer.answerId).disabled=true;Zhishi.SelectBestAnswer.bestAnswerDialog.close();Zhishi.SelectBestAnswer.submit()},selectMore:function(){var b=document.chooseStarForm;if(!Zhishi.SelectBestAnswer.validateInput()){return false}document.bestAnswerForm.bestAnswerId1.value=Zhishi.SelectBestAnswer.answerId;document.bestAnswerForm.bestAnswerStarLevel1.value=Zhishi.SelectBestAnswer.getStartlevel();document.bestAnswerForm.bestAnswerMsg1.value="S"+b.thankswords.value;document.bestAnswerForm.bestAnswerGift1.value=Zhishi.SelectBestAnswer.getGiftId();document.bestAnswerForm.originalType1.value=Zhishi.SelectBestAnswer.originalType;document.bestAnswerForm.solvedType1.value=Zhishi.SelectBestAnswer.solvedType;document.bestAnswerForm.authorRate1.value=Zhishi.SelectBestAnswer.rateIndex;document.bestAnswerForm.authorAttitude1.value=Zhishi.SelectBestAnswer.attiIndex;Zhishi.SelectBestAnswer.originalType="0";Zhishi.SelectBestAnswer.solvedType="0";Zhishi.SelectBestAnswer.rateIndex="0";Zhishi.SelectBestAnswer.attiIndex="0";var a=document.getElementById("b"+Zhishi.SelectBestAnswer.answerId);if(a){a.value="\u5df2\u88ab\u91c7\u7eb3";a.disabled=true}Zhishi.SelectBestAnswer.bestAnswerHasSelectOne=true;Zhishi.SelectBestAnswer.bestAnswerDialog.close()},selectComplete:function(){var a=document.chooseStarForm;if(!Zhishi.SelectBestAnswer.validateInput()){return false}if(!Zhishi.SelectBestAnswer.bestAnswerHasSelectOne||Zhishi.SelectBestAnswer.answerNum<=1){document.bestAnswerForm.bestAnswerId1.value=Zhishi.SelectBestAnswer.answerId;document.bestAnswerForm.bestAnswerStarLevel1.value=Zhishi.SelectBestAnswer.getStartlevel();document.bestAnswerForm.bestAnswerMsg1.value="S"+a.thankswords.value;document.bestAnswerForm.bestAnswerGift1.value=Zhishi.SelectBestAnswer.getGiftId();document.bestAnswerForm.originalType1.value=Zhishi.SelectBestAnswer.originalType;document.bestAnswerForm.solvedType1.value=Zhishi.SelectBestAnswer.solvedType;document.bestAnswerForm.authorRate1.value=Zhishi.SelectBestAnswer.rateIndex;document.bestAnswerForm.authorAttitude1.value=Zhishi.SelectBestAnswer.attiIndex}else{document.bestAnswerForm.bestAnswerId2.value=Zhishi.SelectBestAnswer.answerId;document.bestAnswerForm.bestAnswerStarLevel2.value=Zhishi.SelectBestAnswer.getStartlevel();document.bestAnswerForm.bestAnswerMsg2.value="S"+a.thankswords.value;document.bestAnswerForm.bestAnswerGift2.value=Zhishi.SelectBestAnswer.getGiftId();document.bestAnswerForm.originalType2.value=Zhishi.SelectBestAnswer.originalType;document.bestAnswerForm.solvedType2.value=Zhishi.SelectBestAnswer.solvedType;document.bestAnswerForm.authorRate2.value=Zhishi.SelectBestAnswer.rateIndex;document.bestAnswerForm.authorAttitude2.value=Zhishi.SelectBestAnswer.attiIndex}document.getElementById("b"+Zhishi.SelectBestAnswer.answerId).disabled=true;Zhishi.SelectBestAnswer.rateIndex="0";Zhishi.SelectBestAnswer.attiIndex="0";Zhishi.SelectBestAnswer.originalType="0";Zhishi.SelectBestAnswer.solvedType="0";Zhishi.SelectBestAnswer.bestAnswerDialog.close();Zhishi.SelectBestAnswer.submit()},submit:function(){document.bestAnswerForm.submit()}};Zhishi.TeamCooperate={answerForm:null,teamCheckBox:null,showTeamMemberDialog:null,teamCooperte:function(){},showTeamAnswerMembers:function(b,a){Zhishi.TeamCooperate.showTeamMemberDialog=new Zhishi.Dialog("\u5408\u4f5c\u7f16\u8f91\u8005",460,310,true,"ShowTeamCooperateMembers.e?sp="+b+"&sp="+a);Zhishi.TeamCooperate.showTeamMemberDialog.show()}};function trim(a){a=a.replace(/(^\s*)|(\s*$)/g,"");return a}function redirectSearch4Form(i,g,c){var e=trim(i.w.value);if(e==""){window.location.reload();return false}else{var h=search_solved_url.replace(/\?.*/gi,"");var d=h+"?sp=S"+encodeURIComponent(e);if(c&&g!=""){d+="&ch="+g}if(Zhishi.Browser.isIE||Zhishi.Browser.isOpera){var b=document.createElement("a");b.href=d;document.body.appendChild(b);b.click()}else{document.location=d}return false}}function redirectAskWithParam(d,e){var g=trim(d.value);var f="";if(e==null){e=""}if(isEmpty(g)){var c=ask_for_title_url+"&ch="+e;f=c}else{var c=ask_url+encodeURIComponent(d.value)+"&ch="+e;f=c}if(Zhishi.Browser.isIE||Zhishi.Browser.isOpera){var b=document.createElement("a");b.href=f;document.body.appendChild(b);b.click()}else{document.location=f}}function chat(a,c,f,d,b){var e="http://wenwen.soso.com/cgi-bin/TS_cgi?tu=";e=e+f+"&tm="+d+"&q="+a+"&a="+c+"&enc="+b;getLink(e);return false}function openChatBox(b){if(b){Link=b;try{if(Zhishi.Browser.isIE){var a=new ActiveXObject("TimwpDll.TimwpCheck");if(a){var d=a.GetVersion()}if(d>=2.1){this.location.href=Link}else{alert("\u641c\u641c\u95ee\u95ee\u6e29\u99a8\u63d0\u793a：\r\n　　\u8bf7\u60a8\u8bbf\u95eehttp://im.qq.com/\u4e0b\u8f7d\u65b0\u7248\u7684QQ/TM\u4ee5\u652f\u6301\u4e0e\u95ee\u53cb\u5728\u7ebf\u4ea4\u6d41！");window.target="_top";window.open("http://im.qq.com/")}}else{if(Zhishi.Browser.isFirefox){this.location.href=Link}else{alert("\u641c\u641c\u95ee\u95ee\u6e29\u99a8\u63d0\u793a：\r\n　　\u60a8\u4f7f\u7528\u7684\u6d4f\u89c8\u5668\u4e0d\u652f\u6301QQ\u4e34\u65f6\u4f1a\u8bdd\u529f\u80fd，\u5efa\u8bae\u60a8\u52a0\u5bf9\u65b9\u4e3a\u597d\u53cb，\u6216\u4f7f\u7528IE/TT/FireFox\u6d4f\u89c8\u5668\u8bbf\u95ee。")}}}catch(c){alert("\u641c\u641c\u95ee\u95ee\u6e29\u99a8\u63d0\u793a：\r\n　　\u8bf7\u60a8\u8bbf\u95eehttp://im.qq.com/\u4e0b\u8f7d\u65b0\u7248\u7684QQ/TM\u4ee5\u652f\u6301\u4e0e\u95ee\u53cb\u5728\u7ebf\u4ea4\u6d41！");window.target="_top";window.open("http://im.qq.com/")}}}function getLink(b){var a;Editor.Ajax.sendRequest("GET",b,{onSuccess:function(c){openChatBox(c);return false}});return false};
