﻿function fetchimg(){var req1=asynreq("/vpic",function(req1){if(req1.readyState!=4)return;var errnum=err(req1.responseXML);if(errnum==0){var result=fc(fc(req1.responseXML));d.getElementById("id_register_validation_pic").src="/validation3/"+value(result)+".jpg";d.getElementById("id_register_validation_pic")._code=value(result);}else{} });return false;}
ael("id_register_validation_change","click",fetchimg);
function registergo(){
	var o9=str0(_id("r_invitecode").value);var o1=str0(_id("r_email").value);var o2=_id("r_password").value;var o3=_id("r_password2").value;var o4=str0(_id("r_name").value);var sex="";if(_id("sex1").checked)sex=1;else if(_id("sex2").checked)sex=2;var birthyear=_id("birthyear").value;var address=str0(_id("r_address").value);
	if(o9.length==0){showError("您必须输入邀请码！","r_invitecode");return;}
	if(o1.length==0){showError("您必须输入电子邮箱！","r_email");return;}
	if(!emailok(o1)){showError("您输入的电子邮箱格式不正确！","r_email");return;}
	if(o4.length==0){showError("您的昵称不能为空！","r_name");return;}
	if(o2.length<6){showError("密码长度不能小于6！","r_password");return;}
	if(o2!=o3){showError("两次密码输入不一致！","r_password2");return;}
	if(sex==""){showError("请选择性别！","sex1");return;}
	if(birthyear==0){showError("请选择出生年份！","birthyear");return;}
	if(address==""){showError("请输入当前所居住的地址！","r_address");return;}
	if(address.length<4){showError("您输入的当前所居住的地址不正确！","r_address");return;}
	if(!confirm("电子邮箱一经注册就不能修改。请确认下面的邮箱拼写正确且是你想要注册的邮箱：\n\n"+o1+" \n\n点击“确认”继续，“取消”修改邮箱！"))return;
	mask();
	var req1=asynreq2("/registerit","invitecode="+o9+"&email="+o1
			+"&password="+o2
			+"&name="+o4
			+"&sex="+sex
			+"&birthyear="+birthyear
			+"&address="+encodeURIComponent(address)
			+"&t="+_id("id_register_validation_text").value
			+"&f="+_id("id_register_validation_pic")._code
			+"&ep=2"
			+"&friendid="+get_search_arg("friendid"), function(req1){
		if(req1.readyState!=4)return;
		var errnum=err(req1.responseXML);unmask();
		if(errnum==0){
			var user=o1;var password=o2;
			setCookie("a",user,"Sun, 17-Jan-2038 19:14:07 GMT","/","linjunet.com");setCookie("p",en64(password+":Y"),"Sun, 17-Jan-2038 19:14:07 GMT","/","linjunet.com");
			window.location.replace("/loginme?r="+encodeURIComponent("/addphoto"));
		}
		else if(errnum==1){fetchimg();_id("id_register_validation_text").value="";showError("对不起，你输入的邀请码不正确或者已经过期！请 <a href='/getinvitecode'>点击这里重新申请邀请码&#187;</a>","r_invitecode");}
		else if(errnum==5){fetchimg();_id("id_register_validation_text").value="";showError("对不起，你提供的电子邮箱未被邻居网收录，暂不能使用此邀请码！请 <a href='/getinvitecode'>点击这里重新申请邀请码&#187;</a>","r_invitecode");}
		else if(errnum==2){fetchimg();_id("id_register_validation_text").value="";showError("对不起，该电子邮箱已经注册过了！","r_email");}
		else if(errnum==3){showError("验证码错误，请重新输入！","id_register_validation_text");}
		else if(errnum==4){fetchimg();_id("id_register_validation_text").value="";showError("对不起，邻居网检测到您当前的ip在近1小时内注册了过多次数！请一个小时候后再试！","");}
		else showError("对不起，注册失败！","r_email");
	});
}
fetchimg();