function checkInputIsEmpty(sIdName, alertName) {
	var obj = document.getElementById(sIdName);
	if (obj.value == '') {
		obj.focus();
		alert(alertName+'不能为空!');
		return true;
	}
	return false;
}
	
function checkForm() {

	var txt_name = document.getElementById('txt_name');
		
	if (checkInputIsEmpty('txt_name', '真实姓名')) return false;
	
	var txt_name_u = txt_name.value.length;
	if ( txt_name_u<2 || txt_name_u > 5 ){
		alert('真实姓名填写不正确！')
		txt_name.focus();
		return false;
	}else {
		var nameReg = /^([\u4E00-\u9FA5])*$/; 
		if(!nameReg.test(txt_name.value)) {
			alert('真实姓名只能为中文!');
			txt_name.focus();
			txt_name.select();
			return false;
		}
	}
	
	if (checkInputIsEmpty('txt_addr', '通讯地址')) return false;

	if (checkInputIsEmpty('txt_code', '邮政编码')) return false;
	var txt_code = document.getElementById('txt_code');
	if (txt_code.value.length !=6 ) {
		alert('邮政编码不正确!');
		txt_code.focus();
		txt_code.select();
		return false;
	}
	
	var oMobile = document.getElementById('txt_mobi');
	if (checkInputIsEmpty('txt_mobi', '手机号码')) return false;
	var oMobileReg = new RegExp(/^1(3|5|8)\d{9}$/);
	if (!oMobileReg.test(oMobile.value)) {
		alert('请输入正确的手机号码!');
		oMobile.focus();
		oMobile.select();
		return false;
	}
	
	
	if (checkInputIsEmpty('txt_email', 'Email')) return false;
	var oEmail = document.getElementById('txt_email');
	var oEmailReg = new RegExp(/^[0-9A-Z_]+@[0-9A-Z]+\.[0-9A-Z]+(\.[0-9A-Z]+)?$/i);
	if (checkInputIsEmpty('txt_email', 'Email')) return false;
	if (!oEmailReg.test(oEmail.value)) {
		alert('请输入正确的Email地址!');
		oEmail.focus();
		oEmail.select();
		return false;
	}
}
