function getForm()
{
      return document.free_register;
}

function checkVld(){
            var f=getForm();
            var uid;
            uid = f.user_name.value;
            email1 = f.email.value;
            email2 = f.email2.value;
            phone = f.telephone.value;
            name = f.full_name.value;
            add = f.address.value;
			
			if (uid=="")
				{
					alert( "Ban chua nhap ten truy cap !!!" );
					f.user_name.focus();
					return false;
				}
            if ( trim(uid)=="")
				{
					alert( "Ten truy nhap phai khac rong !!!" );
					f.user_name.focus();
					return false;
				}
            if ( !user(uid))
				{
					//alert( "Ten truy cap khong bat dau bang so hoac \n ky tu dac biet, khong co dau cach !!!" );
					f.user_name.focus();
					return false;
				}
            if (email1=="")
				{
					alert( "Ban chua nhap dia chi e-mail !!!" );
					f.email.focus();
					return false;
				}
            if(!CheckEmail(email1))
                {
                    //alert("Ban nhap sai dia chi e-mail");
                    f.email.focus();
                    return false;
                }
			if (email2=="")
				{
					alert( "Ban chua nhap lai dia chi e-mail !!!" );
					f.email2.focus();
					return false;
				}
            if (email1 != email2  )
				{
					alert( "Hai dia chi e-mail khau khong trung nhau, xin nhap lai !!!" );
					f.email.focus();
					return false;
				}
            if (phone=="")
				{
					alert( "Ban chua nhap so dien thoai !!!" );
					f.telephone.focus();
					return false;
				}
            if ( !isCharsInBag( phone, "0123456789 -" ))
				{
					alert( "So dien thoai khong hop le !!!" );
					f.telephone.focus();
					return false;
				}
            if (name=="")
				{
					alert( "Ban chua nhap ho va ten !!!" );
					f.full_name.focus();
					return false;
				}
            if ( trim(name)=="")
				{
					alert( "Ho va ten phai khac rong !!!" );
					f.full_name.focus();
					return false;
				}
            if (add=="")
				{
					alert( "Ban chua nhap dia chi !!!" );
					f.address.focus();
					return false;
				}
            if ( trim(add)=="")
				{
					alert( "Dia chi phai khac rong !!!" );
					f.address.focus();
					return false;
				}
            /* Optional */
			if (f.birthday.options[f.birthday.selectedIndex].value=="0")
				{
					alert( "Ban chua chon thong tin ngay sinh !!!" );
					f.birthday.focus();
					return false;
				}
			if (f.birthmonth.options[f.birthmonth.selectedIndex].value=="0")
				{
					alert( "Ban chua chon thong tin ngay sinh !!!" );
					f.birthmonth.focus();
					return false;
				}
			if (f.birthyear.options[f.birthyear.selectedIndex].value=="0")
				{
					alert( "Ban chua chon thong tin ngay sinh !!!" );
					f.birthyear.focus();
					return false;
				}
            if (!CheckDay(f.birthmonth.value, f.birthday.value, f.birthyear.value))
                {
                    alert("Ban nhap sai ngay sinh !!!");
                    f.birthday.focus();
                    return false;
                }
			if ((f.sex[0].checked==false) && (f.sex[1].checked==false))
				{
					alert( "Ban chua chon thong tin gioi tinh !!!" );
					f.sex[0].focus();
					return false;
				}
			if (f.id_profession.options[f.id_profession.selectedIndex].value=="0")
				{
					alert( "Ban chua chon thong tin nghe nghiep !!!" );
					f.id_profession.focus();
					return false;
				}
}

