	function re_js(green) {
		if (green) {
			myform.Submit.disabled=false
		} else {
			myform.Submit.disabled=true;
		}
	}

	var i=8;
	function re_jump() {
		document.myform.Submit.value="请仔细阅读协议，"+i+"秒";
		if(i>0) {
			setTimeout("re_jump()",1000);
		} else {
			myform.Submit.disabled=false
			document.myform.Submit.value="提交注册";
		}
		i=i-1;
	}
	
	function chkEmpty(target,info,msg) {
		var flag = false;
		var va = getObjValue(target).Trim();
		var re = getObject(info);
		if (va.length < 1) {
			re.innerHTML="<font color=\"red\">" + msg + "</font>";
		} else {
			re.innerHTML="";
			flag = true;
		}
		return flag;
	}

	function chkselect() {
		var flag = false;
		var obj = getObject("question");
		if (obj.options[obj.selectedIndex].value == -1) {
			getObject('aq_info').innerHTML="<font color=\"red\">请选择安全问题！</font>";
			document.myform.question.focus();
		} else {
			getObject('aq_info').innerHTML="";
			flag = true;
		}
		return flag;
	}


    function chkpwd(target,info,msg) {
        var flag = false;
		var vapsw1 = $F('login_password').Trim();
		var vapsw2 = $F('relogin_pwd').Trim();


		var re = getObject(info);
		if (vapsw1=='' || vapsw2=='')
		{
            re.innerHTML="<font color=\"red\">密码不能为空!</font>";
			return false;
		}
		if (vapsw1 != vapsw2) {
			re.innerHTML="<font color=\"red\">" + msg + "</font>";
			return false;
		} else {
			re.innerHTML="<font color=\"green\">两次密码输入一致</font>";
			flag = true;
		}
		return flag;
	}

	/*function chkPwd(target,info) {
		var flag = false;
		var pwd = getObjValue(target).Trim();
		var re = getObject(info);
		if (pwd == '' || pwd.length < 6 || pwd.length > 18) {
			re.innerHTML="<font color=\"red\">请正确填写密码，长度为６~１８个字符！</font>";
		} else {
			re.innerHTML="";
			flag = true;
		}
		return flag;
	}*/

	function chkRePwd(target1,target2,info1,info2) {
		var flag = false;
		var pwd = getObjValue(target1).Trim();
		var rePwd = getObjValue(target2).Trim();
		var re1 = getObject(info1);
		var re2 = getObject(info2);
		if (rePwd.length < 6 || rePwd.length > 16) {
			re2.innerHTML="<font color=\"red\">请正确填写确认密码！</font>";
			return flag;
		}
		if (pwd != rePwd) {
			re1.innerHTML="<font color=\"red\">两次输入的密码不相同，请重新输入！</font>";
			re2.innerHTML="<font color=\"red\">两次输入的密码不相同，请重新输入！</font>";
		} else {
			re1.innerHTML="";
			re2.innerHTML="";
			flag = true;
		}
		return flag;
	}

	function chkReEmail(target1,target2,info1,info2) {
		var flag = false;
		var email = getObjValue(target1).Trim();
		var reEmail = getObjValue(target2).Trim();
		var re1 = getObject(info1);
		var re2 = getObject(info2);
		if (reEmail.length < 1) {
			re2.innerHTML="<font color=\"red\">请正确填写确认邮箱！</font>";
			return flag;
		}
		if (email != reEmail) {
			re1.innerHTML="<font color=\"red\">两次输入的电子邮箱不相同，请重新输入！</font>";
			re2.innerHTML="<font color=\"red\">两次输入的电子邮箱不相同，请重新输入！</font>";
		} else {
			re1.innerHTML="";
			re2.innerHTML="";
			flag = true;
		}
		return flag;
	}

	function chkDbUserName() {
		var result = 0;
		var login_name = $('login_name').value;
		var xmlhttp = createXMLHttps();
		xmlhttp.open("Get","check.php?action=chkname&user_name="+escape(login_name)+"&return=bool",true);
		xmlhttp.setrequestheader("content-type","application/x-www-form-urlencoded;charset=gbk");	
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState < 4) {
				if (xmlhttp.readyState == 1) {
					$("u_info").innerHTML="正在发送请求...";
				} else if (xmlhttp.readyState == 2) {
					$("u_info").innerHTML="已经接收到全部响应内容...";
				} else {
					$("u_info").innerHTML="正在解析响应内容...";
				}
			} else {
				
				if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
					result = xmlhttp.responseText.Trim();
					var test = 'aaaaaaaaaaa';
/*
					if (result == 1) {
						$("u_info").innerHTML="<font color=\"green\">恭喜,此用户名可以注册。</font>";
					} else {
						$("u_info").innerHTML="<font color=\"red\">用户名"+login_name+"已被注册</font>";
						document.myform.login_name.focus();
						alert('aaaaa');
						return false;			
					}
*/
				}
			}
		}
		xmlhttp.send(result);
		alert(test);
		return result;
	}
	function chkuseremail() {
		var email = $('email').value		
		var xmlhttp = createXMLHttps();
		xmlhttp.open("Get","check.php?action=chkmail&email="+escape(email)+"&return=bool",true);
		xmlhttp.setrequestheader("content-type","application/x-www-form-urlencoded;charset=gbk");	
		xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState < 4) {
			if (xmlhttp.readyState == 1) {
				$("e_info").innerHTML="正在发送请求...";
			} else if (xmlhttp.readyState == 2) {
			    $("e_info").innerHTML="已经接收到全部响应内容...";
			} else {
				$("e_info").innerHTML="正在解析响应内容...";
			}
			} else {
				if (xmlhttp.readyState == 4 && xmlhttp.status==404) {
					$("e_info").innerHTML="<div style='width:100%;height:100%;overflow:auto;'>读取页面失败,文件不存在!</div>";
						return false;
				    }
				if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
					var result = xmlhttp.responseText.Trim();
					if (result == 1) {
						$("e_info").innerHTML="<font color=\"green\">恭喜,此邮箱可以注册。</font>";
					} else {
						$("e_info").innerHTML="<font color=\"red\">此邮箱已被注册</font>";
						document.myform.email.focus();
						return false;
					}
				}
			}
		}
		xmlhttp.send(null);
		return true;
	}
	function chkcode() {
		var chk_code = $('chk_code').value		
		var xmlhttp = createXMLHttps();
		xmlhttp.open("Get","check.php?action=chkcode&chk_code="+escape(chk_code)+"&return=bool",true);
		xmlhttp.setrequestheader("content-type","application/x-www-form-urlencoded;charset=gbk");	
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4 && xmlhttp.status==404) {
				return 404;
			}
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				return xmlhttp.responseText.Trim();
			}
		}
		xmlhttp.send(null);
		return 100;
	}


	function checkRegForm1() {

		var login_name = getObjValue('login_name').Trim();
		if(login_name.length == 0) {
			getObject('u_info').innerHTML="<font color=\"red\">用户名不能为空!</font>";
			document.myform.login_name.focus();
			return false;
		}
		if(login_name.length < 3 || login_name.length > 12) {
			getObject('u_info').innerHTML="<font color=\"red\">用户名不符合要求</font>";
			document.myform.login_name.focus();
			return false;
		}
		
		// test
		demo('check.php','action=chkname&user_name='+escape(login_name)+'&return=bool')
		
        
		if (!chkEmpty('email','e_info','邮箱不能为空!')) {
			document.myform.email.focus();
			return false;
		}
        chkuseremail(); //检测邮箱
         
		if (!chkEmpty('true_name','t_info','真实姓名不能为空!')) {
			document.myform.true_name.focus();
			return false;
		}

		if (!chkselect()) {
			$("aq_info").innerHTML="<font color=\"red\">密码问题不能为空!</font>";
			document.myform.question.focus();
			return false;
		}

		if (!chkEmpty('answer','answer_info','问题答案不能为空!')) {
			document.myform.answer.focus();
			return false;
		}

		if (!chkEmpty('login_password','p_info','密码不能为空!')) {
           	document.myform.login_password.focus();
			return false;
		}
		if (!chkEmpty('relogin_pwd','p_info','密码不能为空!')) {
           	document.myform.relogin_pwd.focus();
			return false;
		}
		chkpwd('relogin_pwd','p_info','两次密码不一致!');
		
		if (!chkEmpty('chk_code','code_info','验证码不能为空!')) {   
			document.myform.chk_code.focus();
			return false;
		} else {
			/*var res_code = chkcode();
			if (res_code == 1) {
				$("code_info").innerHTML="<font color=\"green\">恭喜,验证码输入正确。</font>";
				return true;
			} else {
				$("code_info").innerHTML="<font color=\"red\">验证码输入有误</font>";
				document.myform.chk_code.focus();
				return false;
			}*/
		}

		return true;
	}

 //
  function chklogin(url,paras) {//updateElemIdArr
	var myAjax = new Ajax.Request(
    url,
    {
        method: 'get',
        parameters: paras,
        onComplete: function(obj) {
			chkloginFrm(obj)
		} // 用自定义函数
    });
  }
 function chkloginFrm(obj){
    var re = obj.responseText;
	var tmp = re.Trim().substring(0,re.length-1).split(',');
	var login_user = getObjValue('login_user').Trim();
	if(login_user.length == 0) {
		getObject('u_info').innerHTML="<font color=\"red\">用户名不能为空！</font>";
		document.frm.login_user.focus();
		return false;
	}
	if (!chkEmpty('login_password','p_info','密码不能为空！')) {
        document.frm.login_password.focus();
		return false;
	}
	if (!chkEmpty('chk_code','code_info','验证码不能为空！')) {
        document.frm.chk_code.focus();
		return false;
	}
    if (tmp[0]==1) {
		document.frm.submit();
    } else {
       $("code_info").innerHTML="<font color=\"red\">验证码输入有误！</font>";
	   return false;
	}
 }

  function getPwd(url,paras) {//updateElemIdArr
    
	var myAjax = new Ajax.Request(
    url,
    {
        method: 'get',
        parameters: paras,
        onComplete: function(obj) {
			chkPwdFrm(obj)
		} // 用自定义函数
    });
  }
  
  function chkPwdFrm(obj) 
  {
		var re = obj.responseText;
		var tmp = re.Trim().substring(0,re.length-1).split(',');
		var login_name = getObjValue('username').Trim();
		var act_pw=true;
		
		if(login_name.length == 0) {
			getObject('u_info').innerHTML="<font color=\"red\">用户名不能为空！</font>";
			
			document.myform.username.focus();
			
			act_pw=false;
			
			return false;
		}
		
		if(login_name.length < 2 || login_name.length > 14) {
			getObject('u_info').innerHTML="<font color=\"red\">用户名不符合要求</font>";
			document.myform.username.focus();
			act_pw=false;
			return false;
		}
		
		if (!chkEmpty('mailpw','e_info','邮箱不能为空!')) {
			document.myform.mailpw.focus();
			act_pw=false;
			return false;
		}
		
		if(re=='1,') { //表单正确提交
		   $("code_info").innerHTML="<font color=\"green\">恭喜,验证码输入正确！</font>";
		} else {
			$("code_info").innerHTML="<font color=\"red\">验证码输入有误！</font>";
			act_pw=false;
			return false;
		}
		
		if(act_pw)
		{
			 myform.submit();
		}
  }

  function getPwd2(url,paras) {//updateElemIdArr
    
	var myAjax = new Ajax.Request(
    url,
    {
        method: 'get',
        parameters: paras,
        onComplete: function(obj) {
			chkPwdFrm2(obj)
		} // 用自定义函数
    });
  }
  
  function chkPwdFrm2(obj) 
  {
		var re = obj.responseText;
		
		var tmp = re.Trim().substring(0,re.length-1).split(',');
		
		var login_name = getObjValue('pw').Trim();
		
		var login_name1 = getObjValue('pw1').Trim();
		
		var act_pw=true;
		
		if(login_name.length == 0) 
		{
			getObject('u_info').innerHTML="<font color=\"red\">密码不能为空！</font>";
			
			document.myform.pw.focus();
			
			act_pw=false;
			
			return false;
		}else{
			getObject('u_info').innerHTML="";
		}
		
		if(login_name1.length == 0)
		{
			getObject('u_info1').innerHTML="<font color=\"red\">确认密码不能为空！</font>";
			
			document.myform.pw1.focus();
			
			act_pw=false;
			
			return false;
		}else{
			if(login_name!=login_name1)
			{
				getObject('u_info1').innerHTML="<font color=\"red\">两次密码不统一！</font>";
			
				document.myform.pw1.focus();
				
				act_pw=false;
			
				return false;
			}else{
				getObject('u_info1').innerHTML="";
			}
		}
		
		if(re=='1,') //表单正确提交
		{
		   $("code_info").innerHTML="<font color=\"green\">恭喜,验证码输入正确！</font>";
		} else {
			$("code_info").innerHTML="<font color=\"red\">验证码输入有误！</font>";
			act_pw=false;
			return false;
		}
		
		if(act_pw)
		{
			 myform.submit();
		}
  }
  
  function regChk(url,paras) {//updateElemIdArr
    
	var myAjax = new Ajax.Request(
    url,
    {
        method: 'get',
        parameters: paras,
        onComplete: function(obj) {
			chkFrm(obj)
		} // 用自定义函数
    });
  }
  function chkFrm(obj){ 
		var re = obj.responseText;
		var tmp = re.Trim().substring(0,re.length-1).split(',');
		var login_name = getObjValue('login_name').Trim();
		if(login_name.length == 0) {
			getObject('u_info').innerHTML="<font color=\"red\">用户名不能为空</font>";
			document.myform.login_name.focus();
			return false;
		}
		if(login_name.length < 2 || login_name.length > 26) {
			getObject('u_info').innerHTML="<font color=\"red\">用户名不符合要求</font>";
			document.myform.login_name.focus();
			return false;
		}
		if (!chkEmpty('email','e_info','邮箱不能为空')) {
			document.myform.email.focus();
			return false;
		}
        
		if (!chkEmpty('login_password','p_info','密码不能为空')) {
           	document.myform.login_password.focus();
			return false;
		}
		if (!chkEmpty('relogin_pwd','p_info','密码不能为空')) {
           	document.myform.relogin_pwd.focus();
			return false;
		}
		chkpwd('relogin_pwd','p_info','两次密码不一致');
		
		if (!chkEmpty('chk_code','code_info','验证码不能为空')) {   
			document.myform.chk_code.focus();
			return false;
		} 
		
		if(tmp[0] ==2 && tmp[2]==6 && tmp[3]==8) { //表单正确提交
		   document.myform.submit();
		} else {
				if (tmp[0]==1) {
				   $("u_info").innerHTML="<font color=\"red\">此用户名已经被注册</font>";
				}
				if (tmp[0]==2) {
				   $("u_info").innerHTML="<font color=\"green\">此用户名可以注册</font>";
				}
				if(tmp[1]==4)  {
				   $("e_info").innerHTML="<font color=\"red\">邮箱格式不合法</font>";
				} 
                if (tmp[1]==5) {
				   $("e_info").innerHTML="<font color=\"red\">邮箱格式正确</font>";
				} 
				if (tmp[2]==3) {
				   $("e_info").innerHTML="<font color=\"red\">邮箱已被注册</font>";
				} 
				if (tmp[2]==6 && tmp[1] !=4) {
				   $("e_info").innerHTML="<font color=\"green\">此邮箱可以注册</font>";
				} 
				if (tmp[3]==7) {
					$("code_info").innerHTML="<font color=\"red\">验证码输入不正确</font>";
				}
				if (tmp[3]==8) {
				   $("code_info").innerHTML="<font color=\"green\">验证码输入正确</font>";
				}
			return false;
		}
	}

    function checkloginFrm() {
		if (document.getElementById("login_user").value.Trim().length<1 )
		{
           document.getElementById('u_info').innerHTML="<font color=\"red\">" + '用户名不能为空!' + "</font>";
		   return false
		}
		if (document.getElementById("login_password").value.Trim().length<1 )
		{
           document.getElementById('p_info').innerHTML="<font color=\"red\">" + '密码不能为空!' + "</font>";
		   return false
		}
		if (document.getElementById("chk_code").value.Trim().length<1 )
		{
           document.getElementById('code_info').innerHTML="<font color=\"red\">" + '验证码不能为空!' + "</font>";
		   return false
		}
		   return true;
	}
	function checkloginForm() {
		if (document.getElementById("login_user_1").value.Trim().length<1 )
		{
           document.getElementById('tn_info').innerHTML="<font color=\"red\">" + '用户名不能为空!' + "</font>";
		   return false
		}
		else 
		{
            document.getElementById('tn_info').innerHTML="";
		}
		if (document.getElementById("login_pwd_1").value.Trim().length<1)
		{
           document.getElementById('pwd_1_info').innerHTML="<font color=\"red\">" + '密码不能为空!' + "</font>";
		   return false
		}
	    else 
		{
            document.getElementById('pwd_1_info').innerHTML="";
		}
		return true
     
	}

	function checkGetPwdForm1() {

		var login_name = getObjValue('login_name').Trim();
		if(login_name.length < 3 || login_name.length > 12) {
			getObject('u_info').innerHTML="<font color=\"red\">用户名不符合要求（长度为３~１２位，允许字符：“_，a-z，A-Z，0-9”）！</font>";
			document.myform.login_name.focus();
			return false;
		}

		var user_password = getObjValue('user_password').Trim();
		if(!chkPwd('user_password','p_info')) {
			document.myform.user_password.focus();
			return false;
		}

		if(!chkRePwd('user_password','user_repass','p_info','re_p_info')) {
			document.myform.user_repass.focus();
			return false;
		}

		if (!chkEmpty('email','e_info','邮箱不能为空！')) {
			document.myform.email.focus();
			return false;
		}
		return true;
	}
//-----------------------------------BEGIN客户留言-------------------------------------//
	function chksendword(frm,url)
     {
     if ($F('nick_name')=='')
     {
		 $('nick_info').innerHTML = '用户昵称不能为空！';
		 $('nick_name').focus();
		 return false;
     }
	if ($F('email')=='')
	 {
		 $('email_info').innerHTML = '邮箱不能为空！';
		 $('email').focus();
		 return false;
	 }
	 if (!IsValidateEmail($F('email')))
	 {
		 $('email_info').innerHTML = '邮箱格式不正确！';
		 $('email').focus();
		 return false;
	 }
	 if ($F('title')=='')
	 {
		 $('title_info').innerHTML = '标题不能为空！';
		 $('title').focus();
		 return false;
	 } else if($F('title').length>10) {
		 $('title_info').innerHTML = '标题内容过长！';
		 $('title').focus();
		 return false;
	 }
	 if ($F('content')=='')
	 {
		$('content_info').innerHTML = '内容不能为空！';
		$('content').focus();
		return false;
	 }

     ajaxRequest(url,"post",frm,'','sendestat');
	 $('nick_info').innerHTML = '';
	 $('email_info').innerHTML = '';
     $('title_info').innerHTML = '';
	 $('content_info').innerHTML = '';
	 document.getElementById('sendmsgstat').disabled=true;  
     document.getElementById('sendmsgstat').src="../template/skin1/images/user/u8.8.gif";

  }
	/** 
	 * 判断是不是有效的email地址 
	 */ 
	function IsValidateEmail(str) { 
		//如果为空，则通过校验 
		if (str == "" || str.length == 0) { 
			return false; 
		} 
		//正则表达式 
		//var pattern = /^\w{1,}@[\.,\w]{1,}$/; 
		var pattern = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/; 
		if (!pattern.test(str)) { 
			return false; 
		} 
		return true; 
	} 
//-----------------------------------END客户留言-------------------------------------//
	function quitgroup(action,id) //退出群提示
	{
       if (confirm("您确定要退出该群吗?退出后不能再操作该群")) {
         href="groupmanage.php?do="+ action+ "&uid=" + id
         location.href=href
       }
	}
	function deletehint(action,id,outname) //踢出群提示
	{
       if (confirm("您确定要踢出该群友吗?踢出后不能再恢复")) {
         href ="groupmanage.php?do="+action+"&uid=" + id + '&outname=' + outname
         location.href=href
       }
	}
	function disbandgroup(action) //解散群提示
	{
		if(confirm("您确定要解散该群体吗?解散后不能再恢复")) {
         href ="groupmanage.php?do=" +action
         location.href=href
       }
	}
	function delthread(action,id) //删除主题提示
	{
		if (confirm("您确定要删除该主题吗?删除后不能再恢复")) {
         href ="threadmanage.php?do="+action+"&id="+id
         location.href=href
       }
	}
	function deltopic(action,id) //删除贴子提示
	{
		if (confirm("您确定要删除该贴子吗?删除后不能再恢复")) {
         href ="threadmanage.php?do="+action+"&id="+id
         location.href=href
		}
	}

//-----------------------BEGIN名称分区联动-------------------------//
function changegame(obj,paras) {//updateElemIdArr
    if (obj.value==0)
    {
		var serveridhtml = document.all["server_id"];
		serveridhtml.length=0;  //删除原有的
		serveridhtml.options.add(new Option("请选择分区",0));
		return false;
    } 
	url = 'state.php?action=getarea&game_id='+obj.value;
	var myAjax = new Ajax.Request(
    url,
    {
        method: 'get',
        parameters: paras,
        onComplete: function(obj) {
			getgamearea(obj)
		} // 用自定义函数
    });
  }
function getgamearea(obj){ 
  var re = obj.responseText;
  var arrytmp1 = re.Trim().substring(0,re.length-1).split(',');
  var serveridhtml = document.all["server_id"];
  serveridhtml.length=0;  //删除原有的
  for(var i=0;i<arrytmp1.length;i++) 
  {
     var arrytmp2= arrytmp1[i].split('|');
	 areaname = arrytmp2[1];
	 serveridhtml.options.add(new Option(areaname,i));
  }
}
//-----------------------END名称分区联动-------------------------//