var MemberApply={user_id:"",user_name:"",club_id:"",club_name:"",dialog:{},_submit_url:"/club/cmclub/member_apply",init:function(){if(""==this.user_id){Club.showLoginLayer();return }Club.syncGet("/club/"+this.club_id+"/common/getuserinfo",{},function(xhr){var result=eval("("+xhr.responseText+")");if(typeof result=="undefined"){return }if(!result.is_login){Club.showLoginLayer();return }if(result.id_prison){MemberApply._showTipLayer("抱歉，您的帐号由于违规操作被封，暂无法申请加入会员。");return }if(result.ip_prison){MemberApply._showTipLayer("抱歉，您的网络地址由于违规操作被封，暂无法申请加入会员。");return }if(result.is_black){MemberApply._showTipLayer("对不起，本俱乐部吧主认为您不符合本俱乐部会员条件，您暂时无法申请成为本俱乐部会员。如果您对此有疑问，请直接与本俱乐部吧主联系。");return }MemberApply._showApplyLayer()})},_showApplyLayer:function(){var A="Friend.submitAddReq";var C="您正在申请成为“"+this.club_name+"俱乐部”的会员，需要经过吧主的审批才能加入。";var B='<div style="padding:10px 15px;font-size:12px;"><div style="line-height:20px;">'+C+'<br><strong>您可以给吧主写几句简短的留言</strong>（最多100字）</div><textarea cols="51" style="height:60px;" id="apply_msg" name="apply_msg" value="" ></textarea><div style="margin-top:10px;"><input type="button" value="申请加入" onclick="MemberApply.submitRequest();">&nbsp;&nbsp;&nbsp;<input type="button" onclick="MemberApply.dialog.close();" value=" 取消 ">&nbsp;&nbsp;<p id="tip_msg"></p></div></div>';this.dialog=Fe.Dialog.open(B,{title:"会员申请",width:485,height:200})},_showTipLayer:function(B){var A='<div style="font-size:13px;padding:20px 0 10px 20px;line-height:18px;">'+B+"</div>";Fe.Dialog.alert(A,{title:"会员申请",width:390})},submitRequest:function(userName){var message=Fe.String.trim(document.getElementById("apply_msg").value);if(Fe.String.getByteLength(message)>200){MemberApply.showMessage("tip_msg","您填写的留言超过100个汉字，请重试");return false}Club.post(this._submit_url,{msg:message,user_name:this.user_name},function(xhr){var result=eval("("+xhr.responseText+")");if(typeof result=="undefined"){return }if(result=="done"){setTimeout(function(){MemberApply.dialog.close();window.location.reload(true)},500)}else{for(var key in result){MemberApply.showMessage("tip_msg",result[key])}}})},showMessage:function(C,B){var A=document.getElementById(C);A.innerHTML=B;A.style.color="#E10601"}};