function checkForCalendar()
{	
	var n_lesson_id = document.getElementById('n_lesson_id').value;
	var n_exam_type_id = document.getElementById('n_exam_type_id').value;
	var n_location_id='';
	if(document.getElementById('n_location_id') != null)
		n_location_id = document.getElementById('n_location_id').value;

	if(n_lesson_id == '' || n_location_id == '' || n_exam_type_id == '')	
		return false;
	return true;
}

function ShowLocationForCalendar()
{
	if($('n_location_id'))
		setFocus('n_location_id');
	
	var n_branch_id = document.getElementById('n_branch_id').value;

	var url = "index.php?do=admin_calendar";	
	url += '&n_branch_id=' + n_branch_id + '&action=show_room';
	load_pages(url, 'div_location_id');
}

function editAdminCalendar(n_calendar_id, edit)
{	
	
	var oForm = document.admin_form;
	oForm.n_calendar_id.value = n_calendar_id;
	oForm.edit.value = edit; 
	oForm.submit();					
}
function delAdminCalendar()
{
	var n_term_id = document.getElementById('n_term_id').value;
	var n_lesson_id = document.getElementById('n_lesson_id').value;
	var n_speciality_id = document.getElementById('n_speciality_id').value;

	var codition = '&n_speciality_id=' + n_speciality_id + '&n_lesson_id=' + n_lesson_id + '&n_term_id=' + n_term_id;
	deleteGeneral('admin_calendar', 'show_admin_calendar', codition);
}

function checkTimeTable()
{
	var n_term_id = document.getElementById('n_term_id').value;
	var n_lesson_id = document.getElementById('n_lesson_id').value;


	var url = "index.php?do=admin_calendar&n_term_id=" + n_term_id + "&n_lesson_id=" + n_lesson_id + "&action=check_time_table&index_paging=1'";	

	load_pages(url, 'check_time_table');
}
function showNumOfStudent()
{
	var n_speciality_id = document.getElementById('n_speciality_id').value;

	var url = "index.php?do=admin_calendar&n_speciality_id=" + n_speciality_id + "&action=show_num_of_student";	

	load_pages(url, 'div_num_of_student');
	
}
function selectLocation()
{
	
	var n_lesson_id = document.getElementById('n_lesson_id').value;
	var n_term_id = document.getElementById('n_term_id').value;
	var dt_start_date = document.getElementById('dt_start_date').value;
	var dt_end_date = document.getElementById('dt_end_date').value;
	var n_calendar_id = document.getElementById('n_calendar_id').value;
	var n_speciality_id = document.getElementById('n_speciality_id').value;

	if(n_lesson_id != '' && n_term_id != '' && dt_start_date != '' && dt_end_date != '')
	{
		var url = "index.php?do=admin_calendar";
		url += "&n_lesson_id=" + n_lesson_id 
				+ "&n_term_id=" + n_term_id 
				+ "&dt_start_date=" + dt_start_date 
				+ "&dt_end_date=" + dt_end_date 
				+ "&n_calendar_id=" + n_calendar_id 
				+ "&n_speciality_id=" + n_speciality_id 
				
				+ "&action=select_location";	
	
		//load_pages(url, 'div_location_id');
		ShowDivGeneral(url, '', 'div_location_id');
		
	}
}
