function process_topic_form(a){if(!a)return false;var b=0;if(a.title){var c=$.trim(a.title.value);var d=c.length;if(c=="至少3个字符，不超过32个字符"){b=1;alert("请输入帖子标题")}else if(0==d){b=1;alert("帖子标题为空")}else if(d<=3){b=1;alert("帖子标题太短")}if(b){a.title.focus();return false}}if(a.content){var d=$.trim(a.content.value).length;if(d==0){b=1;alert("帖子内容为空")}else if(d>10000){b=1;alert("帖子内容超过1万汉字，请缩减后重新发帖")}if(b){a.content.focus();return false}}if(a.verifyNum){d=$.trim(a.verifyNum.value).length;if(d!=4){alert("请输入正确的验证码");a.verifyNum.focus();return false}}$("#btn").attr('disabled',true);return true}function quick_send(e){var a;var b;var c;if(!e.ctrlKey){return false}if(window.event){a=e.keyCode}else if(e.which){a=e.which}if(a==13){if($("#btn").attr("disabled") == false){$("#btn").attr('disabled',true);return $("#submit_form").submit()}}return false}function postError(str){alert(str);$("#btn").attr('disabled',false);}function show_verify_image(t){if($("#imgverify").length)return;$("#verify_cell").prepend('<img id="imgverify" alt="验证码"/>');$('<a id="retry_link" href="#" tabindex="999">看不清，换一张</a>').prependTo($("#retry_cell")).click(function(){$("#imgverify").attr('src',"./getimage.php?do="+t+"&rdm="+Math.random());return false});$("#imgverify").load(function(){$("#verify_div").show();window.scrollTo(0,99999)}).attr('src',"./getimage.php?do="+t+"&rdm="+Math.random())}function setReplyTitle(a){var b=$("#title");b.val(b.val().replace(/回复\s*\d*[:：](.*)/,'回复'+a+'：'+"$1"))}function opinion(p,h,i){var j=$("span",i).eq(0);var l={op:'standpoint',pid:p,opinion:h,rdm:Math.random()};$.post('./post.php',l,function(a){var b=parseInt(a);if(b==0){var c=j.html();var d=c.search(/\d+/);if(d<0){c=c+' 1'}else{var e=c.substring(0,d);var f=parseInt(c.substr(d))+1;c=e+f}j.html(c)}else{alert(a.substr(a.indexOf(' ')+1))}})}function topicstat(tid){$.ajax({type:"POST",url:"./post.php",data:"tid="+tid+"&op=topicStat"});}function anonymity_update(){var n=$.trim($('#nickname').val());var l=n.length;if(l<"2"||l>"15"){alert('昵称长度不合法。');$('#nickname').focus();return false;}$.ajax({type:"POST",url:"./anonymity.php?do=update",data:$('#anonymity-form').serialize(true),success: function(m){var b=parseInt(m);if(b==0){$("#loginStateInfo").html(n+"，您未登录。");tb_remove();}else{alert(m.substr(m.indexOf(' ')+1))}}});}function anonymity_delete(){$.ajax({type:"POST",url:"./anonymity.php?do=delete",data:"rdm="+Math.random()});$("#loginStateInfo").html("您尚未登录。");tb_remove();}function admin(){if($.trim($('#login-pwd').val())==""){alert('请输入密码');$('#login-pwd').focus();return false;}$.ajax({type:"POST",url:"./admin.php?do=login",data:$('#login-form').serialize(true),success: function(m){var b=parseInt(m);if(b=="1"){top.location.reload();}else{alert(m.substr(m.indexOf(' ')+1))}}});}function login(){if($.trim($('#login-user').val())==""){alert('请输入通行证账号');$('#login-user').focus();return false;}if($.trim($('#login-pwd').val())==""){alert('请输入通行证密码');$('#login-pwd').focus();return false;}$.ajax({type:"POST",url:"./login.php?do=login",data:$('#login-form').serialize(true),success: function(m){var b=parseInt(m);if(b=="1"){top.location.reload();}else{alert(m.substr(m.indexOf(' ')+1))}}});}function register(){if($.trim($('#username').val())==""){alert('请输入昵称');$('#username').focus();return false;}if($.trim($('#userpwd').val())==""){alert('请输入密码');$('#userpwd').focus();return false;}if($.trim($('#userpwd').val()).length<"6"){alert('密码至少六位');$('#userpwd').focus();return false;}if($.trim($('#userpwd').val())!=$.trim($('#repwd').val())){alert('两次输入的密码不一致');$('#repwd').focus();return false;}if($.trim($('#useremail').val())==""){alert('请输入电子邮箱');$('#useremail').focus();return false;}$.ajax({type:"POST",url:"./register.php?do=reg",data:$('#reg-form').serialize(true),success: function(m){var b=parseInt(m);if(b==0){alert(m.substr(m.indexOf(' ')+1));top.location.reload();}else{alert(m.substr(m.indexOf(' ')+1))}}});}function recoverpass(){if($.trim($('#username').val())==""){alert('请输入用户昵称');$('#username').focus();return false;}if($.trim($('#useremail').val())==""){alert('请输入电子邮箱');$('#useremail').focus();return false;}$("#recover_submit").hide();$("#recover_result").show();$.ajax({type:"POST",url:"./recoverpass.php?do=send",data:$('#recover-form').serialize(true),success: function(m){var b=parseInt(m);if(b==0){$('#backuid')[0].value=m.substr(m.indexOf(' ')+1);$("#recover_step1").hide();$("#recover_step2").show();}else{$("#recover_result").hide();$("#recover_submit").show();alert(m.substr(m.indexOf(' ')+1));}}});}function resetpass(){if($.trim($('#safetycode').val()).length<"8"){alert('请输入正确识别码');$('#safetycode').focus();return false;}if($.trim($('#newpwd').val())==""){alert('请输入新密码');$('#newpwd').focus();return false;}if($.trim($('#newpwd').val()).length<"6"){alert('密码长度至少六位');$('#newpwd').focus();return false;}if($.trim($('#repwd').val())!=$.trim($('#newpwd').val())){alert('两次输入的新密码不一致');$('#repwd').focus();return false;}$.ajax({type:"POST",url:"./recoverpass.php?do=reset",data:$('#resetpwd-form').serialize(true),success: function(m){var b=parseInt(m);if(b==0){alert(m.substr(m.indexOf(' ')+1));top.location.reload();}else if(b==2){alert(m.substr(m.indexOf(' ')+1));tb_remove();}else{alert(m.substr(m.indexOf(' ')+1))}}});}function profile(){if($.trim($('#oldpasswd').val()).length<"6"){alert('请输入正确的当前密码');$('#oldpasswd').focus();return false;}if($.trim($('#useremail').val()).length<"6"){alert('请输入正确的电子邮箱地址');$('#useremail').focus();return false;}$.ajax({type:"POST",url:"./profile.php?do=modify",data:$('#profile-form').serialize(true),success: function(m){var b=parseInt(m);if(b==0){alert(m.substr(m.indexOf(' ')+1));tb_remove();}else{alert(m.substr(m.indexOf(' ')+1))}}});}function apply(){var t=$.trim($('#applytype').val());var c=$.trim($('#applyreason').val()).length;if(c<"10"||c>"90"){if(t=="1"){alert('申请理由应控制在10到90个字之间');}else{alert('辞职理由应控制在10到90个字之间');}$('#applyreason').focus();return false;}$.ajax({type:"POST",url:"./apply.php?do=apply",data:$('#apply-form').serialize(true),success: function(m){if(m.length<"25"){var b=parseInt(m);if(b==0){alert(m.substr(m.indexOf(' ')+1));if(t=="1"){tb_remove();}}else{alert(m.substr(m.indexOf(' ')+1))}}else{alert('状态异常，请刷新页面。')}}});}function report(){var c=$.trim($('#reportcontent').val()).length;if(c<"3"||c>"80"){alert('举报原由应控制在3到80个字之间');$('#reportcontent').focus();return false;}$.ajax({type:"POST",url:"./report.php?do=report",data:$('#report-form').serialize(true),success: function(m){var b=parseInt(m);if(b==0){alert(m.substr(m.indexOf(' ')+1));tb_remove();}else{alert(m.substr(m.indexOf(' ')+1))}}});}function create(){var b=$.trim($('#bar').val()).length;if(b<1||b>15){alert('吧名称长度不合法');$('#bar').focus();return false;}var i=$.trim($('#intro').val()).length;if(i<10||i>90){alert('吧简介必须介于10到90字之间');$('#intro').focus();return false;}$.ajax({type:"POST",url:"./create.php?do=create",data:$('#newForm').serialize(true),success: function(m){var b=parseInt(m);var g=m.substr(m.indexOf(' ')+1);if(b=="2"){alert(g);top.location.href='./';}else if(b=="1"){top.location.href=g;}else{alert(g);}}});}function barRss(id){window.open('./rss.php?fid='+id);}function topicManage(f,i,s,t){var truthBeTold = window.confirm("确定要继续此项操作？");if(truthBeTold){var l={fid:f,id:i,ac:s,op:t,rdm:Math.random()};$.post('./manage.php',l,function(a){var p=a.substr(a.indexOf(' ')+1);var b=parseInt(a);if(b==0){if(p=="OK"){top.location.reload();}else{top.location.href=p;}}else{alert(p);}})}else{return false;}}function setBlack(f,i,u){var truthBeTold = window.confirm("确定要封？");if(truthBeTold){var l={fid:f,uid:i,str:u,op:'blockade',rdm:Math.random()};$.post('./manage.php',l,function(a){alert(a);})}else{return false;}}function toggleSelect(){$(".operchk").each(function(i){if(this.disabled)return;if(this.checked){this.checked=""}else{this.checked="checked"}})}function selectAll(){$(".operchk").each(function(i){if(this.disabled)return;this.checked="checked"})}function delSelItems(fid,tid){var e=$(".operchk").filter(function(){return!this.disabled&&this.checked}).map(function(){return this.value}).get().join(',');if(e.length==0){alert('请选择要删除的回帖');}else{var truthBeTold = window.confirm("确定要删除这些帖子吗？");if(truthBeTold){var l={fid:fid,tid:tid,pid:e,op:'batchDelete',rdm:Math.random()};$.post('./manage.php',l,function(a){var p=a.substr(a.indexOf(' ')+1);var b=parseInt(a);if(b==0){if(p=="OK"){top.location.reload();}else{top.location.href=p;}}else{alert(p);}})}}}function AddFavorite(){if(window.sidebar&&"object"==typeof(window.sidebar)&&"function"==typeof(window.sidebar.addPanel)){window.sidebar.addPanel(document.title,document.location.href,'');}else if(document.all&&"object"==typeof(window.external)){window.external.addFavorite(document.location.href,document.title);}else{alert('本功能仅支持 IE 和 FireFox 浏览器！');}}function caclWord(){var v=$.trim($('#applyreason').val()).length;$("#wcount").html(v);}function SearchSubmit(a){var w=$.trim(a.wd.value);if(w==""){alert('请输入关键词');a.wd.value='';a.wd.focus();return false;}if(a.tb[0].checked==false&&a.tb[1].checked==false&&a.tb[2].checked==false){return false;}}function clueOn(a){if(a==1){$("#clueon").html("输入贴吧名称直接回车即可进入该吧，如果吧不存在即可创建。");}if(a==2){$("#clueon").html("输入关键词直接回车即可搜索");}if(a==3){$("#clueon").html("输入作者名称直接回车即可搜索");}}