function checkformadmin()
{
	if(!testSpaceBar(document.getElementById('admin_name')))
	{
		alert('Chưa nhập tên');
		document.getElementById('admin_name').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('admin_pass')))
	{
		alert('Chưa nhập mật khẩu');
		document.getElementById('admin_pass').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('retype_pass')))
	{
		alert('Chưa nhập lại mật khẩu');
		document.getElementById('retype_pass').focus();
		return false;
	}
	if((document.getElementById('admin_pass').value) != (document.getElementById('retype_pass').value))
	{
		alert('Nhập lại mật khẩu không chính xác')
		document.getElementById('retype_pass').focus();
		return false;
	}
}

function checkchangeadmin()
{
	if(!testSpaceBar(document.getElementById('admin_name')))
	{
		alert('Chưa nhập tên');
		document.getElementById('admin_name').focus();
		return false;
	}
}

function checkchangepass()
{
	if(!testSpaceBar(document.getElementById('admin_pass')))
	{
		alert('Chưa nhập mật khẩu mới');
		document.getElementById('admin_pass').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('retype_pass')))
	{
		alert('Chưa nhập lại mật khẩu mới');
		document.getElementById('retype_pass').focus();
		return false;
	}
	if((document.getElementById('admin_pass').value) != (document.getElementById('retype_pass').value))
	{
		alert('Nhập lại mật khẩu mới không chính xác')
		document.getElementById('retype_pass').focus();
		return false;
	}
}

function checkaddabout()
{
	if(!testSpaceBar(document.getElementById('subject')))
	{
		alert('Chưa nhập tiêu đề');
		document.getElementById('subject').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('position')))
	{
		alert('Chưa nhập thứ tự');
		document.getElementById('position').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('position').value))
	{
		alert('Thự tự nhập vào phải là số');
		document.getElementById('position').focus();
		return false;
	}
}


function checkformcategory()
{
	if(!testSpaceBar(document.getElementById('category_name')))
	{
		alert('Chưa nhập tên');
		document.getElementById('category_name').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('category_position')))
	{
		alert('Chưa nhập số thứ tự');
		document.getElementById('category_position').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('category_position').value))
	{
		alert('Thự tự nhập vào phải là số');
		document.getElementById('category_position').focus();
		return false;
	}
}

function checkformarticle() {
	if(!testSpaceBar(document.getElementById('cat_01')))
	{
		alert('Chưa chọn danh mục cấp 1');
		document.getElementById('cat_01').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('cat_02')))
	{
		alert('Chưa chọn danh mục cấp 2');
		document.getElementById('cat_02').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('cat_03')))
	{
		alert('Chưa chọn danh mục cấp 3');
		document.getElementById('cat_03').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('article_subject')))
	{
		alert('Chưa nhập tiêu đề');
		document.getElementById('article_subject').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('article_position')))
	{
		alert('Chưa nhập thứ tự');
		document.getElementById('article_position').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('article_position').value))
	{
		alert('Thự tự nhập vào phải là số');
		document.getElementById('article_position').focus();
		return false;
	}
	
//	var alen=document.addarticle.elements.length;
//	var isChecked=false;
//	alen=(alen>4)?document.addarticle.category_id.length:0;
//	if (alen>0){
//		for(var i=0;i<alen;i++)
//			if (document.addarticle.category_id[i].checked==true)
//				
//				isChecked=true;
//	}
//	else {
//		if(document.addarticle.category_id.checked==true)
//			isChecked=true;
//	}
//	if(!isChecked){
//		alert("Hãy Chọn Một Danh Mục Tin.");
//	}
//	return isChecked;
}

function checkformadv() {
	if ((document.getElementById('advertise_position_1').value == "") && (document.getElementById('advertise_position_2').value == "") && (document.getElementById('advertise_position_3').value == "")) {
		alert('Chưa chọn vị trí');
		document.getElementById('advertise_position_1').focus();
		return false;
	}
	if (document.getElementById('advertise_img').value == "") {
		alert('Chưa chọn hình ảnh');
		document.getElementById('advertise_img').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('advertise_order')))
	{
		alert('Chưa nhập số thứ tự');
		document.getElementById('advertise_order').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('advertise_order').value))
	{
		alert('Thự tự nhập vào phải là số');
		document.getElementById('advertise_order').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('advertise_width')))
	{
		alert('Chưa nhập chiều rộng');
		document.getElementById('advertise_width').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('advertise_width').value))
	{
		alert('Chiều rộng nhập vào phải là số');
		document.getElementById('advertise_width').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('advertise_height')))
	{
		alert('Chưa nhập chiều cao');
		document.getElementById('advertise_height').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('advertise_height').value))
	{
		alert('Chiều cao nhập vào phải là số');
		document.getElementById('advertise_height').focus();
		return false;
	}
	
}
function checkformeditadv() {
	if ((document.getElementById('advertise_position_1').value == "") && (document.getElementById('advertise_position_2').value == "") && (document.getElementById('advertise_position_3').value == "")) {
		alert('Chưa chọn vị trí');
		document.getElementById('advertise_position_1').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('advertise_order')))
	{
		alert('Chưa nhập số thứ tự');
		document.getElementById('advertise_order').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('advertise_order').value))
	{
		alert('Thự tự nhập vào phải là số');
		document.getElementById('advertise_order').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('advertise_width')))
	{
		alert('Chưa nhập chiều rộng');
		document.getElementById('advertise_width').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('advertise_width').value))
	{
		alert('Chiều rộng nhập vào phải là số');
		document.getElementById('advertise_width').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('advertise_height')))
	{
		alert('Chưa nhập chiều cao');
		document.getElementById('advertise_height').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('advertise_height').value))
	{
		alert('Chiều cao nhập vào phải là số');
		document.getElementById('advertise_height').focus();
		return false;
	}
	
}
function checkcatonline() {
	if(!testSpaceBar(document.getElementById('c_online_name')))
	{
		alert('Chưa nhập tên');
		document.getElementById('c_online_name').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('c_online_order')))
	{
		alert('Chưa nhập thứ tự');
		document.getElementById('c_online_order').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('c_online_order').value))
	{
		alert('Thứ tự nhập vào phải là số');
		document.getElementById('c_online_order').focus();
		return false;
	}
}
function checkformonline() {
	if(!testSpaceBar(document.getElementById('c_online_id')))
	{
		alert('Chưa chọn nhóm tư vấn');
		document.getElementById('c_online_id').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('online_name')))
	{
		alert('Chưa nhập tên');
		document.getElementById('online_name').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('online_nick')))
	{
		alert('Chưa nhập nick yahoo');
		document.getElementById('online_nick').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('online_mobile').value))
	{
		alert('Mobile nhập vào phải là số');
		document.getElementById('online_mobile').focus();
		return false;
	}
	if(!validEmail(document.getElementById('online_email')))
	{
		alert('Email không hợp lệ');
		document.getElementById('online_email').focus();
		return false;
	}
	
}
function checkformlh() {	
	if(!testSpaceBar(document.getElementById('fullname')))
	{
		alert('Chưa nhập tên');
		document.getElementById('fullname').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('address')))
	{
		alert('Chưa nhập địa chỉ');
		document.getElementById('address').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('phone')))
	{
		alert('Chưa nhập điện thoại');
		document.getElementById('phone').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('phone').value))
	{
		alert('Điện thoại nhập vào phải là số');
		document.getElementById('phone').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('mobile').value))
	{
		alert('Di động nhập vào phải là số');
		document.getElementById('mobile').focus();
		return false;
	}
	if(!validEmail(document.getElementById('email')))
	{
		alert('Email không hợp lệ');
		document.getElementById('email').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('captcha')))
	{
		alert('Chưa nhập mã xác nhận');
		document.getElementById('captcha').focus();
		return false;
	}
	var alen=document.contact.elements.length;
	var isChecked=false;
	alen=(alen>4)?document.contact.dichvu.length:0;
	if (alen>0){
		for(var i=0;i<alen;i++)
			if (document.contact.dichvu[i].checked==true)
				
				isChecked=true;
	}
	else {
		if(document.contact.dichvu.checked==true)
			isChecked=true;
	}
	if(!isChecked){
		alert("Chưa chọn dịch vụ");
	}
	return isChecked;
}

function checkthionline()
{
	if(!testSpaceBar(document.getElementById('fullname')))
	{
		alert('Chưa nhập tên');
		document.getElementById('fullname').focus();
		return false;
	}
	if(!validEmail(document.getElementById('email')))
	{
		alert('Email không hợp lệ');
		document.getElementById('email').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('monthi_id')))
	{
		alert('Chưa chọn môn thi');
		document.getElementById('monthi_id').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('trinhdo_id')))
	{
		alert('Chưa chọn trình độ');
		document.getElementById('trinhdo_id').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('dethi_id')))
	{
		alert('Chưa chọn đề thi');
		document.getElementById('dethi_id').focus();
		return false;
	}
}

function checkmonthi()
{
	if(!testSpaceBar(document.getElementById('monthi_name')))
	{
		alert('Chưa nhập tên');
		document.getElementById('monthi_name').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('monthi_order')))
	{
		alert('Chưa nhập số thứ tự');
		document.getElementById('monthi_order').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('monthi_order').value))
	{
		alert('Thự tự nhập vào phải là số');
		document.getElementById('monthi_order').focus();
		return false;
	}
}

function checktrinhdo()
{
	if(!testSpaceBar(document.getElementById('trinhdo_name')))
	{
		alert('Chưa nhập tên');
		document.getElementById('trinhdo_name').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('trinhdo_order')))
	{
		alert('Chưa nhập số thứ tự');
		document.getElementById('trinhdo_order').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('trinhdo_order').value))
	{
		alert('Thự tự nhập vào phải là số');
		document.getElementById('trinhdo_order').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('trinhdo_thoigianthi')))
	{
		alert('Chưa nhập thời gain thi');
		document.getElementById('trinhdo_thoigianthi').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('trinhdo_thoigianthi').value))
	{
		alert('Thời gian nhập vào phải là số');
		document.getElementById('trinhdo_thoigianthi').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('trinhdo_socaudo')))
	{
		alert('Chưa nhập số câu đỗ');
		document.getElementById('trinhdo_socaudo').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('trinhdo_socaudo').value))
	{
		alert('Số câu đỗ nhập vào phải là số');
		document.getElementById('trinhdo_socaudo').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('trinhdo_socauhoi')))
	{
		alert('Chưa nhập số câu trong đề thi');
		document.getElementById('trinhdo_socauhoi').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('trinhdo_socauhoi').value))
	{
		alert('Số câu trong đề thi nhập vào phải là số');
		document.getElementById('trinhdo_socauhoi').focus();
		return false;
	}
}

function checkdethi()
{
	if(!testSpaceBar(document.getElementById('monthi_id')))
	{
		alert('Chưa chọn môn thi');
		document.getElementById('monthi_id').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('trinhdo_id')))
	{
		alert('Chưa chọn trình độ');
		document.getElementById('trinhdo_id').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('dethi_name')))
	{
		alert('Chưa nhập tên');
		document.getElementById('dethi_name').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('dethi_order')))
	{
		alert('Chưa nhập số thứ tự');
		document.getElementById('dethi_order').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('dethi_order').value))
	{
		alert('Thự tự nhập vào phải là số');
		document.getElementById('dethi_order').focus();
		return false;
	}
}

function checkcauhoi()
{
	if(!testSpaceBar(document.getElementById('monthi_id')))
	{
		alert('Chưa chọn môn thi');
		document.getElementById('monthi_id').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('trinhdo_id')))
	{
		alert('Chưa chọn trình độ');
		document.getElementById('trinhdo_id').focus();
		return false;
	}	
	if(!testSpaceBar(document.getElementById('cauhoi_dapan')))
	{
		alert('Chưa nhập đáp án');
		document.getElementById('cauhoi_dapan').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('cauhoi_dapan').value))
	{
		alert('Đáp án nhập vào phải là số');
		document.getElementById('cauhoi_dapan').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('cauhoi_order')))
	{
		alert('Chưa nhập số câu hỏi');
		document.getElementById('cauhoi_dapan').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('cauhoi_order').value))
	{
		alert('Số câu hỏi vào phải là số');
		document.getElementById('cauhoi_dapan').focus();
		return false;
	}
}

function checkeditcauhoi()
{
	if(!testSpaceBar(document.getElementById('monthi_id')))
	{
		alert('Chưa chọn môn thi');
		document.getElementById('monthi_id').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('trinhdo_id')))
	{
		alert('Chưa chọn trình độ');
		document.getElementById('trinhdo_id').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('cauhoi_dapan')))
	{
		alert('Chưa nhập đáp án');
		document.getElementById('cauhoi_dapan').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('cauhoi_dapan').value))
	{
		alert('Đáp án nhập vào phải là số');
		document.getElementById('cauhoi_dapan').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('cauhoi_order')))
	{
		alert('Chưa nhập số câu hỏi');
		document.getElementById('cauhoi_dapan').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('cauhoi_order').value))
	{
		alert('Số câu hỏi nhập vào phải là số');
		document.getElementById('cauhoi_dapan').focus();
		return false;
	}
}

function checknophoso()
{
	if(!testSpaceBar(document.getElementById('address')))
	{
		alert('Chưa nhập địa chỉ liên lạc');
		document.getElementById('address').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('phone')))
	{
		alert('Chưa nhập điện thoại');
		document.getElementById('phone').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('phone').value))
	{
		alert('Điện thoại nhập vào phải là số');
		document.getElementById('phone').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('mobile').value))
	{
		alert('Di động nhập vào phải là số');
		document.getElementById('mobile').focus();
		return false;
	}
	
	if(!testSpaceBar(document.getElementById('birthday')))
	{
		alert('Chưa nhập ngày sinh');
		document.getElementById('birthday').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('cmnd')))
	{
		alert('Chưa nhập CMND');
		document.getElementById('cmnd').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('cmnd').value))
	{
		alert('CMND nhập vào phải là số');
		document.getElementById('cmnd').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('ngaycap')))
	{
		alert('Chưa nhập ngày cấp CMND');
		document.getElementById('ngaycap').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('noicap')))
	{
		alert('Chưa nhập nơi cấp CMND');
		document.getElementById('noicap').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('hokhauthuongtru')))
	{
		alert('Chưa nhập hộ khẩu thường trú');
		document.getElementById('hokhauthuongtru').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('thoigianthi')))
	{
		alert('Chưa nhập thời gian thi');
		document.getElementById('thoigianthi').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('chieucao').value))
	{
		alert('Chiều cao nhập vào phải là số');
		document.getElementById('chieucao').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('cannang').value))
	{
		alert('Cân nặng nhập vào phải là số');
		document.getElementById('cannang').focus();
		return false;
	}
}

function checkTK01()
{
	if(!testSpaceBar(document.getElementById('search_1_name')))
	{
		alert('Chưa nhập tên');
		document.getElementById('search_1_name').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('title_col1')))
	{
		alert('Chưa nhập cột 01');
		document.getElementById('title_col1').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('title_col2')))
	{
		alert('Chưa nhập cột 02');
		document.getElementById('title_col2').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('title_col3')))
	{
		alert('Chưa nhập cột 03');
		document.getElementById('title_col3').focus();
		return false;
	}
	
	if(!testSpaceBar(document.getElementById('title_col4')))
	{
		alert('Chưa nhập cột 04');
		document.getElementById('title_col4').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('title_col5')))
	{
		alert('Chưa nhập cột 05');
		document.getElementById('title_col5').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('search_1_position')))
	{
		alert('Chưa nhập thứ tự');
		document.getElementById('search_1_position').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('search_1_position').value))
	{
		alert('Số thứ tự nhập vào phải là số');
		document.getElementById('search_1_position').focus();
		return false;
	}
}

function checkTK02()
{
	if(!testSpaceBar(document.getElementById('search_1_id')))
	{
		alert('Chưa chọn cấp 01');
		document.getElementById('search_1_id').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('search_2_name')))
	{
		alert('Chưa nhập tên');
		document.getElementById('search_2_name').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('search_2_position')))
	{
		alert('Chưa nhập thứ tự');
		document.getElementById('search_2_position').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('search_2_position').value))
	{
		alert('Số thứ tự nhập vào phải là số');
		document.getElementById('search_2_position').focus();
		return false;
	}
}

function checkTK03()
{
	if(!testSpaceBar(document.getElementById('search_1_id')))
	{
		alert('Chưa chọn cấp 01');
		document.getElementById('search_1_id').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('search_2_id')))
	{
		alert('Chưa chọn cấp 02');
		document.getElementById('search_2_id').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('search_3_name')))
	{
		alert('Chưa nhập tên');
		document.getElementById('search_3_name').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('search_3_position')))
	{
		alert('Chưa nhập thứ tự');
		document.getElementById('search_3_position').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('search_3_position').value))
	{
		alert('Số thứ tự nhập vào phải là số');
		document.getElementById('search_3_position').focus();
		return false;
	}
}

function addsearch() {
	if(!testSpaceBar(document.getElementById('search_1_id')))
	{
		alert('Chưa chọn danh mục cấp 1');
		document.getElementById('search_1_id').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('search_2_id')))
	{
		alert('Chưa chọn danh mục cấp 2');
		document.getElementById('search_2_id').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('search_col3')))
	{
		alert('Chưa nhập cột 03');
		document.getElementById('search_col3').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('search_col4')))
	{
		alert('Chưa nhập cột 04');
		document.getElementById('search_col4').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('search_col5')))
	{
		alert('Chưa nhập cột 05');
		document.getElementById('search_col5').focus();
		return false;
	}
}

function enterSearch() {
	if(!testSpaceBar(document.getElementById('search_1_id')))
	{
		alert('Hãy chọn một dịch vụ');
		document.getElementById('search_1_id').focus();
		return false;
	}
}


function checkcatcontact() {
	if(!testSpaceBar(document.getElementById('category_contact_name')))
	{
		alert('Chưa nhập tên');
		document.getElementById('category_contact_name').focus();
		return false;
	}
	if(!testSpaceBar(document.getElementById('category_contact_position')))
	{
		alert('Chưa nhập thứ tự');
		document.getElementById('category_contact_position').focus();
		return false;
	}
	if(!isValideNumber(document.getElementById('category_contact_position').value))
	{
		alert('Thứ tự nhập vào phải là số');
		document.getElementById('category_contact_position').focus();
		return false;
	}
}


