/*MAIN INDEX ACTIVE LINKS*/
function active_(remove_class, add_id){
	$("."+remove_class).removeClass("active");
	$("."+remove_class).addClass("custom_inactive");
	$("#"+add_id).addClass("active");

}
/*MAIN INDEX ACTIVE LINKS*/



function dashboard_view(){
	$("#main_section").load("includes_/dashboard.php");
	active_("index_menu", "dashboard_menu_link")
	setTimeout(function(){
                $("#admin_dashboard_content").show()
                $("#student_dashboard_content").show()
                $("#teacher_dashboard_content").show()
             }, 100);
}
function dashboard_view1(){
	$("#main_section").load("includes_/dashboard.php");
	active_("index_menu", "dashboard_menu_link")
	setTimeout(function(){
                $("#admin_dashboard_content").show()
             }, 100);
}
function dashboard_view2(){
	$("#main_section").load("includes_/dashboard.php");
	active_("index_menu", "dashboard_menu_link")
	setTimeout(function(){
                $("#student_dashboard_content").show()
             }, 100);
}
function dashboard_view3(){
	$("#main_section").load("includes_/dashboard.php");
	active_("index_menu", "dashboard_menu_link")
	setTimeout(function(){
                $("#teacher_dashboard_content").show()
             }, 100);
}
function users_menu(){
	active_("index_menu", "users_menu_link")
	active_("index_menu", "extras_menu_link")
}
function announcements_menu(){
	active_("index_menu", "announcements_menu_link")
	active_("index_menu", "extras_menu_link")
}
function manage_teachers_menu(){
	active_("index_menu", "manage_teachers_menu_link")
	active_("index_menu", "extras_menu_link")
}
function my_school_menu(){
	active_("index_menu", "my_school_menu_link")
	active_("index_menu", "extras_menu_link")
}
function assessment_menu(){
	active_("index_menu", "assessment_menu_link")
	active_("index_menu", "extras_menu_link")
}
function school_menu(){
	$("#school_menu_link").click(function(e) {
	     e.preventDefault();
	     active_("index_menu", "school_menu_link")
	});
}
function staff_menu(){
	$("#staff_menu_link").click(function(e) {
	     e.preventDefault();
	     active_("index_menu", "staff_menu_link")
	});
}
function extras_menu(){
	$("#staff_menu_link").click(function(e) {
	     e.preventDefault();
	     active_("index_menu", "extras_menu_link")
	});
}


function profile_view(){
	$("#main_section").load("includes_/profile.php");
}
function create_users_view(){
	$("#main_section").load("includes_/users/create_users.php");
	active_("index_menu", "users_menu_link")
}
function reset_user_password_view(){
	$("#main_section").load("includes_/users/reset_user_password.php");
	active_("index_menu", "users_menu_link")
}
function users_modules_view(){
	$("#main_section").load("includes_/users/users_modules.php");
	active_("index_menu", "users_menu_link")
}
function users_summary_view(){
	$("#main_section").load("includes_/users/users_summary.php");
	active_("index_menu", "users_menu_link")
}
function edit_user_info_view(){
	$("#main_section").load("includes_/users/edit_user_info.php");
}
function user_module_allocation_form_view(){
	$("#main_section").load("includes_/users/user_module_allocation_form.php");
}
function announcements_view(){
	$("#main_section").load("includes_/announcements/announcements.php");
}
function add_announcement_view(){
	$("#main_section").load("includes_/announcements/add_announcement.php");
}
function edit_announcement_view(){
	$("#main_section").load("includes_/announcements/edit_announcement.php");
}
function active_students_summary_view(){
	$("#main_section").load("includes_/school/overview.php");
	active_("index_menu", "school_menu_link")
}
function add_students_view(){
	$("#main_section").load("includes_/school/add_students.php");
	active_("index_menu", "school_menu_link")
}
function student_class_view(){
	$("#main_section").load("includes_/school/student_classes.php");
	active_("index_menu", "school_menu_link")
}
function edit_student_view(){
	$("#main_section").load("includes_/school/edit_student.php");
}

function active_staff_summary_view(){
	$("#main_section").load("includes_/staff/overview.php");
	active_("index_menu", "staff_menu_link")
}
function add_staff_view(){
	$("#main_section").load("includes_/staff/add_staff.php");
	active_("index_menu", "staff_menu_link")
}
function edit_staff_view(){
	$("#main_section").load("includes_/staff/edit_staff.php");
}
function staff_view(){
	$("#main_section").load("includes_/staff/staff.php");
	active_("index_menu", "staff_menu_link")
}


function teachers_list_view(){
	$("#main_section").load("includes_/teachers/teachers.php");
}
function teachers_summary_view(){
	$("#main_section").load("includes_/teachers/teachers_overview.php");
}
function teacher_subject_allocation(){
	$("#main_section").load("includes_/teachers/teacher_subject_allocation.php");
}
function teacher_subject_allocation_form_view(){
	$("#main_section").load("includes_/teachers/teacher_subject_allocation_form.php");
}

function register_students(){
	$("#main_section").load("includes_/assessment/register_students.php");
}
function get_register_students(){
	$("#register_students_content").load("includes_/assessment/register_students_content.php");
}
function deregister_students(){
	$("#main_section").load("includes_/assessment/deregister_students.php");
}
function get_deregister_students_from_class(){
	$("#deregister_students_from_class_content").load("includes_/assessment/deregister_students_from_class_content.php");
}
function get_deregister_students_from_subject(){
	$("#deregister_students_from_subject_content").load("includes_/assessment/deregister_students_from_subject_content.php");
}
function subject_class_registration(){
	$("#main_section").load("includes_/assessment/subject_class_registration.php");
}
function get_subject_class_regitsration_content(){
	$("#subject_class_regitsration_content").load("includes_/assessment/subject_class_registration_content.php");
}
function student_subjects_view(){
	$("#main_section").load("includes_/assessment/students_subjects.php");
}
function get_student_subject_search(){
	$("#student_subject_main_content").load("includes_/assessment/student_subjects_search.php");
}
function student_subject_search(){
	$("#student_subject_sub_content").load("includes_/assessment/student_subjects_search_content.php");
}

function get_student_subjects(){
	$("#student_subject_sub_content").load("includes_/assessment/student_subjects_search_subjects.php");
}

function grade_processing(){
	$("#main_section").load("includes_/assessment/grade_processing.php");
}
function subject_grade_processing(){
	$("#main_section").load("includes_/assessment/subject_grade_processing.php");
}

function grade_entry_view(){
	$("#main_section").load("includes_/assessment/grade_entry.php");
}
function get_grade_entry_search(){
	$("#grade_entry_main_content").load("includes_/assessment/grade_entry_search.php");
}
function get_grade_entry_search_content(){
	$("#grade_entry_sub_content").load("includes_/assessment/grade_entry_search_content.php");
}





function class_list_view(){
	$("#main_section").load("includes_/assessment/class_list.php");
}
function get_class_list_search(){
	$("#class_list_main_content").load("includes_/assessment/class_list_search.php");
}
function get_class_list_search_content_by_class(){
	$("#class_list_sub_content").load("includes_/assessment/class_list_search_content_by_class.php");
}
function get_class_list_search_content_by_subject(){
	$("#class_list_sub_content").load("includes_/assessment/class_list_search_content_by_subject.php");
}

function student_record_view(){
	$("#main_section").load("includes_/assessment/student_record.php");
}
function student_record_search(){
	$("#student_record_sub_content").load("includes_/assessment/student_record_search.php");
}
function get_student_record_content(){
	$("#student_record_sub_content").load("includes_/assessment/student_record_search_content.php");
}

function teacher_summary_view(){
	$("#main_section").load("includes_/my_school/teachers_portal/teacher_summary.php");
	active_("index_menu", "teacher_p_summary_link")
}
function students_in_class_view(){
	$("#main_section").load("includes_/my_school/teachers_portal/students_in_class.php");
	active_("index_menu", "teacher_p_sic_link")
}
function students_in_class_list_view(){
	$("#main_section").load("includes_/my_school/teachers_portal/students_in_class_list.php");
}
function teacher_grade_entry(){
	$("#main_section").load("includes_/my_school/teachers_portal/grade_entry.php");
	active_("index_menu", "teacher_p_ge_link")
}
function grade_entry_view(){
	$("#main_section").load("includes_/my_school/teachers_portal/grade_entry_enter_grades.php");
}

function student_portal_view(){
	$("#main_section").load("includes_/my_school/students_portal/overview.php");
	active_("index_menu", "student_p_summary_link")
}
function student_portal_subjects_view(){
	$("#main_section").load("includes_/my_school/students_portal/subjects.php");
	active_("index_menu", "student_p_s_link")
}
function student_portal_academic_performance(){
	$("#main_section").load("includes_/my_school/students_portal/academic_performance.php");
	active_("index_menu", "student_p_ac_link")
}


//................
function show_school_menu(){
	if(document.getElementById("school_menu_id")!=null){
		if($("#school_name_").is(":hidden")){
	        $('#school_menu_id').show()
			$('#school_menu_id').addClass("bg-white")
	    }else if($("#navbar_tooggler_").is(":visible")){
	    	$('#school_menu_id').show()
			$('#school_menu_id').addClass("bg-white")
	    }
	}
}
function hide_school_menu(){
	if(document.getElementById("school_menu_id")!=null){
		if($("#school_name_").is(":hidden")){
	        $('#school_menu_id').hide()
			$('#school_menu_id').removeClass("bg-white")
	    }else if($("#navbar_tooggler_").is(":visible")){
	    	$('#school_menu_id').hide()
			$('#school_menu_id').removeClass("bg-white")
	    }
	}
		
}
function show_staff_menu(){
    if(document.getElementById("staff_menu_id")!=null){
		if($("#school_name_containter").is(":hidden")){
	        $('#staff_menu_id').show()
			$('#staff_menu_id').addClass("bg-white")
	    }else if($("#navbar_tooggler_").is(":visible")){
	    	$('#staff_menu_id').show()
			$('#staff_menu_id').addClass("bg-white")
	    }
	}
}
function hide_staff_menu(){
	if(document.getElementById("staff_menu_id")!=null){
		if($("#school_name_containter").is(":hidden")){
	        $('#staff_menu_id').hide()
			$('#staff_menu_id').removeClass("bg-white")
	    }else if($("#navbar_tooggler_").is(":visible")){
	    	$('#staff_menu_id').hide()
			$('#staff_menu_id').removeClass("bg-white")
	    }
	}	
}
function show_extras_menu(){
	if(document.getElementById("extras_menu_id")!=null){
		if($("#school_name_containter").is(":hidden")){
			$(".extras_sub_menu").show()
	        $('#extras_menu_id').addClass("bg-white")
	        $(".extras_sub_menu_link").addClass("d-flex")
	        $(".extras_sub_menu_link").addClass("justify-content-between")
	    }else if($("#navbar_tooggler_").is(":visible")){
	    	$(".extras_sub_menu").show()
	    	$('#extras_menu_id').addClass("bg-white")
	    	$(".extras_sub_menu_link").addClass("d-flex")
	    	$(".extras_sub_menu_link").addClass("justify-content-between")
	    }
	}	
		
}
function hide_extras_menu(){
	if(document.getElementById("extras_menu_id")!=null){
		if($("#school_name_containter").is(":hidden")){
			$(".extras_sub_menu").hide()
	        $('#extras_menu_id').removeClass("bg-white")
	        $(".extras_sub_menu_link").removeClass("d-flex")
	        $(".extras_sub_menu_link").removeClass("justify-content-between")
	    }else if($("#navbar_tooggler_").is(":visible")){
	    	$(".extras_sub_menu").hide()
	    	$('#extras_menu_id').removeClass("bg-white")
	    	$(".extras_sub_menu_link").removeClass("d-flex")
	        $(".extras_sub_menu_link").removeClass("justify-content-between")
	    }
	}	
		
}

$(document).ready(function(){
	$( window ).resize(function() {
	  if(($( window ).width())>=1170){
	  	//show school menu
	  	$('#school_menu_id').show()
	  	//show staff menu
	  	$('#staff_menu_id').show()
	  	//show estras
	  	$(".extras_sub_menu").show()
		  	$(".extras_sub_menu_link").addClass("d-flex")
    		$(".extras_sub_menu_link").addClass("justify-content-between")

    	
	  	$("#school_name_containter").removeClass("d-none")
	  	$("#school_name_containter").addClass("d-block")
	  	$('#school_logo_img').css("max-height","60px");
	  }else{
	  		$("#school_name_containter").removeClass("d-block")
	  		$("#school_name_containter").addClass("d-none")
		  	$(".extras_sub_menu_link").removeClass("d-flex")
	        $(".extras_sub_menu_link").removeClass("justify-content-between")
	        $("#school_name_logo_").addClass("d-block")
	        $('#school_logo_img').css("max-height","40px");
	  }
	});
	if(($( window ).width())>=1170){
	  	//show school menu
	  	$('#school_menu_id').show()
	  	//show staff menu
	  	$('#staff_menu_id').show()
	  	//show estras
	  	$(".extras_sub_menu").show()
		  	$(".extras_sub_menu_link").addClass("d-flex")
    		$(".extras_sub_menu_link").addClass("justify-content-between")

    	
	  	$("#school_name_containter").removeClass("d-none")
	  	$("#school_name_containter").addClass("d-block")
	  	$('#school_logo_img').css("max-height","60px");
	  }else{
	  		$("#school_name_containter").removeClass("d-block")
	  		$("#school_name_containter").addClass("d-none")
		  	$(".extras_sub_menu_link").removeClass("d-flex")
	        $(".extras_sub_menu_link").removeClass("justify-content-between")
	        $("#school_name_logo_").addClass("d-block")
	        $('#school_logo_img').css("max-height","40px");
	  }
})