$("#wrongMark_close").click(function(){$(".wrongMark").hide(400)}),$("#re_subject").click(function(){$(".registered_subject").show(400)}),$("#reg_subject").click(function(){$(".registered_subject").show(400)}),$("#registered_subject_close").click(function(){$(".registered_subject").hide(400)}),$("#reg_student").click(function(){$(".registered_student").show(400)}),$("#registered_student_close").click(function(){$(".registered_student").hide(400)}),$("#gs_subject").click(function(){$(".grade_subject").show(400)}),$("#grade_subject_close").click(function(){$(".grade_subject").hide(400)}),$(".alternatePass").click(function(){$(".addMarks").show(400)}),$("#alternatePass_close").click(function(){$(".addMarks").hide(400),window.location.reload()}),$(".alternatePass_close").click(function(){$(".addMarks").hide(400),window.location.reload()}),$(".passGrade_point").change(function(){var e=$(this).val();$("#status").html("Processing data please wait ...").show(400),$.post("../admin/zems_ajax.php",{passGradePoint:e},function(e){$(".gradePoint").html(e),$("#status").html("processing completed"),setTimeout(function(){$("#status").hide(400)},3e3)})}),$(".markToAdd").change(function(){var e=$(this).val();$("#status").html("adding mark please wait ...").show(400),$.post("../admin/zems_ajax.php",{markToAdd:e},function(e){"ok"===e.trim()&&($("#status").html("completed"),setTimeout(function(){$("#status").hide(400)},3e3))})}),$("#viewSchool").click(function(){$(".result_choice").show(400)}),$("#result_choice_close").click(function(){$(".result_choice").hide(400)}),$("#view_school").click(function(){var e=$("#my_choice").val();$.post("../admin/zems_ajax.php",{result_choice:e},function(e){}),$(".result_choice").hide(400)}),$("#s4_finalize").click(function(){$(".coursework").val(0),$(".nationamark").val(0),$(".coursework").hide(500),$(".nationamark").hide(500)}),$("#s6_finalize").click(function(){$(".coursework").val(40),$(".nationamark").val(60),$(".coursework").show(500),$(".nationamark").show(500)}),$("#f2_finalize").click(function(){$(".coursework").val(30),$(".nationamark").val(70),$(".coursework").show(500),$(".nationamark").show(500)}),$("#assign_p").click(function(){$(".pr_box").hide(400);var e=$("#level").val(),t=$("#subject").val(),i=$("#user").val()+":"+t+":"+e;$("#status").show(400),$("#status").html("adding privilege . . ."),$.post("../admin/zems_ajax.php",{add_privilege:i},function(e){"ok"===e.trim()&&($("#status").html("assigned"),setTimeout(function(){$("#status").hide(400)},3e3),window.location.reload())})}),$("#pr_box_close").click(function(){$(".pr_box").hide(400)}),$("#add_privilege").click(function(){$(".pr_box").show(400)}),$("#report").click(function(){$.post("../admin/zems_ajax.php",{report:"report_summery"},function(e){$("#contentView").html(e),$("#currentPane").hide(400)})}),$("#sampleFile").click(function(){var e=$(this).val();$.post("../admin/zems_ajax.php",{sample_file:e},function(e){})}),$(".coursework").change(function(){var e=parseInt($(this).val(),10)+parseInt($(".nationamark").val(),10);e>=101?$("#mark-total").html("* the sum of the input exceed 100%"+e):e<1?$("#mark-total").html("* the sum of the input is less than 100%"):$("#mark-total").html("")}),$(".coursework").keyup(function(){var e=parseInt($(this).val(),10)+parseInt($(".nationamark").val(),10);e>=101?$("#mark-total").html("* the sum of the input exceed 100% = "+e):e<100?$("#mark-total").html("* the sum of the input is less than 100% = "+e):$("#mark-total").html("")}),$(".nationamark").change(function(){var e=parseInt($(this).val(),10),t=parseInt($(".coursework").val(),10)+e;t>=101?$("#mark-total").html("* the sum of the input exceed 100% = "+t):t<1?$("#mark-total").html("* the sum of the input is less than 100% = "+t):$("#mark-total").html("")}),$(".nationamark").keyup(function(){var e=parseInt($(this).val(),10),t=parseInt($(".coursework").val(),10)+e;t>=101?$("#mark-total").html("* the sum of the input exceed 100% = "+t):t<100?$("#mark-total").html("* the sum of the input is less than 100% = "+t):$("#mark-total").html("")}),$("#fullName").change(function(){var e=/ /gim,t=$(this).val().match(e);(t=t?t.length:0)<=1?$("#full_Name").html("* Please check full name if it is complete"):$("#full_Name").html("")}),$(".fullName").change(function(){var e=/ /gim,t=$(this).val().trim().match(e);(t=t?t.length:0)<=1?$("#student-reg").html("* Please check full name if it is complete"):$("#student-reg").html("")}),$("#search_guery").keyup(function(){var e=$(this).val(),t=$(".filter").val(),i=e+":"+t;$.post("../admin/zems_ajax.php",{search_value:i},function(t){$("#contentView").html(t),""===e?($("#currentPane").show(400),$("#instantPane").hide(400)):$("#currentPane").hide(400)})}),$("#userName").change(function(){var e=$(this).val(),t=e,i=/ /gim,o=(o=t.match(i))?o.length:0;e.length<4?$("#user").html("* User name must be at least 4 characters"):t>=1?$("#user").html("* Space is no allowed on writing user name"):$.post("../admin/zems_ajax.php",{userName_checker:e},function(e){$("#user").html(e)})}),$("#regno").keyup(function(){var e=$(this).val(),t=$(this).val();$.post("../admin/zems_ajax.php",{sc_id:t},function(e){e.trim().length>4?$("#scid").html("* School ID exist , try different school ID"):""===t?$("#scid").html("* School ID required"):t.length<6||t.length>6?$("#scid").html("* School ID must be 6 character length including ."):$("#scid").html("")}),0===e.trim().toLowerCase().indexOf("zp")?$("#schoolLevel").val("Primary"):0===e.trim().toLowerCase().indexOf("zs")?$("#schoolLevel").val("Form two"):$("#schoolLevel").val("School Level")}),$("#schoolN").keyup(function(){var e=$(this).val();$.post("../admin/zems_ajax.php",{scName:e},function(e){$("#scid").html(e)})}),$("#schoolN").change(function(){var e=$(this).val();$.post("../admin/zems_ajax.php",{scName:e},function(e){$("#scid").html(e)})}),$(".privilege-box").change(function(){"Choose privilege"!==$(this).val()?$(".text-group").html(""):$(".text-group").html("* You should choose privilege !")}),$(".class-box").change(function(){"Choose class"!==$(this).val()?$(".text-group").html(""):$(".text-group").html("* You should choose class !")}),$("#district").change(function(){var e=$(this).val();"Magharibi B"===e||"Magharibi A"===e||"Mjini"===e?$("#region").val("Mjini Magharibi"):"Kaskazini A"===e||"Kaskazini B"===e?$("#region").val("Kaskazini Unguja"):"Kusini"===e?$("#region").val("Kusini unguja"):"Kati"===e?$("#region").val("Kusini unguja"):"Mkoani"===e?$("#region").val("Kusini Pemba"):"chake chake"===e?$("#region").val("Kusini Pemba"):"Micheweni"===e?$("#region").val("Kaskazini Pemba"):"Wete"===e?$("#region").val("Kaskazini Pemba"):$("#region").val(d)}),$("#district").keyup(function(){var e=$(this).val();"Magharibi A"===e||"Magharibi B"===e||"Mjini"===e?$("#region").val("Mjini Magharibi"):"Kaskazini A"===e||"Kaskazini B"===e?$("#region").val("Kaskazini Unguja"):"Kusini"===e?$("#region").val("Kusini unguja"):"Kati"===e?$("#region").val("Kusini unguja"):"Mkoani"===e?$("#region").val("Kusini Pemba"):"chake chake"===e?$("#region").val("Kusini Pemba"):"Micheweni"===e?$("#region").val("Kaskazini Pemba"):"Wete"===e?$("#region").val("Kaskazini Pemba"):$("#region").val(d)}),$("#new_password").change(function(){$(this).val().length<6?$("#new_pass").html("* Password must be 6 or 8 length"):$("#new_pass").html("")}),$("#re_entered_pass").change(function(){$(this).val()!==$("#new_password").val()?$("#con_pass").html("* Password mismatch !"):$("#con_pass").html("")}),$("#contact").keyup(function(e){var t=$(this).val();10===(t=t.replace(/[^0-9\.]/g,"")).length?$.post("../admin/zems_ajax.php",{contact_check:t},function(e){$("#contact_error").html(e)}):$("#contact_error").html("* Please enter a valid phone number 0f 10 digits start with 0 not +255")}),$("#grade_setting").change(function(){$(this).val();$.post("../admin/zems_ajax.php",{re_entered_file:re_entered_file},function(e){$("#result").html(e)})}),$("#grade_setting").keyup(function(){$(this).val();$.post("../admin/zems_ajax.php",{re_entered_file:re_entered_file},function(e){$("#result").html(e)})}),$("#change-year").change(function(){var e=$(this).val();$("#status").show(400),$("#status").html("saving . . ."),$.post("../admin/zems_ajax.php",{change_year:e},function(e){$("#year").html("Year : "+e),$("#status").html("saved"),setTimeout(function(){$("#status").hide(400)},3e3),window.location.reload()})}),$("#f2_level").click(function(){$("#status").show(400),$("#status").html("saving . . ."),$.post("../admin/zems_ajax.php",{set_level:"form2"},function(e){"ok"===e.trim()&&($("#status").html("saved"),setTimeout(function(){$("#status").hide(400)},3e3),window.location.reload())})}),$("#s6_level").click(function(){$("#status").show(400),$("#status").html("saving . . ."),$.post("../admin/zems_ajax.php",{set_level:"standard6"},function(e){"ok"===e.trim()&&($("#status").html("saved"),setTimeout(function(){$("#status").hide(400)},3e3),window.location.reload())})}),$("#s4_level").click(function(){$("#status").show(400),$("#status").html("saving . . ."),$.post("../admin/zems_ajax.php",{set_level:"standard4"},function(e){"ok"===e.trim()&&($("#status").html("saved"),setTimeout(function(){$("#status").hide(400)},3e3),window.location.reload())})}),$("#sc_id").keyup(function(){var e=$(this).val();0===e.indexOf("zp")?$("#s6").show(400):0===e.indexOf("zs")?$("#f2").show(400):($("#schoolLevel").html(""),$("#s6").hide(400),$("#f2").hide(400)),6===e.length||7===e.length?$.post("../admin/zems_ajax.php",{sc_id:e},function(e){var t=e.trim().replace("OK","");$("#schoolName").html("School Name : "+t),"OK"===e.trim().replace(t,"")?($("#upload").show(600),$("#sc").html(" -> "+t),$("#student-reg").html('SCHOOL NAME : '+t+"")):($("#sc").html(" * School ID does not exist"),$("#student-reg").html(" * School ID does not exist"),$("#upload").hide(600))}):($("#sc").html(" * Invalid school ID, school ID must have 6 character length of format zp.000 or zs.000"),$("#student-reg").html(" * Invalid school ID, school ID must have 6 character length of format zp.000 or zs.000"),$("#upload").hide(600))}),$("#sc_id").change(function(){var e=$(this).val();0===e.indexOf("zp")?$("#s6").show(400):0===e.indexOf("zs")?$("#f2").show(400):($("#schoolLevel").html(""),$("#s6").hide(400),$("#f2").hide(400)),6===e.length||7===e.length?$.post("../admin/zems_ajax.php",{sc_id:e},function(e){var t=e.trim().replace("OK","");$("#schoolName").html("School Name : "+t),"OK"===e.trim().replace(t,"")?($("#upload").show(600),$("#sc").html(" -> "+t),$("#student-reg").html('SCHOOL NAME : '+t+"")):($("#sc").html(" * School ID does not exist"),$("#student-reg").html(" * School ID does not exist"),$("#upload").hide(600))}):($("#sc").html(" * Invalid school ID, school ID must have 6 character length of format zp.000 or zs.000"),$("#student-reg").html(" * Invalid school ID, school ID must have 6 character length of format zp.000 or zs.000"),$("#upload").hide(600))}),$("#file_ext").change(function(){var e=$(this).val().toLowerCase();switch(e.substr(e.lastIndexOf(".")+1)){case"csv":$("#sc_id").show(300),$("#ext").html(""),$("#up_school").show(200);break;default:$("#ext").html("* Invalid file extension !, file extension should be .csv example filename.csv"),$("#sc_id").hide(300),$("#sc_id").html(""),$("#upload").hide(300),$("#up_school").hide(200),$("#sc").html(""),$("#schoolLevel").html(""),$("#s6").hide(400),$("#f2").hide(400)}}),$(".reg-no").change(function(){var e=$(this).val();$.post("../admin/zems_ajax.php",{reg_no:e},function(e){"ok"===e&&$("#student-reg").html("* Student registration number exist, Please review registration number")})}),$("#search-query").change(function(){var e=$(this).val();$.post("../admin/zems_ajax.php",{ex_n:e},function(e){$("#res").html(e)})}),$(document).ready(function(){$('[data-toggle="myToolTip"]').tooltip()}),$(window).load(function(){}),$.fn.extend({treeview:function(){return this.each(function(){var e=$(this);e.addClass("treeview-tree"),e.find("li").each(function(){$(this)}),e.find("li").has("ul").each(function(){var e=$(this);e.prepend(""),e.addClass("tree-branch"),e.on("click",function(e){this===e.target&&($(this).children("i:first").toggleClass("glyphicon-chevron-down glyphicon-chevron-right"),$(this).children().children().toggle())}),e.children().children().toggle(),e.children(".tree-indicator, button, a").click(function(t){e.click(),t.preventDefault()})})})}}),$(window).on("load",function(){$(".treeview").each(function(){$(this).treeview()})}),setTimeout(function(){$(".auto_close").fadeOut().empty()},9e3),$(window).load(function(){$("#loader").fadeOut()}),$("#close_modal").click(function(){$("#sm_modal").hide(500)}),$('input[name = "c_w"]').on("click",function(){var e=$(this).val();$.post("../admin/zems_ajax.php",{c_w:e},function(e){})}),$(".viewDistrict").click(function(){$(".district").show(400)}),$("#close_district").click(function(){$(".district").hide(400)}),$(".add_n_mark").click(function(){$(".national_marks_privilage").show(400)}),$("#national_marks_privilage_close").click(function(){$(".national_marks_privilage").hide(400)}),$(".open_coursework_number").click(function(){$(".coursework_number_for_importing").show(400)}),$("#close_coursework_n_importing").click(function(){$(".course_work_privilege").show(400),$(".coursework_number_for_importing").hide(400)}),$("#course_work_privilege_close").click(function(){$(".course_work_privilege").hide(400)}),$(".register_school").click(function(){$(".sc_type_reg").show(400)}),$(".unregister_school").click(function(){$(".un_reg").show(400)}),$("#close_un_reg").click(function(){$(".un_reg").hide(400)}),$("#close_sc_type_reg").click(function(){$(".sc_type_reg").hide(400)}),$(".reg_sc").click(function(){$(".sc_type").show(400)}),$("#close_sc_type").click(function(){$(".sc_type").hide(400)}),$(".viewRegion").click(function(){$(".region").show(400)}),$("#close_region").click(function(){$(".region").hide(400)}),$(".show_coursework_number").click(function(){$(".coursework_number").show(400)}),$("#close_coursework_number").click(function(){$(".coursework_number").hide(400),$(".add_coursework_privilege").show(400)}),$("#add_coursework_privilege_close").click(function(){$(".add_coursework_privilege").hide(400)}),$("#graphs").click(function(){$.post("../admin/zems_ajax.php",{graphs:"graph"},function(e){$("#currentPane").hide(400),$("#contentView").html(e)})}),$("#graph_option").click(function(){$("._option").show(400)}),$("#close_option").click(function(){$("._option").hide(400)}),$(document).ready(function(){var e=$("td[contenteditable]");e.bind("keypress",function(t){var i=t.keyCode||t.which;if(13===i){o=e.index(this);e.eq(o+1).focus(),t.preventDefault()}else if(40===i){o=e.index(this);e.eq(o+1).focus(),t.preventDefault()}else if(38===i){var o=e.index(this);e.eq(o-1).focus(),t.preventDefault()}})}),$(function(){$(".editable_cell").keyup(function(e){var t=parseInt($(this).text(),10);t>100||t<0?($(this).css("color","red"),$(".wrongMark").show(400),$("#invalid-mark")[0].play(),13!==e.keyCode&&9!==e.keyCode||e.preventDefault()):($(this).css("color","black"),$(".wrongMark").hide(400))}).on("keydown",function(e){var t=parseInt($(this).text(),10);if((t>100||t<0)&&(13!==e.keyCode&&9!==e.keyCode||e.preventDefault()),!(46===e.keyCode||8===e.keyCode||9===e.keyCode||27===e.keyCode||13===e.keyCode||65===e.keyCode&&!0===e.ctrlKey||67===e.keyCode&&!0===e.ctrlKey||86===e.keyCode&&!0===e.ctrlKey||e.keyCode>=35&&e.keyCode<=40))if(190===e.keyCode){var i=dot.match(/\./g).length;$(".panel-footer").html(i),i<=1&&e.preventDefault()}else(e.shiftKey||(e.keyCode<48||e.keyCode>57)&&(e.keyCode<96||e.keyCode>105))&&e.preventDefault()}).blur(function(){var e=$(this).attr("id"),t=$(this).text(),i=$(location).attr("hostname");$.ajax({url:"http://"+i,type:"HEAD",timeout:1e3,statusCode:{200:function(e){$(".netConnection").hide(400)},400:function(e){$(".netConnection").show(400),$("#error-notification")[0].play()},0:function(e){$(".netConnection").show(400),$("#error-notification")[0].play()}}}),$("#status").html("saving . . .").show(400),$.post("../admin/Auto_save.php",e+"="+t,function(e){""!==e&&($("#status").html("saved"),$(".netConnection").hide(400),setTimeout(function(){$("#status").hide(400)},3e3))})}),$(".editableCell").blur(function(){var e=$(this).attr("id"),t=$(this).text(),i=$(location).attr("hostname");$.ajax({url:"http://"+i,type:"HEAD",timeout:1e3,statusCode:{200:function(e){$(".netConnection").hide(400)},400:function(e){$(".netConnection").show(400),$("#error-notification")[0].play()},0:function(e){$(".netConnection").show(400),$("#error-notification")[0].play()}}}),$("#status").html("saving . . .").show(400),$.post("../admin/Auto_save.php",e+"="+t,function(e){""!==e&&($("#status").html("saved"),$(".netConnection").hide(400),setTimeout(function(){$("#status").hide(400)},3e3))})}),$("#pdf_file").click(function(){return $("#printThis").print(),!1})}),$("#copyData").click(function(){$(".copyProgress").html("Coping data please wait..."),$.post("../admin/zems_ajax.php",{copyallData:"copyallData"},function(e){"ok"===e.trim()&&($(".copyProgress").html("Data coped successfully"),$(".confirmCopy").hide(400),window.location.reload())})}),$(".copyallData").click(function(){$(".confirmCopy").show(400)}),$("#rejectCopy").click(function(){$(".confirmCopy").hide(400)}),$(".close-reg").click(function(){"Close registration"===$(this).text().trim()?$(".confirmModal").show(400):$(".openRegistration").show(400)}),$("#rejectCr").click(function(){$(".confirmModal").hide(400)}),$("#rejectOP").click(function(){$(".openRegistration").hide(400)}),$(".examshowModal").click(function(){$(".examModal").show(400)}),$("#hideExamodal").click(function(){$(".examModal").hide(400)}),$("#packlist").click(function(){$(".packlist_sheet").show(400)}),$("#close_packlist_sheet").click(function(){$(".packlist_sheet").hide(400)}),$("#cancelUndo").click(function(){$(".undoReg").hide(400)}),$("#coUndo").click(function(){$(".undoReg").show(400)}),$("#closethisReg").click(function(){$("#re_st").html('closing registration . . . '),$.post("../admin/zems_ajax.php",{close_reg:"close"},function(e){"ok"===e.trim()&&($("#re_st").html('Open registration'),window.location.reload())}),$(".confirmModal").hide(400)}),$("#openthisReg").click(function(){$("#re_st").html('Opening registration . . . '),$.post("../admin/zems_ajax.php",{open_reg:"close"},function(e){"ok"===e.trim()&&($("#re_st").html('Close registration'),window.location.reload())}),$(".openRegistration").hide(400)}),$(".cpp").click(function(){var e=$("#n_asgn").val();$(".n_a_status").html('Clearing previous process . . . '),$.post("../admin/zems_ajax.php",{cpp:e},function(e){"ok"===e.trim()&&$(".n_a_status").html('Process completed press OK')})}),$("#c_fm").click(function(){$(".c_fmd").show(400)}),$("#c_fmd_close").click(function(){$(".c_fmd").hide(400)}),$(".heading-compose").click(function(){$(".side-two").css({left:"0"})}),$(".newMessage-back").click(function(){$(".side-two").css({left:"-100%"})}),$(".sideBar-body").click(function(){var e=$(this).text();e=e.trim(),$(".heading-name-meta").html(e),$.post("../admin/zems_ajax.php",{comment:e},function(e){$("#this-message").html(e)})}),$(".data-entry-hideSchool").click(function(){var e=$(".sc_idTohide").text();$("#status").html("Processing data please wait ...").show(400),$.post("../admin/zems_ajax.php",{sc_idTohide:e},function(t){$(".sc_idTohide").html(e),$("#status").html("processing completed"),setTimeout(function(){$("#status").hide(400)},3e3)}),$("#printThis").print(),window.location.href="../data-entry"}),$(".hideSchool").click(function(){var e=$(".sc_idTohide").text();$("#status").html("Processing data please wait ...").show(400),$.post("../admin/zems_ajax.php",{sc_idTohide:e},function(t){$(".sc_idTohide").html(e),$("#status").html("processing completed"+t),setTimeout(function(){$("#status").hide(400)},3e3)})}),$(".unhideSchool").click(function(){var e=$(this).text();$("#status").html("Processing data please wait ...").show(400),$.post("../admin/zems_ajax.php",{sc_idTounhide:e},function(t){$(".sc_idTohide").html(e),$("#status").html("processing completed"+t),setTimeout(function(){$("#status").hide(400)},3e3),window.location.reload()})}),$("#send-comment").click(function(){var e=$(".heading-name-meta").text()+":"+$("#comment").val();$.post("../admin/zems_ajax.php",{sendComment:e},function(e){$("#this-message").html(e)}),$("#comment").val("")}),$(".attachment").click(function(){$(".attach").show()}),$(".closeAttach").click(function(){$(".attach").hide()}),$(".editable_cell").tooltip({placement:"right",trigger:"focus"}),$(".s-finalize-w").click(function(){$(".finalizeWarning").show(400)}),$(".s-finalize-c").click(function(){$(".finalizeWarning").hide(400)}),$(".d-statistics-s").click(function(){$(".d-statistics").show(400)});