function checkcode(){
	getinfo();
	var xmlhttp;
	try{
		xmlhttp=new XMLHttpRequest();
		}
	catch(e){
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	xmlhttp.onreadystatechange=function(){
	if (xmlhttp.readyState==4){
		if (xmlhttp.status==200){
			var data=xmlhttp.responseText;
			code_result(data);
			}
		else{
			$div(thisname).innerHTML="验证码校验失败,请联系管理员";
			}
		}
	else{
		$div(thisname).innerHTML="正在进行验证码校验...";
		}
	}
	xmlhttp.open("post", "check_code.asp", true);
	xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
	xmlhttp.send("regcode="+escape(thisinfo));
}
function code_result(data){
	if(data==1){
		$val("checkcodes_txt").innerHTML='<img src="images/reg_yesok.gif"/> 验证码正确';
		$val("checkcodes_txt").className="rig";
		flag[18]=1;
		check_data();
		}
	else{
		$val("checkcodes_txt").innerHTML='<img src="images/reg_yesno.gif"/> 验证码错误';
		$val("checkcodes_txt").className="err";
		flag[18]=0;
		check_data();
		}
}
	
//--------------------------------------------------------------------
function checkid(regid){	
	var xmlhttp;
	try{
		xmlhttp=new XMLHttpRequest();
		}
	catch(e){
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	xmlhttp.onreadystatechange=function(){
	if (xmlhttp.readyState==4){
		if (xmlhttp.status==200){
			var data=xmlhttp.responseText;
			id_result(data);
			}
		else{
			$("span")[10].innerHTML="用户名检测失败,请联系管理员";
			}
		}
	else{
		$("span")[10].innerHTML="正在进行用户名校验...";
		}
	}
	xmlhttp.open("post", "reg_check.asp", true);
	xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
	xmlhttp.send("regid="+escape(regid));
}
function id_result(data){
	var resultbox=$("span")[10];
	if(data==1){
		resultbox.innerHTML='<img src="images/reg_yesok.gif"/> 用户名可用';
		flag[4]=1;
		check_data();
		}
	else{
		resultbox.innerHTML='<img src="images/reg_yesno.gif"/> 该用户名已经被注册';
		flag[4]=0;
		check_data();
	}
}

//--------------------------------------------------------------------
function sendinfo(regname,pwd,email,problem,Answer,UserName,Age,IdentityNO,Phone,Telephone,address,Sex){
	var xmlhttp;
	try{
		xmlhttp=new XMLHttpRequest();
		}
	catch(e){
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	xmlhttp.onreadystatechange=function(){
	if (xmlhttp.readyState==4){
		if (xmlhttp.status==200){
			var data=xmlhttp.responseText;
			reg_result(data);
			}
		else{
			$("span")[24].innerHTML="注册失败,请联系管理员";
			}
		}
	else{
		$("span")[24].innerHTML="正在进行用户名注册...";
		}
	}
	xmlhttp.open("post", "reg.asp", true);
	xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
	xmlhttp.send("regname="+escape(regname)+"&pwd="+escape(pwd)+"&email="+escape(email)+"&problem="+escape(problem)+"&Answer="+escape(Answer)+"&UserName="+escape(UserName)+"&Age="+escape(Age)+"&IdentityNO="+escape(IdentityNO)+"&Phone="+escape(Phone)+"&Telephone="+escape(Telephone)+"&address="+escape(address)+"&Sex="+escape(Sex));
}
function reg_result(data){
	if(data==1){
		//$("span")[14].innerHTML='<a href="login.asp" target="_blank">'+$("input")[0].value+",注册成功!</a>";
		srcs.src=srcs.src+'?'+Math.random();
		top.location.href='Registration.asp?action=suc';
		}
	else{
		$("span")[24].innerHTML="注册失败,请联系管理员";
	}
	}