var _isRuning=false;var _can_commend=true;var oFCKeditor=new Array();var filter=new specailCharacterFilter();var _WorkingStr="<img src='/pages/common/image/ajax-loader.gif' border='0'/>";function loadQuestion(A){if(_isRuning){return }_isRuning=true;$("zixun_liebiao").innerHTML=_WorkingStr;if(A==null){A=1}var C=function(F){_isRuning=false;alert("Error "+F.status+" -- "+F.statusText)};var D=function(F){_isRuning=false;$("zixun_liebiao").innerHTML=F.responseText;replaceFlashImageAll("zixun_liebiao")};var B="http://"+window.location.hostname+":"+window.location.port+"/question.do";var E="method=viewRecent&pageNo="+A;new Ajax.Request(B,{asynchronous:true,method:"post",postBody:E,onSuccess:D,onFailure:C})}function loadQuestionLogined(A,D,G){if(_isRuning){return }if(D){currentType=D}_isRuning=true;if(G){questionType=G}$("changeQuestion").innerHTML=_WorkingStr;if(A==null){A=1}var C=function(H){_isRuning=false;alert("Error "+H.status+" -- "+H.statusText)};var E=function(H){_isRuning=false;if(H.responseText=="error"){window.location.href="/showRegisterFamily.do";return }$("changeQuestion").innerHTML=H.responseText};var B="http://"+window.location.hostname+":"+window.location.port+"/editor/question.do";var F="method=turnPage&type="+currentType+"&page="+A+"&questionType="+questionType;new Ajax.Request(B,{asynchronous:true,method:"post",postBody:F,onSuccess:E,onFailure:C})}function deleteQuestion(D,A){if(!_canEditor_question){alert("请先登陆再进行此操作。");return false}var G="确实要删除该咨询吗？";if(A=="comment"){G="确实要删除该回复吗？"}if(!confirm(G)){return }var C=function(I){alert("Error "+I.status+" -- "+I.statusText)};var F=function(J){var I=J.responseText;if(I=="1"){alert("你没有权限删除该咨询！")}else{if(I=="2"){alert("删除咨询成功！");self.location.href="/app/advice/all"}else{if(I=="3"){alert("删除咨询失败！")}}}};var E=function(J){var I=J.responseText;if(I=="1"){alert("你没有权限删除该回复！")}else{if(I=="3"){alert("删除回复失败！")}else{$("huifu_content").innerHTML=J.responseText}}replaceFlashImageAll("huifu_content")};var B="http://"+window.location.hostname+":"+window.location.port+"/editor/question.do";var H="method=delete&delId="+D;if(A=="comment"){new Ajax.Request(B,{asynchronous:true,method:"post",postBody:H,onSuccess:E,onFailure:C})}else{new Ajax.Request(B,{asynchronous:true,method:"post",postBody:H,onSuccess:F,onFailure:C})}}function prosecutionQuestion(adviceId,content,path){var errFunc=function(t){alert("Error "+t.status+" -- "+t.statusText)};var handlerFunc=function(t){eval(t.responseText)};var url="http://"+window.location.hostname+":"+window.location.port+"/prosecution.do";var param="method=add&type=question&linkId="+adviceId+"&content="+encodeURIComponent(content)+"&url="+encodeURIComponent(path);new Ajax.Request(url,{asynchronous:true,method:"post",postBody:param,onSuccess:handlerFunc,onFailure:errFunc})}var commentNow;function addComment(D){if(!_canEditor_question){self.location.href="/userLogin.do";return }if(D==null){document.forms[0].title.focus();return }if(_isRuning){return }_isRuning=true;var C=function(G){_isRuning=false;alert("Error "+G.status+" -- "+G.statusText)};var A=document.forms.length;var E=function(G){if(commentNow!=null){commentNow.innerHTML=""}_isRuning=false;$(D+"_comment").innerHTML=G.responseText;replaceFlashImageAll(D+"_comment");$(D+"_saveDIV").innerHTML='<input type="button" onclick="saveComment('+A+');" value="\u6dfb\u52a0\u56de\u590d" />';commentNow=$(D+"_comment");oFCKeditor[A]=new FCKeditor("content"+A,"583px","173px");oFCKeditor[A].BasePath="/pages/homeblog/editor/fckeditor/";oFCKeditor[A].ToolbarSet="Basic";oFCKeditor[A].Config.ImageUploadURL="/pages/homeblog/editor/fckeditor/editor/filemanager/upload/simpleuploader?Type=Image&is_deal2=640&flag=group";oFCKeditor[A].Config.ImageBrowserURL="/pages/homeblog/editor/fckeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector";oFCKeditor[A].ReplaceTextarea()};var B="http://"+window.location.hostname+":"+window.location.port+"/editor/question.do";var F="method=addComment&adviceId="+D+"&formIndex="+A;ajaxRequest(B,{onSuccess:E,postBody:F})}function saveComment(J){if(_isRuning){return }var A=oFCKeditor[J];var E=document.forms[J];if(E.title.value.trim()==""){alert("\u6807\u9898\u4e0d\u80fd\u4e3a\u7a7a\uff01");E.title.focus();return false}if(A.getTextareaValue().trimAll()==""){alert("\u5185\u5bb9\u4e0d\u80fd\u4e3a\u7a7a\uff01");return false}showSetNickName();if(emptyNickName){return false}_isRuning=true;var H=function(K){_isRuning=false;alert("Error "+K.status+" -- "+K.statusText)};var F=function(K){_isRuning=false;$("huifu_content").innerHTML=K.responseText;if(J==1){A.setTextareaValue("")}replaceFlashImageAll("huifu_content")};var B="http://"+window.location.hostname+":"+window.location.port+"/editor/question.do";var I=replace2XML(A.getTextareaValue());var D=E.adviceId.value;var G=replace2XML(E.title.value);var C="method=saveComment&content="+I+"&adviceId="+D+"&title="+G;$("huifu_content").innerHTML=_WorkingStr;new Ajax.Request(B,{asynchronous:true,method:"post",postBody:C,onSuccess:F,onFailure:H})}function cancelComment(A){$(A+"_comment").innerHTML=""}function voteAdvice(D,G,C){if(_isRuning){return }_isRuning=true;var B=function(H){_isRuning=false;alert("Error "+H.status+" -- "+H.statusText)};var E=function(I){$(D+"_star").innerHTML=I.responseText;_isRuning=false;if(C!=null){for(var H=1;H<6;H++){$("vote_rating_"+H).checked=false}C.checked=true}};var A="http://"+window.location.hostname+":"+window.location.port+"/question.do";var F="method=vote&adviceId="+D+"&score="+G;new Ajax.Request(A,{asynchronous:true,method:"post",postBody:F,onSuccess:E,onFailure:B})}function searchKeyWord(){if(trim(document.getElementById("keyWord").value)==""){alert("\u8bf7\u8f93\u5165\u8981\u641c\u7d22\u7684\u5173\u952e\u5b57\uff01");document.getElementById("keyWord").focus();return }else{if(!filter.test(document.getElementById("keyWord").value)){alert("\u5173\u952e\u5b57\u4e2d\u542b\u6709\u7279\u6b8a\u5b57\u7b26\uff01");return }}adviceForm.submit()}function sendMail(C){if(_isRuning){return }var E=trim($("emailAddr").value);if(E==""){alert("\u90ae\u4ef6\u5730\u5740\u4e0d\u80fd\u4e3a\u7a7a\uff01");$("emailAddr").focus();return }if(!checkEmail(E)){alert("\u8f93\u5165\u7684\u90ae\u4ef6\u5730\u5740\u4e0d\u6b63\u786e\uff01");$("emailAddr").focus();return }_isRuning=true;var B=function(G){_isRuning=false;alert("Error "+G.status+" -- "+G.statusText)};var D=function(G){_isRuning=false;$("emailAddr").value=G.responseText;alert(G.responseText)};var A="http://"+window.location.hostname+":"+window.location.port+"/advice.do";var F="method=sendMail&adviceId="+C+"&emailAddr="+E;new Ajax.Request(A,{asynchronous:true,method:"post",postBody:F,onSuccess:D,onFailure:B})}function clearEmail(A){if(A.value.indexOf("E-mail")!=-1){A.value=""}A.focus()};