function delPointAdmin()
{
	var n_speciality_id = document.getElementById('n_speciality_id').value;
	var n_lesson_id = document.getElementById('n_lesson_id').value;
	var n_calendar_id = document.getElementById('n_calendar_id').value;

	var codition = '&n_speciality_id=' + n_speciality_id + '&n_lesson_id=' + n_lesson_id + '&n_calendar_id=' + n_calendar_id;
	deleteGeneral('admin_subject_point', 'show_point', codition);
}

function updateResultAdmin()
{
	var oForm = document.admin_form;
	var n_speciality_id = document.getElementById('n_speciality_id').value;
	var n_lesson_id = document.getElementById('n_lesson_id').value;
	var n_calendar_id = document.getElementById('n_calendar_id').value;
	var arr_result_id = oForm.arr_result_id;
	var arr_point = oForm.arr_point;

	//var arr_n_result = oForm.arr_n_result;
	var arr_s_user_id = oForm.arr_s_user_id;

	var pars = 'n_speciality_id=' + n_speciality_id + '&n_lesson_id=' + n_lesson_id + '&n_calendar_id=' + n_calendar_id + '&action=update';
	var j = 0;
	var url = "index.php?do=admin_subject_point";
	if(arr_result_id != null)
	{
		var length = arr_result_id.length;

		if(length == null)
		{
			pars += '&result_id_' + j + '=' + arr_result_id.value;
			pars += '&point_' + j + '=' + arr_point.value;

			pars += '&s_user_id_' + j + '=' + arr_s_user_id.value;
			//pars += '&n_result_' + j + '=' + arr_n_result.value;
			
			j++;
			pars += '&count=' + j;
			
			ShowDivGeneral(url, pars, 'show_point');					
		}
		else
		{

			for(var i=0; i<length; i++)
			{
				pars += '&result_id_' + j + '=' + arr_result_id[i].value;
				pars += '&point_' + j + '=' + arr_point[i].value;

				pars += '&s_user_id_' + j + '=' + arr_s_user_id[i].value;
				//pars += '&n_result_' + j + '=' + arr_n_result[i].value;
				
				j++;
			}
			pars += '&count=' + j;

			ShowDivGeneral(url, pars, 'show_point');			
		}
	}
	else
		alert('Chưa có dữ liệu');	
}
function selectedCalendarAdmin(n_calendar_id, n_lesson_id, s_lesson_name, s_term_name, s_exam_type_name, dt_start_date, dt_end_date, n_speciality_id)
{
	var oForm = opener.document.admin_form;
	
	oForm.n_calendar_id.value = n_calendar_id;
	oForm.n_lesson_id.value = n_lesson_id;

	oForm.n_speciality_id.value = n_speciality_id;
	
	opener.document.getElementById('s_calendar_info').innerHTML = "Môn: " + s_lesson_name + " - Học kỳ: " + s_term_name + " - Lần thi: " + s_exam_type_name + " - Ngày Giờ bắt đầu: " + dt_start_date + " - Ngày Giờ kết thúc: " + dt_end_date ;
	self.close();
	
	if(oForm.btnEnter)
		oForm.btnEnter.disabled = false;

	
	//var pars = "n_calendar_id=" + n_calendar_id + "&n_lesson_id=" + n_lesson_id + "&n_speciality_id=" + n_speciality_id + "&action=search";

	//ShowDivGeneralOpener('index.php?do=admin_subject_point', pars, 'show_point');
    
}
function enterPoint()
{
	var n_calendar_id = document.getElementById('n_calendar_id').value;
	var n_lesson_id = document.getElementById('n_lesson_id').value;
	var n_speciality_id = document.getElementById('n_speciality_id').value;
	
	var pars = "n_calendar_id=" + n_calendar_id + "&n_lesson_id=" + n_lesson_id + "&n_speciality_id=" + n_speciality_id + "&action=search";
	
	ShowDivGeneral('index.php?do=admin_subject_point', pars, 'show_point');
	
}
function selectCalendar()
{
	//var url = "index.php?do=admin_subject_point&action=select";
	if(document.getElementById('btnEnter') != null)
		document.getElementById('btnEnter').disabled = 'disabled';

	var url = "index.php?do=select_calendar&action=select";
	
	openChild(url, 'win2');
	//window.open(url,'winReport','width=400,height=450,left=100,top=100,menubar=0,toolbar=0,statu s=0,scrollbars=1,resizable=0,titlebar=0');	

}
function showPointAdmin()
{
	var n_calendar_id = opener.document.admin_form.n_calendar_id.value;
	var n_lesson_id = opener.document.admin_form.n_lesson_id.value;

	var url = "index.php?do=admin_subject_point";	
	var pars = 'n_calendar_id=' + n_calendar_id + '&n_lesson_id=' + n_lesson_id + '&action=search&index_paging=1';
	ShowDivGeneralOpener(url, pars, 'show_point');
}

function selectedLessonAdmin(n_calendar_id, n_lesson_id, s_lesson_name, s_term_name, s_exam_type_name, dt_start_date, dt_end_date, n_speciality_id)
{
	var url = "index.php?do=print_point_lesson_admin";
	var s_calendar_info = "Môn: " + s_lesson_name + " - Học kỳ: " + s_term_name + " - Lần thi: " + s_exam_type_name + " - Ngày Giờ bắt đầu: " + dt_start_date + " - Ngày Giờ kết thúc: " + dt_end_date ;
	var pars = "n_calendar_id=" + n_calendar_id + "&n_lesson_id=" + n_lesson_id + "&n_speciality_id=" + n_speciality_id  + "&s_calendar_info=" + s_calendar_info;
	ShowDivGeneral(url, pars, 'divID'); 
}

function viewPointStudent(code)
{
	var url = "index.php?do=result_student&action=print_point&code=" + code;
	openChild(url, 'win2');
}
function viewPointStudentListing(s_class_id, s_lesson_id, s_term_name, s_school_year)
{
	var url = "index.php?do=point_student_listing_admin";
	var pars = "s_class_id=" + s_class_id + "&s_lesson_id=" + s_lesson_id + "&s_term_name=" + s_term_name + "&s_school_year=" + s_school_year;
	ShowDivGeneral(url, pars, 'divID'); 
}

function viewPointStudentTerm(code)
{
	var url = "index.php?do=point_listing&action=point_student&code=" + code;
	openChild(url, 'win2');
}