function register() {		
	s = trimSpace($("#txtname").val());	
	if(s.length>100 || s==""){
		alert('Vui long nhap ho va ten!');
		$("#txtname").focus();
		return false;
	}
	d = trimSpace($("#drpDay").val());	
	m = trimSpace($("#drpMonth").val());
	y = trimSpace($("#txtYear").val());
	if(d==0 || m==0 || y==0){
		alert('Vui long nhap thong tin ngay sinh!');		
		return false;
	}
	
	if(trimSpace($("#selsex").val())==""){
		alert('Vui long chon gioi tinh!');
		$("#selsex").focus();
		return false;
	}
	if(trimSpace($("#txtadd1").val())==""){
		alert('Vui long nhap dia chi thuong tru!');
		$("#txtadd1").focus();
		return false;
	}
	if(trimSpace($("#txtadd2").val())==""){
		alert('Vui long nhap dia chi tam tru!');
		$("#txtadd2").focus();
		return false;
	}
	if(trimSpace($("#txtphone").val())==""){
		alert('Vui long nhap dien thoai lien lac!');
		$("#txtphone").focus();
		return false;
	}		
		if(trimSpace($("#txtculture").val())==""){
		alert('Vui long nhap trinh do van hoa!');
		$("#txtculture").focus();
		return false;
	}
		if(trimSpace($("#txtskill").val())==""){
		alert('Vui long nhap trinh do chuyen mon!');
		$("#txtskill").focus();
		return false;
	}
	if(trimSpace($("#txtspecial").val())==""){
		alert('Vui long nhap chuyen nganh!');
		$("#txtspecial").focus();
		return false;
	}
	if(trimSpace($("#txtforeign").val())==""){
		alert('Vui long nhap ngoai ngu!');
		$("#txtforeign").focus();
		return false;
	}
	if(trimSpace($("#txtlvforeign").val())==""){
		alert('Vui long nhap trinh do ngoai ngu!');
		$("#txtlvforeign").focus();
		return false;
	}
		if(trimSpace($("#txtunit").val())==""){
		alert('Vui long nhap don vi cong tac!');
		$("#txtunit").focus();
		return false;
	}
	if(trimSpace($("#txtunitadd").val())==""){
		alert('Vui long nhap dia chi cong tac!');
		$("#txtunitadd").focus();
		return false;
	}
	s = trimSpace($("#txtCode").val());	
	if(s==""){
		alert('Vui long nhap ma bao ve!');		
		$("#txtCode").focus();
		return false;
	}
	if(s!=""){		
		if (!checkCaptcha())
		return false;
	}
	if ($('input[id=checkagree]').is(':checked')==false)
	{
		alert('Ban chua dong y voi cac dieu khoan cua chung toi\nVui long dong y truoc khi thuc hien viec dang ky!');	
		return false;
	}	
	return true;
}

function checkCaptcha()
{
	var returnVal = false;
	$.ajax({
		  type: "POST",
		  url:  $('#txturl').val(),
		  	data: {'code': $('#txtCode').val()},
		  	async: false, 
		 	success: function(data) {	
				if (data=="no")
				{
					$('#trerror').attr('style', 'display:');
					$("#msgError").html("<font color=#bd0000>M&#227; b&#7843;o v&#7879; nh&#7853;p ch&#432;a &#273;&#250;ng</font>");
					returnVal = false;
				}
				else
				{
					$('#trerror').attr('style', 'display:none');
					$("#msgError").html("");
					returnVal = true;
				}		
		  	},
		  	error: function() {
				alert ('bi chi ri bay')
			}
		
		});
		return returnVal;	
}
