var G=baidu.G;var $=OpenZD.$;var F=OpenZD.form;OpenZD.safe={};OpenZD.safe.isLogined=function(callback,opt){opt=opt||{};opt.r=opt.r?1:0;baidu.ajax.get("/user/status",function(xhr,res){var safe=eval("("+res+")");window.USYS_TYPE=window.USYS_TYPE||safe.usys_type;window.USYS_NAME=window.USYS_NAME||safe.usys_name;if(safe.uid==null||safe.uid==0){if(opt.r){pop.show("提示",{info:'<p>您还没有登录或者登录已超时</p><input type="button" class="pop_btn_short" style="margin-top: 50px;" value="返回" id="ok-btn" onclick="pop.hide();" />',width:200,height:200})}else{pop.show("提示",{info:'<p>您还没有登录</p><input type="button" class="pop_btn_short" style="margin-top: 50px;" value="登录" id="ok-btn" onclick="pop.hide();loginOpenZD();" />',width:200,height:200})}}else{callback(safe)}})};var iWantAskFunc=function(A,B){if(A){OpenZD.tool.openURL("/question?cids="+(B||""))}else{OpenZD.safe.isLogined(function(){pop.show("填写问题",{info:'<form id="empty_pop_form" name="empty-pop-form" style="text-align: left; margin-top: 25px;" onsubmit="return false;"><div style="margin:5px 0;">请输入您的提问标题：    </div><input id="empty_pop_input" style="padding: 1px 0pt; width: 300px; font-size: 16px;"/><br/><input type="submit" id="empty_pop_btn" value="继续提问" style="margin-top: 4px;" class="btn-short"/></form>',width:370,height:200});OpenZD.on("empty_pop_btn","click",function(C){OpenZD.tool.openURL("/question",{word:OpenZD.$("#empty_pop_input").value,cids:B||""});setTimeout(function(){location.reload()},500)});OpenZD.$("#empty_pop_input").focus()})}};OpenZD.tool=OpenZD.tool||{};OpenZD.tool.openURL=function(A,D){var M=[];if(A.indexOf("?")>-1){var I=A.substring(0,A.indexOf("?"));var L=A.substring(A.indexOf("?")+1);var C=L.split("&");for(var E=0,H=C.length;E<H;E++){var K=C[E].split("=");M.push([K[0],K[1]])}}else{var I=A}if(D!=null){for(var B in D){M.push([B,D[B]])}}var J=document.createElement("form");document.body.appendChild(J);J.action=I;J.method="get";J.target="_blank";for(var E=0,H=M.length;E<H;E++){var N=document.createElement("input");N.type="hidden";N.name=M[E][0];N.value=M[E][1];J.appendChild(N)}N=null;J.submit();J=null};OpenZD.tool.resizeImg=function(A,D,C){var B=new Image();B.onload=function(){this.onload=null;var H=this.width,J=this.height;if(H>0&&J>0){var I=(D/H<C/J)?D/H:C/J;var K=0;var E=0;if(I<=1){K=A.width=Math.round(H*I);E=A.height=Math.round(J*I)}else{K=A.width=H;E=A.height=J}}A=null};A.onload=null;B.src=A.src};var loginOpenZD=function(){if(USYS_TYPE.length>1){var A="<p>请选择一个账号登录：</p>";A+="<ul>";for(var B=0;B<USYS_TYPE.length;B++){A+='<li><a href="#" onclick="OpenZD.tool.openURL(\'/user/login_start?Provider='+USYS_TYPE[B]+"');pop.hide();return false;\">"+USYS_NAME[B]+"账号系统</a></li>"}A+="</ul>";pop.show("提示",{info:A,width:200,height:200})}else{OpenZD.tool.openURL("/user/login_start?Provider="+USYS_TYPE[0])}};var regOpenZD=function(){if(USYS_TYPE.length>1){var A="<p>请选择一个注册站点：</p>";A+="<ul>";for(var B=0;B<USYS_TYPE.length;B++){A+='<li><a href="#" onclick="OpenZD.tool.openURL(\'/user/register?Provider='+USYS_TYPE[B]+"');pop.hide();return false;\">"+USYS_NAME[B]+"账号系统</a></li>"}A+="</ul>";pop.show("提示",{info:A,width:200,height:200})}else{OpenZD.tool.openURL("/user/register?Provider="+USYS_TYPE[0])}};var searchFormHandler=function(C){var C=C||window.event,B=C.target||C.srcElement,A=B.type||"openzhidao";if(A=="iknow"){B.action="http://zhidao.baidu.com/q";B.target="_blank";B.ct.removeAttribute("disabled");B.pn.removeAttribute("disabled");B.tn.removeAttribute("disabled");B.rn.removeAttribute("disabled");B.fr.removeAttribute("disabled")}else{B.action="/search";B.target="_self";B.ct.disabled="disabled";B.pn.disabled="disabled";B.tn.disabled="disabled";B.rn.disabled="disabled";B.fr.disabled="disabled"}};OpenZD.ready(function(){OpenZD.on("login","click",function(A){OpenZD.preventDefault(A);loginOpenZD()});OpenZD.on("reg","click",function(A){OpenZD.preventDefault(A);regOpenZD()});OpenZD.on("logout","click",function(A){OpenZD.preventDefault(A);OpenZD.utils.callByServer("/user/logout")});OpenZD.on("msg-notice-closebtn","click",function(A){baidu.addClass("msg-notice-wrap","hide");baidu.event.preventDefault(A)});(function(D){var E=D.G("msg-notice-wrap");function B(H){var I={pos:"n",cmd:"click"};baidu.extend(I,H);baidu.more.nslog(window.location,1,I)}if(E){D.on("msg-notice-closebtn","click",function(H){B({pos:"msgclose"})});D.on(E,"click",function(J){var I=baidu.event.get(J).target;if(I.nodeName.toLowerCase()==="a"){var H=I.href.toString().toLowerCase();if(H.indexOf("#expire")>0){B({pos:"msgexpire"})}else{if(H.indexOf("#question")>0){B({pos:"msgquestion"})}else{if(H.indexOf("#answer")>0){B({pos:"msganswer"})}else{if(H.indexOf("#best")>0){B({pos:"msgbest"})}}}}}});var A=E.getElementsByTagName("a");for(var C=0;C<A.length;C++){(function(I){var H=I.href.toString().toLowerCase();if(H.indexOf("#expire")>0){B({pos:"msgexpire",cmd:"show"})}else{if(H.indexOf("#question")>0){B({pos:"msgquestion",cmd:"show"})}else{if(H.indexOf("#answer")>0){B({pos:"msganswer",cmd:"show"})}else{if(H.indexOf("#best")>0){B({pos:"msgbest",cmd:"show"})}}}}})(A[C])}}})(baidu)});if(typeof (HTMLElement)!="undefined"&&!window.opera){HTMLElement.prototype.__defineGetter__("innerText",function(){return this.textContent});HTMLElement.prototype.__defineSetter__("innerText",function(A){this.textContent=A})};
