// JavaScript Document
function check(obj){
	if(obj.UserName.value==""){
		alert("用户名不能为空!");
		obj.UserName.focus();
		obj.UserName.select();
		return false;
	}
	if(obj.UserName.value.length<2 || obj.UserName.value.length>20){
		alert("用户名2-20个字符!");
		obj.UserName.focus();
		obj.UserName.select();
		return false;
	}	
	if(obj.PassWord.value==""){
		alert("密码不能为空!");
		obj.PassWord.focus();
		obj.PassWord.select();
		return false;
	}
	if(obj.PassWord.value.length<4 || obj.PassWord.value.length>20){
		alert("密码4-20个字符!");
		obj.PassWord.focus();
		obj.PassWord.select();
		return false;
	}	
	if(obj.PassWord.value!=obj.RePassWord.value){
		alert("两次输入的密码不同!");
		obj.PassWord.focus();
		obj.PassWord.select();
		return false;
	}
	if(!checkemail(obj.Email.value)){
			alert("请填写正确的邮箱地址！");
			obj.Email.focus();
			obj.Email.select();
			return false;
	}
	if(obj.CheckCode.value==""){
		alert("验证码不能为空!");
		obj.CheckCode.focus();
		obj.CheckCode.select();
		return false;
	}
	return true;
}
function checkemail(semail){
	var pattern = /^([\.a-zA-Z0-9_-]){3,}@([\.a-zA-Z0-9_-]){2,}(\.([a-zA-Z0-9]){2,4}){1,2}$/; 
	return pattern.test(semail);
}
function checkUser(obj){	
		var resultTxt="";
		var oHttp;	
		if(window.ActiveXObject){
			oHttp=new ActiveXObject("Microsoft.XMLHTTP");		
		}
		else if(window.XMLHttpRequest){
			oHttp=new XMLHttpRequest();		
		}
		if(oHttp){
			oHttp.onreadystatechange = function () {
				if (oHttp.readyState == 4){
					resultTxt = oHttp.responseText;
					document.getElementById('userMsg').innerHTML=resultTxt;
				}
			};
			oHttp.open("POST","user.asp?uid="+obj.value, true);
			oHttp.send("");				
		}		
}
function checkEmailExits(obj){	
		var resultTxt="";
		var oHttp;	
		if(checkemail(obj.value)){
		if(window.ActiveXObject){
			oHttp=new ActiveXObject("Microsoft.XMLHTTP");		
		}
		else if(window.XMLHttpRequest){
			oHttp=new XMLHttpRequest();		
		}
		if(oHttp){
			oHttp.onreadystatechange = function () {
				if (oHttp.readyState == 4){
					resultTxt = oHttp.responseText;
					document.getElementById('emailMsg').innerHTML=resultTxt;
				}
			};
			oHttp.open("POST","email.asp?email="+obj.value, true);
			oHttp.send("");				
		}
		}else{
			document.getElementById('emailMsg').innerHTML='您输入的邮箱地址不正确';
		}	
}
function selectcity(provinceid,cityid){	
			var citySelect=document.getElementById(cityid);
			citySelect.options.length = 0;		
			var xmlhttp;	 
			xmlhttp=getXMLRequester();	
			//alert(xmlhttp);
			if(xmlhttp){	
				xmlhttp.onreadystatechange = function doAction() {		
					if (xmlhttp.readyState == 4)
					{			
						/*alert(xmlhttp.responseText);*/				
						var response = xmlhttp.responseXML.documentElement;
						var classidList = response.getElementsByTagName('city');	
						
						for(var i=0;i<classidList.length;i++){
							xx=classidList[i].getElementsByTagName('id');
							yy=classidList[i].getElementsByTagName('title');
							classid=xx[0].firstChild.data
							classtitle=yy[0].firstChild.data				
							citySelect.options[i]=new Option(classtitle,classtitle);							
							if(cityid==classtitle){
								citySelect.options[i].selected=true;
							}
						}
					}
				};
				xmlhttp.open("POST", "/member/get_citys.asp?pid="+provinceid,true);
				xmlhttp.send("");
			}
}////////////////////////	