var StudentDatas;
var StudentFullProfile;
var IsActivateSUId; //Changes for Mantis Id : 0036245 By Hemali
$(document).ready(function () {
    toggleFullScreen();
    $.ajax({
        type: "POST",
        url: "/Pages/StudentManagement/StudentDetailForm.aspx/GetStudentList",
        contentType: "application/json;charset=utf-8",
        dataType: "json",
        success: function (data) {
            IsActivateSUId = document.getElementById('ctl00_CP_IsActivateSUIdHiddenField').value;
            StudentDatas = $.parseJSON(data.d);
            let params = (new URL(document.location)).searchParams;
            let name = params.get("StudentId");
            //if (name != sessionStorage.getItem("StudentId")) { name = sessionStorage.getItem("StudentId"); }
            if ((name == null || name != sessionStorage.getItem("StudentId_Name")) && document.referrer.split("/").pop() == "StudentDetailForm.aspx") {
                name = sessionStorage.getItem("StudentId_Name");
            }
            else {
                if (window.location.href.indexOf("StudentId") == -1) {
                    sessionStorage.removeItem('StudentId_Name');
                }
            }
            let pagename = params.get("Page");
            let IsOverview = params.get("IsOverView");
            if (name != null) {
                $.ajax({
                    type: "POST",
                    url: "/Pages/StudentManagement/StudentDetailForm.aspx/GetStudentListWithStudentId",
                    data: '{"Student":"' + name + '"}',
                    contentType: "application/json;charset=utf-8",
                    dataType: "json",
                    success: function (studentdata) {
                        var Student = $.parseJSON(studentdata.d);
                        if (typeof (history.pushState) != "undefined") {
                            var obj = { Title: document.title, Url: window.parent.location.pathname };
                            history.pushState(obj, obj.Title, obj.Url);
                        } else {
                            window.parent.location = window.parent.location.pathname;
                        }
                        selectStudent(Student[0].StudentData, true);
                        if (window.parent.location.href.match(/StudentId=/)) {

                            setTimeout(function () {
                                // call your code here that you want to run after all $(document).ready() calls have run
                                // Previous Page Conditions
                                if (IsOverview != null) {
                                    if (IsOverview == 'True') {
                                        OverviewShow();
                                    }
                                } else {
                                    var PreviousPage = document.referrer.split("/").pop();
                                    if (PreviousPage == "ChangeClass.aspx" ||
                                        PreviousPage == "DivisionAllotment.aspx" ||
                                        PreviousPage == "AssignRoute.aspx" ||
                                        PreviousPage == "AttendanceRegister.aspx" ||
                                        PreviousPage == "AssignRoom.aspx") {
                                        OverviewShow();
                                    }
                                    else if (PreviousPage == "StudentDetailUpdate.aspx" ||
                                        PreviousPage == "IDNoGeneration.aspx" ||
                                        PreviousPage == "SUIDGeneration.aspx" ||
                                        PreviousPage == "StudentFullProfile.aspx?ScreenSource=Search" ||
                                        PreviousPage == "StudentSibling.aspx" ||
                                        PreviousPage == "ChangeIdLog.aspx" ||
                                        PreviousPage == "StudentAllDetails.aspx" ||
                                        PreviousPage == "StudentICard.aspx") {
                                        StudentFullProfileShow();
                                    }
                                    else if (PreviousPage == "FeeReceipt.aspx" ||
                                        PreviousPage == "PayStudentFee.aspx" ||
                                        PreviousPage == "AssignOptionalFee.aspx" ||
                                        PreviousPage == "ReceiptChequeClear.aspx" ||
                                        PreviousPage == "FeeRefund.aspx" ||
                                        PreviousPage == "AssignOptionalFee.aspx" ||
                                        PreviousPage == "FeeReportCriteria.aspx" ||
                                        PreviousPage == "SMSPredefine.aspx?ModuleId=154" ||
                                        PreviousPage == "AssignExemptionType.aspx") {
                                        FeeDetailsShow();
                                    }
                                    else if (PreviousPage == "Bonafide.aspx" ||
                                    PreviousPage == "Leaving.aspx" ||
                                    PreviousPage == "Character.aspx" ||
                                    PreviousPage == "FirstTrial.aspx" ||
                                    PreviousPage == "Transfer.aspx") {
                                        CertificateDetailsShow();
                                    }
                                    else if (PreviousPage == "MyLeaveRequest.aspx" ||
                                        PreviousPage == "SMSPredefine.aspx?ModuleId=153") {
                                        AttendanceDetailsShow();
                                    }
                                    else if (PreviousPage == "OptionalSubject.aspx" ||
                                        PreviousPage == "StudentResult.aspx") {
                                        AssessmentDetailsShow();
                                    }
                                    else if (PreviousPage == "UploadStudentdocument.aspx" ||
                                        PreviousPage == "UploadStudentPhoto.aspx") {
                                        PhotoAndDocumentDetailsShow();
                                    }
                                    else if (PreviousPage == "ChargeReceipt.aspx") {
                                        ChargeDetailsShow();
                                    }
                                    else if (PreviousPage == "SMSPredefine.aspx" ||
                                    PreviousPage == "SMSToAll.aspx" ||
                                    PreviousPage == "SMSHistory.aspx") {
                                        AlertDetailsShow();
                                    }
                                    else if (PreviousPage == "DepositAdd.aspx" ||
                                        PreviousPage == "DepositAdjustment.aspx" ||
                                        PreviousPage == "DepositRefund.aspx") {
                                        DepositDetailsShow();
                                    }
                                    else if (PreviousPage == "ChangeRoom.aspx" ||
                                        PreviousPage == "HostelStudentGatePassNew.aspx" ||
                                        PreviousPage == "StudentLedger.aspx" ||
                                        PreviousPage == "UpdateHostelFee.aspx") {
                                        HostelDetailsShow();
                                    }
                                    else if (PreviousPage == "ChangeRoute.aspx" ||
                                    PreviousPage == "UpdateTransportFee.aspx") {
                                        TransportDetailsShow();
                                    }
                                    else if (PreviousPage == "BookIssueReturn.aspx" ||
                                    PreviousPage == "SMSPredefine.aspx?ModuleId=210") {
                                        LibraryDetailsShow();
                                    }
                                    if (pagename != null) {
                                        if (pagename == 'SelectTransport') {
                                            alert('Transport not assigned');
                                            OverviewShow();
                                        }
                                        if (pagename == 'SelectHostel') {
                                            alert('Hostel not assigned');
                                            OverviewShow();
                                        }
                                        if (pagename == 'SelectLibrary') {
                                            alert('Library not assigned');
                                            OverviewShow();
                                        }
                                    }
                                }
                            }, 300);
                        }
                    }
                });
            }
        }
    });
});

$(window).load(function () {

});

document.addEventListener('keydown', function (e) {
    // Please Add this Page name in StudentSearch.js KeyDown event so that the keydown event is not triggered twice
    var tag = $(e.target).attr("id");
    var tag1 = $(e.target).attr('class');
    var tag1 = $(e.target).attr('class');
    if (tag1 == "studentautosearchitem" && (e.keyCode == 37 || e.keyCode == 38 || e.keyCode == 39 || e.keyCode == 40)) {
        switch (e.keyCode) {
            case 38: case 40: e.preventDefault();
        }
    }
    if ((tag == "ctl00_CP_StudentAutoSearchTextBox" || e.keyCode == 13) || (e.keyCode == 13 || tag1 == "studentautosearchitem")) {
        Focus();
    }
});

$(document).mouseup(function (e) {
    var container = $("#ctl00_CP_AutoSearchSuggestion");

    // if the target of the click isn't the container nor a descendant of the container
    if (!container.is(e.target) && container.has(e.target).length === 0) {
        document.getElementById("AutoSearchSuggestion").hidden = true;
    }
});

function Search(obj) {
    if (obj.id == 'ctl00_CP_StudentAutoSearchTextBox') {
        if ($(obj).val().length < 2) {
            $('#StudentRightPane').hide();
            $('#ButtonList').hide();
            return;
        }
        var AutoCompleteData = '<ul id="StudentData" style="padding:5px;background-color:#eee;display:inline-block;z-index:200;position:absolute;width: 300px; height: 150px; overflow: auto">';
        if (StudentDatas != '' && $(obj).val() != '') {
            for (var i = 0; i < StudentDatas.length; i++) {
                if (StudentDatas[i].StudentData.toLowerCase().includes($(obj).val().toLowerCase())) {
                    AutoCompleteData += '<li class="studentautosearchitem" tabindex="' + (i + 1) + '" onClick="selectStudent(\'' + StudentDatas[i].StudentData + '\',false);">' + StudentDatas[i].StudentData + '</li>';
                }
            }
        }
        AutoCompleteData += '</ul>';
        document.getElementById("AutoSearchSuggestion").innerHTML = AutoCompleteData;
        if (document.getElementById("AutoSearchSuggestion").innerHTML != '')
            document.getElementById("AutoSearchSuggestion").hidden = false;
    }
}

function Focus() {
    var keyCode = window.event.keyCode;
    if (keyCode !== 38 && keyCode !== 40 && keyCode !== 13) return;

    var current = document.activeElement;
    let items = [];
    for (i = 0; i < document.getElementsByClassName('studentautosearchitem').length; i++) {
        items[i] = document.getElementsByClassName('studentautosearchitem')[i];
    }
    var currentIndex = items.indexOf(current);
    var newIndex;

    if (keyCode == 13) {
        selectStudent(items[currentIndex].innerHTML, true);
    }
    else {
        if (currentIndex === -1) {
            newIndex = 0
        } else {
            if (keyCode === 38) newIndex = (currentIndex + items.length - 1) % items.length
            else newIndex = (currentIndex + 1) % items.length
        }
        items[newIndex].focus();
    }
}

function selectStudent(val, IsEnter) {
    $("#ctl00_CP_StudentAutoSearchTextBox").val(val);
    var str = $("#ctl00_CP_StudentAutoSearchTextBox").val();
    if (!IsEnter)
        str = str.substring(0, str.length);

    $("#ctl00_CP_StudentAutoSearchTextBox").val(str);
    document.getElementById("AutoSearchSuggestion").hidden = true;
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/StudentProfileGet",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                var StudentProfile = $.parseJSON(data.d);
                if (StudentProfile.length > 0) {
                    sessionStorage.removeItem('StudentId_Name');
                    sessionStorage.setItem("StudentId_Name", StudentProfile[0].Id);
                    $('#StudentRightPane').show();
                    $('#ButtonList').show();
                    StudentFullProfileGet();
                    OverviewShow();
                    //Class Details
                    //document.getElementById("ClassDivisionLabel").innerText = StudentProfile[0].ClassDiv;
                    //document.getElementById("RollNoLabel").innerText = StudentProfile[0].RollNo;
                    //document.getElementById("ClassTeacherLabel").innerText = StudentProfile[0].TeacherFullName;

                    //General Details
                    document.getElementById("ContactDetailsFatherNameLabel").innerText = StudentProfile[0].FatherName;
                    document.getElementById("ContactDetailsMotherNameLabel").innerText = StudentProfile[0].MotherName;
                    document.getElementById("ContactDetailsFatherContactNo").innerText = StudentProfile[0].FatherContactNo;
                    document.getElementById("ContactDetailsMotherContactNo").innerText = StudentProfile[0].MotherContactNo;

                    document.getElementById("NameLabel").innerText = StudentProfile[0].StudentName;
                    if (StudentProfile[0].StatusId == 1)
                        document.getElementById("StatusLabel").innerText = "Active";
                    else if (StudentProfile[0].StatusId == 2)
                        document.getElementById("StatusLabel").innerText = "InActive";
                    else if (StudentProfile[0].StatusId == 3)
                        document.getElementById("StatusLabel").innerText = "Left";
                    document.getElementById("CodeLabel").innerText = StudentProfile[0].Code;
                    document.getElementById("GenderLabel").innerText = StudentProfile[0].Gender;
                    document.getElementById("ClassDivisionMainLabel").innerText = StudentProfile[0].ClassDiv;
                    document.getElementById("RollNoMainLabel").innerText = StudentProfile[0].RollNo;
                    document.getElementById("ClassTeacherMainLabel").innerText = StudentProfile[0].TeacherFullName;
                    document.getElementById("BirthDateLabel").innerText = DateTimeConverter(StudentProfile[0].DateOfBirth);
                    document.getElementById("StatusLabel").innerText = StudentProfile[0].Status;
                    if (IsActivateSUId == "True") {
                        document.getElementById("SUIDDiv").hidden = false;
                        document.getElementById("SUIDLabel").hidden = false;
                        document.getElementById("SUIDLabel").innerText = StudentProfile[0].SUId;
                    }
                    else {
                        document.getElementById("SUIDDiv").hidden = true;
                        document.getElementById("SUIDLabel").hidden = true;
                    }


                    //document.getElementById("Parent1NameLabel").innerText = StudentProfile[0].FatherName;
                    //document.getElementById("Parent2NameLabel").innerText = StudentProfile[0].MotherName;
                    //document.getElementById("ParentContactNoLabel").innerText = StudentProfile[0].ParentContactNo;
                    //document.getElementById("ParentEmailLabel").innerText = StudentProfile[0].ParentEmail
                    //document.getElementById("FatherEmailLabel").innerText = StudentProfile[0].FatherMail
                    //document.getElementById("FatherContactNoLabel").innerText = StudentProfile[0].FatherContactNo
                    //document.getElementById("MotherEmailLabel").innerText = StudentProfile[0].MotherMail
                    //document.getElementById("MotherContactNoLabel").innerText = StudentProfile[0].MotherContactNo
                    //document.getElementById("PresentAddressLabel").innerText = StudentProfile[0].PresentAddress
                    //document.getElementById("PresentContactNoLabel").innerText = StudentProfile[0].PresentContactNo;
                    if (StudentProfile[0].StudentPhoto.length > 4)
                        document.getElementById("StudentImage").src = 'data:image/jpg;base64,' + arrayBufferToBase64(StudentProfile[0].StudentPhoto);
                    else {
                        if (StudentProfile[0].GenderId == "1")
                            document.getElementById("StudentImage").src = "../../Images/BoyNoImage.png";
                        else if (StudentProfile[0].GenderId == "2")
                            document.getElementById("StudentImage").src = "../../Images/GirlNoImage.png";
                    }
                    if (StudentProfile[0].QRCode.length > 4)
                        document.getElementById("QRCodeImage").src = 'data:image/jpg;base64,' + arrayBufferToBase64(StudentProfile[0].QRCode);

                    //Transport
                    document.getElementById("PickupRouteLabel").innerText = StudentProfile[0].BusRoute;
                    document.getElementById("PickupPointLabel").innerText = StudentProfile[0].BusRouteDestination;
                    document.getElementById("DropRouteLabel").innerText = StudentProfile[0].DropRoute;
                    document.getElementById("DropPointLabel").innerText = StudentProfile[0].DropDestination;

                    if (document.getElementById("PickupRouteLabel").innerText == '') {
                        $('#ctl00_CP_TransportSelectOverViewDiv').show();
                        $('#ctl00_CP_TransportSelectTransportDiv').show();
                    }
                    else {
                        $('#ctl00_CP_TransportSelectOverViewDiv').hide();
                        $('#ctl00_CP_TransportSelectTransportDiv').hide();
                    }

                    //HostelDetails
                    document.getElementById("HostelLabel").innerText = StudentProfile[0].Hostel;
                    document.getElementById("RoomNoLabel").innerText = StudentProfile[0].RoomNo;

                    if (document.getElementById("HostelLabel").innerText == '') {
                        $('#ctl00_CP_HostelSelectOverViewDiv').show();
                        $('#ctl00_CP_HostelSelectTransportDiv').show();
                    }
                    else {
                        $('#ctl00_CP_HostelSelectOverViewDiv').hide();
                        $('#ctl00_CP_HostelSelectTransportDiv').hide();
                    }

                    //AttendanceDetails
                    document.getElementById("TotalPresentLabel").innerText = StudentProfile[0].PresentCount;
                    document.getElementById("TotalDaysLabel").innerText = (parseFloat(StudentProfile[0].PresentCount) + parseFloat(StudentProfile[0].AbsentCount)).toString();
                    document.getElementById("PresentPercentageLabel").innerText = (parseFloat(StudentProfile[0].PresentCount) / (parseFloat(StudentProfile[0].PresentCount + parseFloat(StudentProfile[0].AbsentCount))) * 100).toFixed(2).toString() + ' %';

                    //Deposit
                    document.getElementById("DepositCreditAmountLabel").innerText = StudentProfile[0].DepositCreditAmount;
                    document.getElementById("DepositDebitAmountLabel").innerText = StudentProfile[0].DepositDebitAmount;
                    document.getElementById("DepositBalanceAmountLabel").innerText = (parseFloat(StudentProfile[0].DepositCreditAmount) - parseFloat(StudentProfile[0].DepositDebitAmount)).toString();

                    //Fee
                    document.getElementById("FeePaidAmountLabel").innerText = StudentProfile[0].FeePaidAmount;
                    document.getElementById("FeePendingAmountLabel").innerText = StudentProfile[0].FeePendingAmount;
                    document.getElementById("TotalFeeAmountLabel").innerText = StudentProfile[0].FeeTotalAmount;

                    //Assessment 
                    if (StudentProfile[0].ExamPercentage != '') {
                        var ExamList = StudentProfile[0].ExamPercentage.split(',');
                        document.getElementById("PublishedExamsLabel").innerText = '';
                        document.getElementById("AssessmentPercentageLabel").innerText = '';
                        for (var i = 0; i < ExamList.length; i++) {
                            document.getElementById("PublishedExamsLabel").innerText = document.getElementById("PublishedExamsLabel").innerText + ExamList[i].split('(')[0] + ',';
                            document.getElementById("AssessmentPercentageLabel").innerText = document.getElementById("AssessmentPercentageLabel").innerText + ExamList[i].split('(')[1].split(')')[0] + ',';
                        }
                        document.getElementById("PublishedExamsLabel").innerText = document.getElementById("PublishedExamsLabel").innerText.replace(/,\s*$/, "");;
                        document.getElementById("AssessmentPercentageLabel").innerText = document.getElementById("AssessmentPercentageLabel").innerText.replace(/,\s*$/, "");;
                    }

                    //OnlineLearningLectures
                    document.getElementById("LectureListLabel").innerText = StudentProfile[0].OnlineLearningLectures;
                    document.getElementById("BarcodeImage").src = textToBase64Barcode(StudentProfile[0].BarcodeNumber); //changes for mantis Id :0034804 By Hemali
                    // Sibling Details
                    $.ajax({
                        type: "POST",
                        url: "/Pages/StudentManagement/StudentDetailForm.aspx/StudentSiblingDetailsGet",
                        data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '"}',
                        contentType: "application/json;charset=utf-8",
                        dataType: "json",
                        success: function (data) {
                            var StudentSiblingDetails = $.parseJSON(data.d);
                            var html = '';
                            if (StudentSiblingDetails.length > 0) {
                                for (var i = 0; i < StudentSiblingDetails.length; i++) {
                                    html += '<tr><td style="color:Black;overflow-wrap:anywhere;"><a style="color: #03afc5 !important;" onclick=\'LoadSiblingDetails(' + StudentSiblingDetails[i].LinkedStudentId + ')\'>' + StudentSiblingDetails[i].Code + '</a></td>';
                                    html += '<td align="left" scope="col">' + StudentSiblingDetails[i].Name + '</td>';
                                    html += '<td align="left" scope="col">' + StudentSiblingDetails[i].DivDept + '</td></tr>';
                                }
                                $('#dvSiblingGridDiv').html(html);
                            }
                        }
                    });

                    $.ajax({
                        type: "POST",
                        url: "/Pages/StudentManagement/StudentDetailForm.aspx/StudentTeacherSubjectDetailsGet",
                        data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '"}',
                        contentType: "application/json;charset=utf-8",
                        dataType: "json",
                        success: function (data) {
                            var StudentTeacherSubjectDetails = $.parseJSON(data.d);
                            var html = '';
                            if (StudentTeacherSubjectDetails.length > 0) {
                                for (var i = 0; i < StudentTeacherSubjectDetails.length; i++) {
                                    html += '<tr><td align="left" scope="col">' + StudentTeacherSubjectDetails[i].SubjectName + '</td>';
                                    html += '<td align="left" scope="col">' + StudentTeacherSubjectDetails[i].TeacherName + '</td></tr>';
                                }
                                $('#dvTeacherSubjectGridDiv').html(html);
                            }
                        }
                    });
                    $.ajax({
                        type: "POST",
                        url: "/Pages/StudentManagement/StudentDetailForm.aspx/StudentBehaviorDetailsGet",
                        data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '"}',
                        contentType: "application/json;charset=utf-8",
                        dataType: "json",
                        success: function (data) {
                            var StudentBehaviorDetails = data.d;
                            var html = '';
                            if (StudentBehaviorDetails.length > 0) {
                                html += StudentBehaviorDetails;
                                $('#dvBehaviorGridDiv').html(html);
                            }
                            else {
                                $('#dvBehaviorGridDiv').html('<tr><td colspan=3>No Record found !</td><tr>');
                            }
                        }
                    });
                }
            }
        });
    }
}

function LoadSiblingDetails(StudentId) {
    $.ajax({
        type: "POST",
        url: "/Pages/StudentManagement/StudentDetailForm.aspx/ValidateSibling",
        data: '{"SiblingId":"' + StudentId + '"}',
        contentType: "application/json;charset=utf-8",
        dataType: "json",
        success: function (data) {
            if (data.d == "1")
                window.location = '/Pages/StudentManagement/StudentDetailForm.aspx?StudentId=' + StudentId;
            else
                alert('Sibling should be active or in same organization and batch');
        }
    });
}

function OverviewShow() {
    $('#ctl00_CP_DashBoardDiv').show();
    $('#ctl00_CP_StudentFullProfileDiv').hide();
    $('#ctl00_CP_FeeDiv').hide();
    $('#ctl00_CP_AttendanceDiv').hide();
    $('#ctl00_CP_AssessmentDiv').hide();
    $('#ctl00_CP_CertificateDiv').hide();
    $('#ctl00_CP_DepositDiv').hide();
    $('#ctl00_CP_AlertDiv').hide();
    $('#ctl00_CP_HostelDiv').hide();
    $('#ctl00_CP_TransportDiv').hide();
    $('#ctl00_CP_LibraryDiv').hide();
    $('#ctl00_CP_OnlinePaymentDiv').hide();
    $('#ctl00_CP_ChargeDiv').hide();
    $('#ctl00_CP_OnlineLearningDiv').hide();
    $('#ctl00_CP_PhotoAndDocumentDiv').hide();

    $("#ctl00_CP_OverviewList").addClass("active");
    $("#ctl00_CP_StudentDetailsList").removeClass("active");
    $("#ctl00_CP_FeeList").removeClass("active");
    $("#ctl00_CP_AttendanceList").removeClass("active");
    $("#ctl00_CP_AssessmentList").removeClass("active");
    $("#ctl00_CP_CertificateList").removeClass("active");
    $("#ctl00_CP_ChargeList").removeClass("active");
    $("#ctl00_CP_DepositList").removeClass("active");
    $("#ctl00_CP_PhotosAndDocumentList").removeClass("active");
    $("#ctl00_CP_AlertList").removeClass("active");
    $("#ctl00_CP_HostelList").removeClass("active");
    $("#ctl00_CP_TransportList").removeClass("active");
    $("#ctl00_CP_LibraryList").removeClass("active");
    $("#ctl00_CP_OnlinePaymentList").removeClass("active");
    $("#ctl00_CP_OnlineLearningList").removeClass("active");

    $("#ChangeClassRedirectButton").show();
    $("#ChangeDivisionRedirectButton").show();
}

function StudentFullProfileShow() {
    $('#ctl00_CP_DashBoardDiv').hide();
    $('#ctl00_CP_StudentFullProfileDiv').show();
    $('#ctl00_CP_FeeDiv').hide();
    $('#ctl00_CP_AttendanceDiv').hide();
    $('#ctl00_CP_AssessmentDiv').hide();
    $('#ctl00_CP_CertificateDiv').hide();
    $('#ctl00_CP_DepositDiv').hide();
    $('#ctl00_CP_AlertDiv').hide();
    $('#ctl00_CP_HostelDiv').hide();
    $('#ctl00_CP_TransportDiv').hide();
    $('#ctl00_CP_LibraryDiv').hide();
    $('#ctl00_CP_OnlinePaymentDiv').hide();
    $('#ctl00_CP_OnlineLearningDiv').hide();
    $('#ctl00_CP_ChargeDiv').hide();
    $('#ctl00_CP_PhotoAndDocumentDiv').hide();

    $("#ChangeClassRedirectButton").hide();
    $("#ChangeDivisionRedirectButton").hide();


    $("#ctl00_CP_OverviewList").removeClass("active");
    $("#ctl00_CP_StudentDetailsList").addClass("active");
    $("#ctl00_CP_FeeList").removeClass("active");
    $("#ctl00_CP_AttendanceList").removeClass("active");
    $("#ctl00_CP_AssessmentList").removeClass("active");
    $("#ctl00_CP_CertificateList").removeClass("active");
    $("#ctl00_CP_ChargeList").removeClass("active");
    $("#ctl00_CP_DepositList").removeClass("active");
    $("#ctl00_CP_PhotosAndDocumentList").removeClass("active");
    $("#ctl00_CP_AlertList").removeClass("active");
    $("#ctl00_CP_HostelList").removeClass("active");
    $("#ctl00_CP_TransportList").removeClass("active");
    $("#ctl00_CP_LibraryList").removeClass("active");
    $("#ctl00_CP_OnlinePaymentList").removeClass("active");
    $("#ctl00_CP_OnlineLearningList").removeClass("active");

    document.getElementById("AutoSearchSuggestion").hidden = true;
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        if (StudentFullProfile.length > 0) {

            //Basic Details
            document.getElementById("FullProfileStudentImage").src = 'data:image/jpg;base64,' + arrayBufferToBase64(StudentFullProfile[0].StudentPhoto);
            document.getElementById("ctl00_CP_FullProfileNameLabel").innerText = StudentFullProfile[0].StudentName;
            document.getElementById("ctl00_CP_BatchNameLabel").innerText = StudentFullProfile[0].AcademicYear;
            document.getElementById("ctl00_CP_FullProfileClassDivisionLabel").innerText = StudentFullProfile[0].ClassDiv;
            document.getElementById("ctl00_CP_FullProfileCodeLabel").innerText = StudentFullProfile[0].Code;
            document.getElementById("ctl00_CP_FullProfileRollNoLabel").innerText = StudentFullProfile[0].RollNo;

            //Teacher details
            document.getElementById("ctl00_CP_FullProfileTeacherNameLabel").innerText = StudentFullProfile[0].TeacherFullName;
            document.getElementById("ctl00_CP_FullProfileTeacherDesignationLabel").innerText = StudentFullProfile[0].TeacherDesignation;
            document.getElementById("ctl00_CP_FullProfileTeacherQualificationLabel").innerText = StudentFullProfile[0].TeacherQualification;

            //Admission Details
            document.getElementById("ctl00_CP_AdmissionStandardLabel").innerText = StudentFullProfile[0].AdmissionStandard;
            document.getElementById("ctl00_CP_AdmissionDateLabel").innerText = DateTimeConverter(StudentFullProfile[0].AdmissionDate) == '0NaN/0NaN/NaN' ? '' : DateTimeConverter(StudentFullProfile[0].AdmissionDate);
            document.getElementById("ctl00_CP_PreviousSchoolLabel").innerText = StudentFullProfile[0].PreviousSchool;
            document.getElementById("ctl00_CP_StudentCategoryLabel").innerText = StudentFullProfile[0].StudentAdmissionCategory;
            document.getElementById("ctl00_CP_PreviousStandardLabel").innerText = StudentFullProfile[0].PreviousSchool;

            //Left Details
            document.getElementById("ctl00_CP_InactiveDateLabel").innerText = DateTimeConverter(StudentFullProfile[0].InactiveDate) == '0NaN/0NaN/NaN' ? '' : DateTimeConverter(StudentFullProfile[0].InactiveDate);
            document.getElementById("ctl00_CP_LeftDateLabel").innerText = DateTimeConverter(StudentFullProfile[0].LeftDate) == '0NaN/0NaN/NaN' ? '' : DateTimeConverter(StudentFullProfile[0].LeftDate);
            document.getElementById("ctl00_CP_LeftStandardLabel").innerText = StudentFullProfile[0].LeftStandard;
            document.getElementById("ctl00_CP_LcNumberLabel").innerText = StudentFullProfile[0].LCNumber;
            document.getElementById("ctl00_CP_LcDateLabel").innerText = DateTimeConverter(StudentFullProfile[0].LCDate) == '0NaN/0NaN/NaN' ? '' : DateTimeConverter(StudentFullProfile[0].LCDate);

            //College Admission Detials
            document.getElementById("ctl00_CP_IsTransferLabel").innerText = StudentFullProfile[0].IsTransfer;
            document.getElementById("ctl00_CP_TransferFromLabel").innerText = StudentFullProfile[0].TransferFrom;
            document.getElementById("ctl00_CP_IsCertificateHolderCheckBox").innerText = StudentFullProfile[0].IsCertificateHolder;
            document.getElementById("ctl00_CP_IsCertificateHolderLabel").innerText = StudentFullProfile[0].CertificateName;
            document.getElementById("ctl00_CP_IsTFWSLabel").innerText = StudentFullProfile[0].IsTFWS;
            document.getElementById("ctl00_CP_MaritalStatusLabel").innerText = StudentFullProfile[0].MaritalStatus;

            //SSC Details
            document.getElementById("ctl00_CP_SSCBoardLabel").innerText = StudentFullProfile[0].SSCBoard;
            document.getElementById("ctl00_CP_SSCSchoolLabel").innerText = StudentFullProfile[0].SSCSchool;
            document.getElementById("ctl00_CP_SSCPassingYearLabel").innerText = StudentFullProfile[0].SSCPassingYear;
            document.getElementById("ctl00_CP_SSCObtainMarksLabel").innerText = StudentFullProfile[0].SSCObtainMarks;
            document.getElementById("ctl00_CP_SSCOutOfMarksLabel").innerText = StudentFullProfile[0].SSCOutOfMarks;
            document.getElementById("ctl00_CP_SSCMathMarksLabel").innerText = StudentFullProfile[0].SSCMathMarks;
            document.getElementById("ctl00_CP_SSCMathOutOfMarksLabel").innerText = StudentFullProfile[0].SSCMathOutOfMarks;

            //HSC Details
            document.getElementById("ctl00_CP_HSCBoardLabel").innerText = StudentFullProfile[0].HSCBoard;
            document.getElementById("ctl00_CP_HSCSchoolLabel").innerText = StudentFullProfile[0].HSCSchool;
            document.getElementById("ctl00_CP_HSCPassingYearLabel").innerText = StudentFullProfile[0].HSCPassingYear;
            document.getElementById("ctl00_CP_HSCOutOfMarksLabel").innerText = StudentFullProfile[0].HSCOutOfMarks;
            document.getElementById("ctl00_CP_HSCPercentageLabel").innerText = StudentFullProfile[0].HSCPercentage;
            document.getElementById("ctl00_CP_HSCPhysicsMarksLabel").innerText = StudentFullProfile[0].HSCPhysicsMarks;
            document.getElementById("ctl00_CP_HSCPhysicsOutOfMarksLabel").innerText = StudentFullProfile[0].HSCPhysicsOutOfMarks;
            document.getElementById("ctl00_CP_HSCChemistryMarksLabel").innerText = StudentFullProfile[0].HSCChemistryMarks;
            document.getElementById("ctl00_CP_HSCChemistryOutOfMarksLabel").innerText = StudentFullProfile[0].HSCChemistryOutOfMarks;
            document.getElementById("ctl00_CP_HSCMathMarksLabel").innerText = StudentFullProfile[0].HSCMathMarks;
            document.getElementById("ctl00_CP_HSCMathOutOfMarksLabel").innerText = StudentFullProfile[0].HSCMathOutOfMarks;
            document.getElementById("ctl00_CP_HSCBiologyMarksLabel").innerText = StudentFullProfile[0].HSCBiologyMarks;
            document.getElementById("ctl00_CP_HSCBiologyOutOfMarksLabel").innerText = StudentFullProfile[0].HSCBiologyOutOfMarks;
            document.getElementById("ctl00_CP_PCMMarksLabel").innerText = StudentFullProfile[0].PCMMarks;
            document.getElementById("ctl00_CP_PCBMarksLabel").innerText = StudentFullProfile[0].PCBMarks;

            //JEE Result Details
            document.getElementById("ctl00_CP_JEERollNoLabel").innerText = StudentFullProfile[0].JEERollNo;
            document.getElementById("ctl00_CP_JEEMeritNoLabel").innerText = StudentFullProfile[0].JEEMeritNo;
            document.getElementById("ctl00_CP_JEEMeritMarksLabel").innerText = StudentFullProfile[0].JEEMeritMarks;
            document.getElementById("ctl00_CP_JEEOutOfMarksLabel").innerText = StudentFullProfile[0].JEEOutOfMarks;

            //Diploma Result Details
            document.getElementById("ctl00_CP_DiplomaBoardLabel").innerText = StudentFullProfile[0].DiplomaBoard;
            document.getElementById("ctl00_CP_DiplomaCollegeLabel").innerText = StudentFullProfile[0].DiplomaCollege;
            document.getElementById("ctl00_CP_DiplomaPassingYearLabel").innerText = StudentFullProfile[0].DiplomaPassingYear;
            document.getElementById("ctl00_CP_DiplomaObtainMarksLabel").innerText = StudentFullProfile[0].DiplomaObtainMarks;
            document.getElementById("ctl00_CP_DiplomaOutOfMarksLabel").innerText = StudentFullProfile[0].DiplomaOutOfMarks;
            document.getElementById("ctl00_CP_DiplomaPercentageLabel").innerText = StudentFullProfile[0].DiplomaPercentage;
            document.getElementById("ctl00_CP_ApplicationNoLabel").innerText = StudentFullProfile[0].ApplicationNo;
            document.getElementById("ctl00_CP_AdmissionRoundLabel").innerText = StudentFullProfile[0].AdmissionRound;

            //Demographic Details
            document.getElementById("ctl00_CP_DateOfBirthLabel").innerText = DateTimeConverter(StudentFullProfile[0].DateOfBirth) == '0NaN/0NaN/NaN' ? '' : DateTimeConverter(StudentFullProfile[0].DateOfBirth);
            document.getElementById("ctl00_CP_BirthDateInWordLabel").innerText = StudentFullProfile[0].BirthDateInWord;
            document.getElementById("ctl00_CP_BirthPlaceLabel").innerText = StudentFullProfile[0].BirthPlace;
            document.getElementById("ctl00_CP_BirthDistrictLabel").innerText = StudentFullProfile[0].BirthDistrict;
            document.getElementById("ctl00_CP_DemographicGenderLabel").innerText = StudentFullProfile[0].Gender;
            document.getElementById("ctl00_CP_ReligionLabel").innerText = StudentFullProfile[0].Religion;
            document.getElementById("ctl00_CP_FamilyCasteLabel").innerText = StudentFullProfile[0].FamilyCast;
            document.getElementById("ctl00_CP_CasteCategoryLabel").innerText = StudentFullProfile[0].CasteCategory;
            document.getElementById("ctl00_CP_MotherTongueLabel").innerText = StudentFullProfile[0].MotherTongue;
            document.getElementById("ctl00_CP_NationalityLabel").innerText = StudentFullProfile[0].Nationality;
            document.getElementById("ctl00_CP_BirthStateLabel").innerText = StudentFullProfile[0].BirthState;
            document.getElementById("ctl00_CP_BirthCountryLabel").innerText = StudentFullProfile[0].BirthCountry;

            //Communication Details
            document.getElementById("ctl00_CP_CommunicationParentEmailLabel").innerText = StudentFullProfile[0].ParentEmail;
            document.getElementById("ctl00_CP_CommunicationParentContactNoLabel").innerText = StudentFullProfile[0].ParentContactNo;
            document.getElementById("ctl00_CP_StudentEmailLabel").innerText = StudentFullProfile[0].StudentEmail;
            document.getElementById("ctl00_CP_StudentContactNoLabel").innerText = StudentFullProfile[0].StudentContactNo;
            document.getElementById("ctl00_CP_DistanceLabel").innerText = StudentFullProfile[0].PresentDistanceFromSchool;
            document.getElementById("ctl00_CP_PresentAddressLabel").innerText = StudentFullProfile[0].PresentAddress;
            document.getElementById("ctl00_CP_PresentCityLabel").innerText = StudentFullProfile[0].PresentCity;
            document.getElementById("ctl00_CP_PresentStateLabel").innerText = StudentFullProfile[0].PresentState;
            document.getElementById("ctl00_CP_PresentZipCodeLabel").innerText = StudentFullProfile[0].PresentZipCode;
            document.getElementById("ctl00_CP_CommunicationPresentContactNoLabel").innerText = StudentFullProfile[0].PresentContactNo;
            document.getElementById("ctl00_CP_EmergencyAddressLabel").innerText = StudentFullProfile[0].EmergencyAddress;
            document.getElementById("ctl00_CP_EmergencyCityLabel").innerText = StudentFullProfile[0].EmergencyCity;
            document.getElementById("ctl00_CP_EmergencyStateLabel").innerText = StudentFullProfile[0].EmergencyState;
            document.getElementById("ctl00_CP_EmergencyZipCodeLabel").innerText = StudentFullProfile[0].EmergencyState;
            document.getElementById("ctl00_CP_EmergencyContactNoLabel").innerText = StudentFullProfile[0].EmergencyContactNo;;
            document.getElementById("ctl00_CP_PermanentAddressLabel").innerText = StudentFullProfile[0].PermanentAddress;
            document.getElementById("ctl00_CP_PermanentCityLabel").innerText = StudentFullProfile[0].PermanentCity;
            document.getElementById("ctl00_CP_PermanentStateLabel").innerText = StudentFullProfile[0].PermanentState;
            document.getElementById("ctl00_CP_PermanentZipCodeLabel").innerText = StudentFullProfile[0].PermanentZipCode;
            document.getElementById("ctl00_CP_PermanentContactNoLabel").innerText = StudentFullProfile[0].PermanentContactNo;

            //Transport Details
            document.getElementById("ctl00_CP_BusRouteLabel").innerText = StudentFullProfile[0].BusRoute;
            document.getElementById("ctl00_CP_TransportBusRouteDestinationLabel").innerText = StudentFullProfile[0].BusRouteDestination;
            document.getElementById("ctl00_CP_TransportVehicleNameLabel").innerText = StudentFullProfile[0].VehicleName;
            document.getElementById("ctl00_CP_CommunicationVehicleRegistrationNumberLabel").innerText = StudentFullProfile[0].VehicleRegistrationNumber;
            document.getElementById("ctl00_CP_TransportTypeOfVehicleLabel").innerText = StudentFullProfile[0].TypeOfVehicle;
            document.getElementById("ctl00_CP_BusRouteDestinationLabel").innerText = StudentFullProfile[0].DriverName;
            document.getElementById("ctl00_CP_TransportDriverMobileNoLabel").innerText = StudentFullProfile[0].DriverMobileNo;
            document.getElementById("ctl00_CP_TransportCustomerNameLabel").innerText = StudentFullProfile[0].ConductorName;
            document.getElementById("ctl00_CP_TransportCondoctorMobileNoLabel").innerText = StudentFullProfile[0].ConductorMobileNo;
            document.getElementById("ctl00_CP_TransportDropRouteLabel").innerText = StudentFullProfile[0].DropRoute;
            document.getElementById("ctl00_CP_TransportDropPointLabel").innerText = StudentFullProfile[0].DropDestination;
            document.getElementById("ctl00_CP_TransportDropVehicleNameLabel").innerText = StudentFullProfile[0].DropVehicleName;
            document.getElementById("ctl00_CP_TransportDropVehicleRegistrationNumberLabel").innerText = StudentFullProfile[0].DropVehicleRegistrationNumber;
            document.getElementById("ctl00_CP_TransportDropTypeOfVehicleLabel").innerText = StudentFullProfile[0].DropTypeOfVehicle;
            document.getElementById("ctl00_CP_TransportDropRouteDriveNameLabel").innerText = StudentFullProfile[0].DropRouteDriverName;;
            document.getElementById("ctl00_CP_TransportDropRouteDriverMobileNoLabel").innerText = StudentFullProfile[0].DropRouteDriverMobileNo;
            document.getElementById("ctl00_CP_TransportDropRouteConductorNameLabel").innerText = StudentFullProfile[0].DropRouteConductorName;
            document.getElementById("ctl00_CP_TransportDropRouteConductorMobileNoLabel").innerText = StudentFullProfile[0].DropRouteConductorMobileNo;

            //Gov Reg. Details
            document.getElementById("ctl00_CP_UidnumberLabel").innerText = StudentFullProfile[0].UIDNumber;
            document.getElementById("ctl00_CP_AdhaarnumberLabel").innerText = StudentFullProfile[0].AdhaarNumber;

            //Family Information
            document.getElementById("ctl00_CP_FatherPhotoImg").src = arrayBufferToBase64(StudentFullProfile[0].FatherPhoto);
            document.getElementById("ctl00_CP_FatherNameLabel").innerText = StudentFullProfile[0].FatherName;
            document.getElementById("ctl00_CP_FatherQualificationLabel").innerText = StudentFullProfile[0].FatherQualification;
            document.getElementById("ctl00_CP_FatherOccupationLabel").innerText = StudentFullProfile[0].FatherOccupation;
            document.getElementById("ctl00_CP_FDFatherContactNoLabel").innerText = StudentFullProfile[0].FatherContactNo;
            document.getElementById("ctl00_CP_FatherMailLabel").innerText = StudentFullProfile[0].FatherMail;
            document.getElementById("ctl00_CP_FatherOfficeAddressLabel").innerText = StudentFullProfile[0].FatherOfficeAddress;
            document.getElementById("ctl00_CP_FatherDesignationLabel").innerText = StudentFullProfile[0].FatherDesignation;
            document.getElementById("ctl00_CP_FatherOrganizationLabel").innerText = StudentFullProfile[0].FatherOrganization;
            document.getElementById("ctl00_CP_FDIsFatherExStudent").innerText = StudentFullProfile[0].IsFatherExStudent;
            document.getElementById("ctl00_CP_FDFatherPassOutYear").innerText = StudentFullProfile[0].FatherPassOutYear;
            document.getElementById("ctl00_CP_MotherPhotoImg").src = arrayBufferToBase64(StudentFullProfile[0].MotherPhoto);
            document.getElementById("ctl00_CP_FDMotherName").innerText = StudentFullProfile[0].MotherName;
            document.getElementById("ctl00_CP_FDMotherQualification").innerText = StudentFullProfile[0].MotherQualification;
            document.getElementById("ctl00_CP_FDMotherOccupation").innerText = StudentFullProfile[0].MotherOccupation;;
            document.getElementById("ctl00_CP_FDMotherContactNo").innerText = StudentFullProfile[0].MotherContactNo;
            document.getElementById("ctl00_CP_FDMotherMail").innerText = StudentFullProfile[0].MotherMail;
            document.getElementById("ctl00_CP_FDMotherOfficeAddress").innerText = StudentFullProfile[0].MotherOfficeAddress;
            document.getElementById("ctl00_CP_FDMotherDesignation").innerText = StudentFullProfile[0].MotherDesignation;
            document.getElementById("ctl00_CP_FDMotherOrganization").innerText = StudentFullProfile[0].MotherOrganization;
            document.getElementById("ctl00_CP_FDMotherExStudent").innerText = StudentFullProfile[0].IsMotherExStudent;
            document.getElementById("ctl00_CP_FDMotherPassOutYear").innerText = StudentFullProfile[0].MotherPassOutYear;
            document.getElementById("ctl00_CP_RelativePhotoImg").src = arrayBufferToBase64(StudentFullProfile[0].RelativePhoto);
            document.getElementById("ctl00_CP_RelationshipLabel").innerText = StudentFullProfile[0].RelationShip;
            document.getElementById("ctl00_CP_RelativeNameLabel").innerText = StudentFullProfile[0].RelativeName;
            document.getElementById("ctl00_CP_RelativeQualificationLabel").innerText = StudentFullProfile[0].RelativeQualification;
            document.getElementById("ctl00_CP_RelativeOccupationLabel").innerText = StudentFullProfile[0].RelativeOccupation;
            document.getElementById("ctl00_CP_RelativeContactNoLabel").innerText = StudentFullProfile[0].RelativeContactNo;
            document.getElementById("ctl00_CP_RelativeMailLabel").innerText = StudentFullProfile[0].RelativeMail;
            document.getElementById("ctl00_CP_RelativeOfficeAddressLabel").innerText = StudentFullProfile[0].RelativeOfficeAddress;
            document.getElementById("ctl00_CP_FDRelativeDesignation").innerText = StudentFullProfile[0].RelativeDesignation;
            document.getElementById("ctl00_CP_FDRelativeOrganization").innerText = StudentFullProfile[0].RelativeOrganization;
            document.getElementById("ctl00_CP_FDIsRelativeExStudent").innerText = StudentFullProfile[0].IsRelativeExStudent;
            document.getElementById("ctl00_CP_FDRelativePassOutYear").innerText = StudentFullProfile[0].RelativePassOutYear;

            //Sibling Details
            document.getElementById("ctl00_CP_SiblingName1Label").innerText = StudentFullProfile[0].SiblingName1;
            document.getElementById("ctl00_CP_SiblingInstitue1Label").innerText = StudentFullProfile[0].SiblingInstitue1;
            document.getElementById("ctl00_CP_SiblingClass1Label").innerText = StudentFullProfile[0].SiblingClass1;
            document.getElementById("ctl00_CP_SiblingAge1Label").innerText = StudentFullProfile[0].SiblingAge1;
            document.getElementById("ctl00_CP_SiblingRelation1Label").innerText = StudentFullProfile[0].SiblingRelation1;
            document.getElementById("ctl00_CP_SiblingName2Label").innerText = StudentFullProfile[0].SiblingName2;
            document.getElementById("ctl00_CP_SiblingInstitue2Label").innerText = StudentFullProfile[0].SiblingInstitue2;
            document.getElementById("ctl00_CP_SiblingClass2Label").innerText = StudentFullProfile[0].SiblingClass2;
            document.getElementById("ctl00_CP_SiblingAge2Label").innerText = StudentFullProfile[0].SiblingAge2;
            document.getElementById("ctl00_CP_SiblingRelation2Label").innerText = StudentFullProfile[0].SiblingRelation2;
            document.getElementById("ctl00_CP_SiblingName3Label").innerText = StudentFullProfile[0].SiblingName3;
            document.getElementById("ctl00_CP_SiblingInstitue3Label").innerText = StudentFullProfile[0].SiblingInstitue3;
            document.getElementById("ctl00_CP_SiblingClass3Label").innerText = StudentFullProfile[0].SiblingClass3;
            document.getElementById("ctl00_CP_SiblingAge3Label").innerText = StudentFullProfile[0].SiblingAge3;
            document.getElementById("ctl00_CP_SiblingRelation3Label").innerText = StudentFullProfile[0].SiblingRelation3;

            //Health Details
            document.getElementById("ctl00_CP_BloodGroupLabel").innerText = StudentFullProfile[0].BloodGroup;
            document.getElementById("ctl00_CP_IdentificationMarkLabel").innerText = StudentFullProfile[0].IdentificationMark;
            document.getElementById("ctl00_CP_FamilyDoctorNameLabel").innerText = StudentFullProfile[0].FamilyDoctorName;
            document.getElementById("ctl00_CP_FamilyDoctorContactNoLabel").innerText = StudentFullProfile[0].FamilyDoctorContactNo;
            document.getElementById("ctl00_CP_IsPysicalDeformityLabel").innerText = StudentFullProfile[0].IsPysicalDeformity;
            document.getElementById("ctl00_CP_PysicalDeformityRemarkLabel").innerText = StudentFullProfile[0].PysicalDeformityRemark;
            document.getElementById("ctl00_CP_IsMajorIllnessLabel").innerText = StudentFullProfile[0].IsMajorIllness;
            document.getElementById("ctl00_CP_MajorIllnessRemarkLabel").innerText = StudentFullProfile[0].MajorIllnessRemark;
            document.getElementById("ctl00_CP_IsAllergyLabel").innerText = StudentFullProfile[0].IsAllergy;
            document.getElementById("ctl00_CP_AllergyRemarkLabel").innerText = StudentFullProfile[0].AllergyRemark;
            document.getElementById("ctl00_CP_IsPastHistoryLabel").innerText = StudentFullProfile[0].IsPastHistory;
            document.getElementById("ctl00_CP_PastHistoryRemarkLabel").innerText = StudentFullProfile[0].PastHistoryRemark;

            //Hostel Details
            document.getElementById("ctl00_CP_HostelHostelLabel").innerText = StudentFullProfile[0].Hostel;
            document.getElementById("ctl00_CP_HostelRoomNoLabel").innerText = StudentFullProfile[0].RoomNo;
            document.getElementById("ctl00_CP_WardenNameLabel").innerText = StudentFullProfile[0].WardenName;
            document.getElementById("ctl00_CP_WardenPhoneNoLabel").innerText = StudentFullProfile[0].WardenPhoneNo;
            document.getElementById("ctl00_CP_WardenExtNoLabel").innerText = StudentFullProfile[0].WardenExtNo;
            document.getElementById("ctl00_CP_WardenMobileNoLabel").innerText = StudentFullProfile[0].WardenMobileNo;
            document.getElementById("ctl00_CP_AssignedRoomByLabel").innerText = StudentFullProfile[0].AssignedRoomBy;
            document.getElementById("ctl00_CP_AssignedRoomByPhoneNoLabel").innerText = StudentFullProfile[0].AssignedRoomByPhoneNo;
            document.getElementById("ctl00_CP_AssignedRoomByExtNoLabel").innerText = StudentFullProfile[0].AssignedRoomByExtNo;
            document.getElementById("ctl00_CP_AssignedRoomByMobileNoLabel").innerText = StudentFullProfile[0].AssignedRoomByMobileNo;

            //Club Details                    
            document.getElementById("ctl00_CP_HouseLabel").innerText = StudentFullProfile[0].House;
            document.getElementById("ctl00_CP_ClubLabel").innerText = StudentFullProfile[0].Club;
            document.getElementById("ctl00_CP_CustomTagLabel").innerText = StudentFullProfile[0].CustomTag;
            document.getElementById("ctl00_CP_CustomGroupLabel").innerText = StudentFullProfile[0].CustomGroup;
            document.getElementById("ctl00_CP_StudentGroupLabel").innerText = StudentFullProfile[0].StudentGroup;
            document.getElementById("ctl00_CP_StudentOtherGroupLabel").innerText = StudentFullProfile[0].StudentOtherGroup;

            //Bank Details
            document.getElementById("ctl00_CP_BankbranchLabel").innerText = StudentFullProfile[0].BankBranch;
            document.getElementById("ctl00_CP_AccountNumbeLabel").innerText = StudentFullProfile[0].BankAccountNumber;
            document.getElementById("ctl00_CP_BankNameLabel").innerText = StudentFullProfile[0].BankName;
            document.getElementById("ctl00_CP_IFSCCodeLabel").innerText = StudentFullProfile[0].BankIFSCCode;

            //Passport Details
            document.getElementById("ctl00_CP_PassportNumberLabel").innerText = StudentFullProfile[0].PassportNumber;
            document.getElementById("ctl00_CP_PassportCountryCodeLabel").innerText = StudentFullProfile[0].PassportCountryCode;
            document.getElementById("ctl00_CP_PassportIssueDateLabel").innerText = DateTimeConverter(StudentFullProfile[0].PassportIssueDate) == '0NaN/0NaN/NaN' ? '' : DateTimeConverter(StudentFullProfile[0].PassportIssueDate);
            document.getElementById("ctl00_CP_PassportExpiryDateLabel").innerText = DateTimeConverter(StudentFullProfile[0].PassportExpiryDate) == '0NaN/0NaN/NaN' ? '' : DateTimeConverter(StudentFullProfile[0].PassportExpiryDate);
            document.getElementById("ctl00_CP_PassportTypeLabel").innerText = StudentFullProfile[0].PassportType;

            //Board Details
            document.getElementById("ctl00_CP_Class9Label").innerText = StudentFullProfile[0].Class9BoardRegistrationNumber;
            document.getElementById("ctl00_CP_Class11Label").innerText = StudentFullProfile[0].Class11BoardRegistrationNumber;

            // hideshow divs
            if (StudentFullProfile[0].TeacherId == 0 || StudentFullProfile[0].IsDisplayClassTeacherDetail == false)
                $("#ctl00_CP_TeacherDiv").hide();
            else
                $("#ctl00_CP_TeacherDiv").show();

            if (StudentFullProfile[0].IsDisplayCollegeDetail == false)
                $("#ctl00_CP_CollegeAdmissonDetailDiv").hide();
            else
                $("#ctl00_CP_CollegeAdmissonDetailDiv").show();

            if (StudentFullProfile[0].IsDisplayFamilyDetail == false)
                $("#ctl00_CP_FamilyDetailDiv").hide();
            else
                $("#ctl00_CP_FamilyDetailDiv").show();

            if (StudentFullProfile[0].IsDisplayHealthDetail == false)
                $("#ctl00_CP_HealthDetailDiv").hide();
            else
                $("#ctl00_CP_HealthDetailDiv").show();

            if (StudentFullProfile[0].IsDisplayBankDetail == false)
                $("#ctl00_CP_BankDetailDiv").hide();
            else
                $("#ctl00_CP_BankDetailDiv").show();

            if (StudentFullProfile[0].IsDisplayPassportDetail == false)
                $("#ctl00_CP_PassportDetailDiv").hide();
            else
                $("#ctl00_CP_PassportDetailDiv").show();

            if (StudentFullProfile[0].IsDisplayGOVREGNoDetail == false)
                $("#ctl00_CP_GovRegDetailDiv").hide();
            else
                $("#ctl00_CP_GovRegDetailDiv").show();

            if (StudentFullProfile[0].IsDisplayCBSEREGDetail == false)
                $("#ctl00_CP_CBSERegDetailDiv").hide();
            else
                $("#ctl00_CP_CBSERegDetailDiv").show();

            if (StudentFullProfile[0].IsDisplaySiblingDetail == false)
                $("#ctl00_CP_SiblingDetailDiv").hide();
            else
                $("#ctl00_CP_SiblingDetailDiv").show();

            if (StudentFullProfile[0].IsDisplayHostelDetail == false)
                $("#ctl00_CP_HostelDetailsDiv").hide();
            else
                $("#ctl00_CP_HostelDetailsDiv").show();

            if (StudentFullProfile[0].IsDisplayClubDetail == false)
                $("#ctl00_CP_ClubDetailDiv").hide();
            else
                $("#ctl00_CP_ClubDetailDiv").show();

            if (StudentFullProfile[0].IsDisplayTransportDetail == false)
                $("#ctl00_CP_TransportDetailDiv").hide();
            else
                $("#ctl00_CP_TransportDetailDiv").show();

            if (StudentFullProfile[0].IsDisplaySSCResultDDetail == false)
                $("#ctl00_CP_SSCresultdetailDiv").hide();
            else
                $("#ctl00_CP_SSCresultdetailDiv").show();

            if (StudentFullProfile[0].IsDisplayHSCResultDetail == false)
                $("#ctl00_CP_HSCResultDetailDiv").hide();
            else
                $("#ctl00_CP_HSCResultDetailDiv").show();

            if (StudentFullProfile[0].IsDisplayJeeDetail == false)
                $("#ctl00_CP_JeeDetailDiv").hide();
            else
                $("#ctl00_CP_JeeDetailDiv").show();

            if (StudentFullProfile[0].IsDisplayDiplomaDetail == false)
                $("#ctl00_CP_DiplomaDetailDiv").hide();
            else
                $("#ctl00_CP_DiplomaDetailDiv").show();

            if (StudentFullProfile[0].Status == 3)
                $("#ctl00_CP_LeftDetailDiv").show();
            else
                $("#ctl00_CP_LeftDetailDiv").hide();
        }
    }
}

function FeeDetailsShow() {
    $('#ctl00_CP_DashBoardDiv').hide();
    $('#ctl00_CP_StudentFullProfileDiv').hide();
    $('#ctl00_CP_FeeDiv').show();
    $('#ctl00_CP_AttendanceDiv').hide();
    $('#ctl00_CP_AssessmentDiv').hide();
    $('#ctl00_CP_CertificateDiv').hide();
    $('#ctl00_CP_DepositDiv').hide();
    $('#ctl00_CP_AlertDiv').hide();
    $('#ctl00_CP_HostelDiv').hide();
    $('#ctl00_CP_TransportDiv').hide();
    $('#ctl00_CP_LibraryDiv').hide();
    $('#ctl00_CP_OnlinePaymentDiv').hide();
    $('#ctl00_CP_OnlineLearningDiv').hide();
    $('#ctl00_CP_ChargeDiv').hide();
    $('#ctl00_CP_PhotoAndDocumentDiv').hide();

    $("#ChangeClassRedirectButton").hide();
    $("#ChangeDivisionRedirectButton").hide();

    $("#ctl00_CP_OverviewList").removeClass("active");
    $("#ctl00_CP_StudentDetailsList").removeClass("active");
    $("#ctl00_CP_FeeList").addClass("active");
    $("#ctl00_CP_AttendanceList").removeClass("active");
    $("#ctl00_CP_AssessmentList").removeClass("active");
    $("#ctl00_CP_CertificateList").removeClass("active");
    $("#ctl00_CP_ChargeList").removeClass("active");
    $("#ctl00_CP_DepositList").removeClass("active");
    $("#ctl00_CP_PhotosAndDocumentList").removeClass("active");
    $("#ctl00_CP_AlertList").removeClass("active");
    $("#ctl00_CP_HostelList").removeClass("active");
    $("#ctl00_CP_TransportList").removeClass("active");
    $("#ctl00_CP_LibraryList").removeClass("active");
    $("#ctl00_CP_OnlinePaymentList").removeClass("active");
    $("#ctl00_CP_OnlineLearningList").removeClass("active");

    document.getElementById("AutoSearchSuggestion").hidden = true;
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/FeeDetailsGet",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "Data":"FeeAllocation"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                var StudentFeeAllocationDetails = $.parseJSON(data.d);
                if (StudentFeeAllocationDetails.length > 0) {
                    var html = '';
                    for (var i = 0; i < StudentFeeAllocationDetails.length; i++) {
                        html += '<tr><td>' + StudentFeeAllocationDetails[i].FeeName + '</td>';
                        html += '<td>' + StudentFeeAllocationDetails[i].Amount + '</td>'
                        html += '<td>' + StudentFeeAllocationDetails[i].AdditionalAmount + '</td>'
                        html += '<td>' + StudentFeeAllocationDetails[i].DiscountAmount + '</td>'
                        html += '<td>' + StudentFeeAllocationDetails[i].NotApplicableAmount + '</td>'
                        html += '<td>' + StudentFeeAllocationDetails[i].PaidAmount + '</td>'
                        html += '<td>' + StudentFeeAllocationDetails[i].PendingAmount + '</td>'
                        html += '<td>' + DateTimeConverter(StudentFeeAllocationDetails[i].StartDate) + '</td>'
                        html += '<td>' + DateTimeConverter(StudentFeeAllocationDetails[i].EndDate) + '</td>'
                        var q = new Date();
                        var m = q.getMonth();
                        var d = q.getDay();
                        var y = q.getFullYear();
                        var Today = new Date(y, m, d);
                        mydate = new Date(DateTimeConverter(StudentFeeAllocationDetails[i].StartDate));
                        if (parseFloat(StudentFeeAllocationDetails[i].PendingAmount) > 0 && mydate > Today) {
                            html += '<td style="background-color:aqua">To Pay</td>'
                        }
                        else if (parseFloat(StudentFeeAllocationDetails[i].PendingAmount) > 0 && Today > mydate) {
                            html += '<td style="background-color:red">Pending</td>'
                        }
                        else
                            html += '<td style="background-color:green">Paid</td>'

                        html += '</tr>';
                    }
                    document.getElementById("dvFeeGridDiv").innerHTML = html;
                }
                else
                    $('#dvFeeGridDiv').html('<tr><td colspan="10">No Record found !</td><tr>');
            }
        });
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/FeeDetailsGet",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "Data":"ReceiptList"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                var StudentReceiptListDetails = data.d;
                if (StudentReceiptListDetails != '')
                    document.getElementById("dvReceiptGridDiv").innerHTML = StudentReceiptListDetails;
                else
                    $('#dvReceiptGridDiv').html('<tr><td colspan="8">No Record found !</td><tr>');
            }
        });
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/FeeDetailsGet",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "Data":"CancelReceiptList"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                var StudentCancelReceiptListDetails = $.parseJSON(data.d);
                if (StudentCancelReceiptListDetails[0].cancellist != '')
                    document.getElementById("dvFeeCancelGridDiv").innerHTML = StudentCancelReceiptListDetails;
                else
                    $('#dvFeeCancelGridDiv').html('<tr><td colspan="9">No Record found !</td><tr>');
            }
        });
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/FeeDetailsGet",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "Data":"OldBatchFee"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                var StudentOldBatchFeeDetails = $.parseJSON(data.d);
                if (StudentOldBatchFeeDetails.length > 0) {
                    var html = '';
                    for (var i = 0; i < StudentOldBatchFeeDetails.length; i++) {
                        html += '<tr><td>' + StudentOldBatchFeeDetails[i].ReceiptBookTitle + '</td>';
                        html += '<td>' + StudentOldBatchFeeDetails[i].BatchName + '</td>'
                        html += '<td>' + StudentOldBatchFeeDetails[i].ClassDivision + '</td>'
                        html += '<td>' + StudentOldBatchFeeDetails[i].PendingFeeName + '</td>'
                        html += '<td>' + StudentOldBatchFeeDetails[i].PendingAmount + '</td>'
                        html += '</tr>';
                    }
                    document.getElementById("dvOldBatchFeeGridDiv").innerHTML = html;
                }
                else
                    $('#dvOldBatchFeeGridDiv').html('<tr><td colspan="5">No Record found !</td><tr>');
            }
        });
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/FeeDetailsGet",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "Data":"SiblingDetails"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                var html = '';
                var StudentSiblingDetails = data.d.split('|');
                if (StudentSiblingDetails.length > 0) {
                    for (var i = 0; i < StudentSiblingDetails.length; i++) {
                        var Sibling1 = $.parseJSON(StudentSiblingDetails[i]);
                        for (var j = 0; j < Sibling1.length; j++) {
                            html += '<tr><td>' + Sibling1[0].Name + '</td>';
                            html += '<td>' + Sibling1[0].Code + '</td>'
                            html += '<td>' + Sibling1[j].FeeName + '</td>'
                            html += '<td>' + Sibling1[j].Amount + '</td>'
                            html += '<td>' + Sibling1[j].AdditionalAmount + '</td>'
                            html += '<td>' + Sibling1[j].DiscountAmount + '</td>'
                            html += '<td>' + Sibling1[j].NotApplicableAmount + '</td>'
                            html += '<td>' + Sibling1[j].PaidAmount + '</td>'
                            html += '<td>' + Sibling1[j].PendingAmount + '</td>'
                            html += '<td>' + DateTimeConverter(Sibling1[j].StartDate) + '</td>'
                            html += '<td>' + DateTimeConverter(Sibling1[j].EndDate) + '</td>'
                            var q = new Date();
                            var m = q.getMonth();
                            var d = q.getDay();
                            var y = q.getFullYear();
                            var Today = new Date(y, m, d);
                            mydate = new Date(DateTimeConverter(Sibling1[j].StartDate));
                            if (parseFloat(Sibling1[j].PendingAmount) > 0 && mydate > Today) {
                                html += '<td style="background-color:aqua">To Pay</td>'
                            }
                            else if (parseFloat(Sibling1[j].PendingAmount) > 0 && Today > mydate) {
                                html += '<td style="background-color:red">Pending</td>'
                            }
                            else
                                html += '<td style="background-color:green">Paid</td>'

                            html += '</tr>';
                        }
                    }
                    document.getElementById("dvSiblingFeeDetailGridDiv").innerHTML = html;
                }
                else
                    $('#dvSiblingFeeDetailGridDiv').html('<tr><td colspan="12">No Record found !</td><tr>');
            }
        });
    }
}

function AttendanceDetailsShow() {
    $('#ctl00_CP_DashBoardDiv').hide();
    $('#ctl00_CP_StudentFullProfileDiv').hide();
    $('#ctl00_CP_FeeDiv').hide();
    $('#ctl00_CP_AttendanceDiv').show();
    $('#ctl00_CP_AssessmentDiv').hide();
    $('#ctl00_CP_CertificateDiv').hide();
    $('#ctl00_CP_DepositDiv').hide();
    $('#ctl00_CP_AlertDiv').hide();
    $('#ctl00_CP_HostelDiv').hide();
    $('#ctl00_CP_TransportDiv').hide();
    $('#ctl00_CP_LibraryDiv').hide();
    $('#ctl00_CP_OnlinePaymentDiv').hide();
    $('#ctl00_CP_OnlineLearningDiv').hide();
    $('#ctl00_CP_ChargeDiv').hide();
    $('#ctl00_CP_PhotoAndDocumentDiv').hide();

    $("#ChangeClassRedirectButton").hide();
    $("#ChangeDivisionRedirectButton").hide();

    $("#ctl00_CP_OverviewList").removeClass("active");
    $("#ctl00_CP_StudentDetailsList").removeClass("active");
    $("#ctl00_CP_FeeList").removeClass("active");
    $("#ctl00_CP_AttendanceList").addClass("active");
    $("#ctl00_CP_AssessmentList").removeClass("active");
    $("#ctl00_CP_CertificateList").removeClass("active");
    $("#ctl00_CP_ChargeList").removeClass("active");
    $("#ctl00_CP_DepositList").removeClass("active");
    $("#ctl00_CP_PhotosAndDocumentList").removeClass("active");
    $("#ctl00_CP_AlertList").removeClass("active");
    $("#ctl00_CP_HostelList").removeClass("active");
    $("#ctl00_CP_TransportList").removeClass("active");
    $("#ctl00_CP_LibraryList").removeClass("active");
    $("#ctl00_CP_OnlinePaymentList").removeClass("active");
    $("#ctl00_CP_OnlineLearningList").removeClass("active");

    GetAttedanceType();
}

function AssessmentDetailsShow() {
    $('#ctl00_CP_DashBoardDiv').hide();
    $('#ctl00_CP_StudentFullProfileDiv').hide();
    $('#ctl00_CP_FeeDiv').hide();
    $('#ctl00_CP_AttendanceDiv').hide();
    $('#ctl00_CP_AssessmentDiv').show();
    $('#ctl00_CP_CertificateDiv').hide();
    $('#ctl00_CP_DepositDiv').hide();
    $('#ctl00_CP_AlertDiv').hide();
    $('#ctl00_CP_HostelDiv').hide();
    $('#ctl00_CP_TransportDiv').hide();
    $('#ctl00_CP_LibraryDiv').hide();
    $('#ctl00_CP_OnlinePaymentDiv').hide();
    $('#ctl00_CP_OnlineLearningDiv').hide();
    $('#ctl00_CP_ChargeDiv').hide();
    $('#ctl00_CP_PhotoAndDocumentDiv').hide();

    $("#ChangeClassRedirectButton").hide();
    $("#ChangeDivisionRedirectButton").hide();

    $("#ctl00_CP_OverviewList").removeClass("active");
    $("#ctl00_CP_StudentDetailsList").removeClass("active");
    $("#ctl00_CP_FeeList").removeClass("active");
    $("#ctl00_CP_AttendanceList").removeClass("active");
    $("#ctl00_CP_AssessmentList").addClass("active");
    $("#ctl00_CP_CertificateList").removeClass("active");
    $("#ctl00_CP_ChargeList").removeClass("active");
    $("#ctl00_CP_DepositList").removeClass("active");
    $("#ctl00_CP_PhotosAndDocumentList").removeClass("active");
    $("#ctl00_CP_AlertList").removeClass("active");
    $("#ctl00_CP_HostelList").removeClass("active");
    $("#ctl00_CP_TransportList").removeClass("active");
    $("#ctl00_CP_LibraryList").removeClass("active");
    $("#ctl00_CP_OnlinePaymentList").removeClass("active");
    $("#ctl00_CP_OnlineLearningList").removeClass("active");

    $.ajax({
        type: "POST",
        url: "/Pages/StudentManagement/StudentDetailForm.aspx/getExamDetail",
        data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '"}',
        contentType: "application/json;charset=utf-8",
        dataType: "json",
        success: function (data) {
            var datas = data.d;
            if (datas == '') {
                $('#dvExamGridDiv').html('<tr><td colspan="13">No Record found !</td><tr>');
            }
            else {
                var AssessmentReports = '<td><input type="button" id="AdmitCard" value="&#xf02f;" onclick="PrintAdmitCard(this);" class="fas btn btn-report " /></td>';
                AssessmentReports += '<td><input type="button" id="ExamTimeTable" value="&#xf02f;" onclick="PrintExamTimeTable(this);" class="fas btn btn-report " /></td>';
                AssessmentReports += '<td><input type="button" id="ResultSheet" value="&#xf02f;" onclick="PrintResultSheet(this);" class="fas btn btn-report " /></td>';
                datas = datas.replaceAll('</tr>', AssessmentReports + '</tr>')
                $('#dvExamGridDiv').html(datas);

                var i = 0;
                var t = document.getElementById('AssessmentTable');
                $("#AssessmentTable tr").each(function () {
                    $(t.rows[i].cells[1]).hide();
                    i++
                });
            }

        },
        error: function (xhr, status, error) {

            var err = eval("(" + xhr.responseText + ")");
            console.log(err.Message);
        }
    });
}

function SelectResult(obj, ExamId) {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SelectResult",
            data: '{"ExamId":"' + ExamId + '", "Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                var datas = $.parseJSON(data.d)
                openpopup();
                if (datas[0].ResultGrid == '') {
                    $('#StudentresultDiv').show();
                    $('#dvstudentresultGridDiv').html('<tr><td colspan="9">No Record found !</td><tr>');
                }
                else {
                    $('#StudentresultDiv').show();
                    $('#dvstudentresultGridDiv').html(datas[0].ResultGrid);
                }
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function Closepopup() {
    $('.hls-bg').hide();
    $('#dvresultpopup').hide();
}
function openpopup() {
    LoadingMsg('Loading Details', '<b>Please Wait ...</b>');
    window.setTimeout(function () {
        CloseLoading();
        $('.hls-bg').show();
        $('#dvresultpopup').show();
    }, 500);
}

function CertificateDetailsShow() {
    $('#ctl00_CP_DashBoardDiv').hide();
    $('#ctl00_CP_StudentFullProfileDiv').hide();
    $('#ctl00_CP_FeeDiv').hide();
    $('#ctl00_CP_AttendanceDiv').hide();
    $('#ctl00_CP_AssessmentDiv').hide();
    $('#ctl00_CP_CertificateDiv').show();
    $('#ctl00_CP_DepositDiv').hide();
    $('#ctl00_CP_AlertDiv').hide();
    $('#ctl00_CP_HostelDiv').hide();
    $('#ctl00_CP_TransportDiv').hide();
    $('#ctl00_CP_LibraryDiv').hide();
    $('#ctl00_CP_OnlinePaymentDiv').hide();
    $('#ctl00_CP_OnlineLearningDiv').hide();
    $('#ctl00_CP_ChargeDiv').hide();
    $('#ctl00_CP_PhotoAndDocumentDiv').hide();

    $("#ChangeClassRedirectButton").hide();
    $("#ChangeDivisionRedirectButton").hide();

    $("#ctl00_CP_OverviewList").removeClass("active");
    $("#ctl00_CP_StudentDetailsList").removeClass("active");
    $("#ctl00_CP_FeeList").removeClass("active");
    $("#ctl00_CP_AttendanceList").removeClass("active");
    $("#ctl00_CP_AssessmentList").removeClass("active");
    $("#ctl00_CP_CertificateList").addClass("active");
    $("#ctl00_CP_ChargeList").removeClass("active");
    $("#ctl00_CP_DepositList").removeClass("active");
    $("#ctl00_CP_PhotosAndDocumentList").removeClass("active");
    $("#ctl00_CP_AlertList").removeClass("active");
    $("#ctl00_CP_HostelList").removeClass("active");
    $("#ctl00_CP_TransportList").removeClass("active");
    $("#ctl00_CP_LibraryList").removeClass("active");
    $("#ctl00_CP_OnlinePaymentList").removeClass("active");
    $("#ctl00_CP_OnlineLearningList").removeClass("active");

    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/GetCertificateDetails",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                var html = '';
                var CertificateDetails = $.parseJSON(data.d);
                if (CertificateDetails.length > 0) {
                    for (var i = 0; i < CertificateDetails.length; i++) {
                        html += '<tr><td><a style="color: #03afc5 !important;" onclick=\'LoadCertificateDetails(this,' + CertificateDetails[i].Id + ')\'>' + CertificateDetails[i].CertificateName + '</a></td>';
                        html += '<td>' + DateTimeConverterWithTime(CertificateDetails[i].CreatedDateTime) + '</td>';
                        html += '<td><input type="button" id="' + i + ' ' + CertificateDetails[i].CertificateName + '" value="&#xf02f; Print Certificate" onclick="PrintCertificate(this);" class="fas btn btn-report " /></td>';
                        html += '<td style="display:none;">' + CertificateDetails[i].CertificateNumber + '</td></tr>'
                    }
                    document.getElementById("dvCertificateGridDiv").innerHTML = html;
                }
                else
                    $('#dvCertificateGridDiv').html('<tr><td colspan="3">No Record found !</td><tr>');
            },
            error: function (xhr, status, error) {

                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function ChargeDetailsShow() {
    $('#ctl00_CP_DashBoardDiv').hide();
    $('#ctl00_CP_StudentFullProfileDiv').hide();
    $('#ctl00_CP_FeeDiv').hide();
    $('#ctl00_CP_AttendanceDiv').hide();
    $('#ctl00_CP_AssessmentDiv').hide();
    $('#ctl00_CP_CertificateDiv').hide();
    $('#ctl00_CP_DepositDiv').hide();
    $('#ctl00_CP_AlertDiv').hide();
    $('#ctl00_CP_HostelDiv').hide();
    $('#ctl00_CP_TransportDiv').hide();
    $('#ctl00_CP_LibraryDiv').hide();
    $('#ctl00_CP_OnlinePaymentDiv').hide();
    $('#ctl00_CP_OnlineLearningDiv').hide();
    $('#ctl00_CP_ChargeDiv').show();
    $('#ctl00_CP_PhotoAndDocumentDiv').hide();

    $("#ChangeClassRedirectButton").hide();
    $("#ChangeDivisionRedirectButton").hide();

    $("#ctl00_CP_OverviewList").removeClass("active");
    $("#ctl00_CP_StudentDetailsList").removeClass("active");
    $("#ctl00_CP_FeeList").removeClass("active");
    $("#ctl00_CP_AttendanceList").removeClass("active");
    $("#ctl00_CP_AssessmentList").removeClass("active");
    $("#ctl00_CP_CertificateList").removeClass("active");
    $("#ctl00_CP_ChargeList").addClass("active");
    $("#ctl00_CP_DepositList").removeClass("active");
    $("#ctl00_CP_PhotosAndDocumentList").removeClass("active");
    $("#ctl00_CP_AlertList").removeClass("active");
    $("#ctl00_CP_HostelList").removeClass("active");
    $("#ctl00_CP_TransportList").removeClass("active");
    $("#ctl00_CP_LibraryList").removeClass("active");
    $("#ctl00_CP_OnlinePaymentList").removeClass("active");
    $("#ctl00_CP_OnlineLearningList").removeClass("active");

    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/GetChargeDetails",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                var html = '';
                var ChargeDetails = $.parseJSON(data.d);
                if (ChargeDetails.length > 0) {
                    for (var i = 0; i < ChargeDetails.length; i++) {
                        html += '<tr><td>' + ChargeDetails[i].ReceiptNumber + '</td>';
                        html += '<td>' + DateTimeConverter(ChargeDetails[i].ReceiptDate) + '</td>';
                        html += '<td>' + ChargeDetails[i].ReceiptBook + '</td>';
                        html += '<td>' + ChargeDetails[i].ChargeCategory + '</td>';
                        html += '<td>' + ChargeDetails[i].Amount + '</td></tr>'
                    }
                    document.getElementById("dvChargeGridDiv").innerHTML = html;
                }
                else
                    $('#dvChargeGridDiv').html('<tr><td colspan="5">No Record found !</td><tr>');
            },
            error: function (xhr, status, error) {

                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function DepositDetailsShow() {
    $('#ctl00_CP_DashBoardDiv').hide();
    $('#ctl00_CP_StudentFullProfileDiv').hide();
    $('#ctl00_CP_FeeDiv').hide();
    $('#ctl00_CP_AttendanceDiv').hide();
    $('#ctl00_CP_AssessmentDiv').hide();
    $('#ctl00_CP_CertificateDiv').hide();
    $('#ctl00_CP_DepositDiv').show();
    $('#ctl00_CP_AlertDiv').hide();
    $('#ctl00_CP_HostelDiv').hide();
    $('#ctl00_CP_TransportDiv').hide();
    $('#ctl00_CP_LibraryDiv').hide();
    $('#ctl00_CP_OnlinePaymentDiv').hide();
    $('#ctl00_CP_OnlineLearningDiv').hide();
    $('#ctl00_CP_ChargeDiv').hide();
    $('#ctl00_CP_PhotoAndDocumentDiv').hide();

    $("#ChangeClassRedirectButton").hide();
    $("#ChangeDivisionRedirectButton").hide();

    $("#ctl00_CP_OverviewList").removeClass("active");
    $("#ctl00_CP_StudentDetailsList").removeClass("active");
    $("#ctl00_CP_FeeList").removeClass("active");
    $("#ctl00_CP_AttendanceList").removeClass("active");
    $("#ctl00_CP_AssessmentList").removeClass("active");
    $("#ctl00_CP_CertificateList").removeClass("active");
    $("#ctl00_CP_ChargeList").removeClass("active");
    $("#ctl00_CP_DepositList").addClass("active");
    $("#ctl00_CP_PhotosAndDocumentList").removeClass("active");
    $("#ctl00_CP_AlertList").removeClass("active");
    $("#ctl00_CP_HostelList").removeClass("active");
    $("#ctl00_CP_TransportList").removeClass("active");
    $("#ctl00_CP_LibraryList").removeClass("active");
    $("#ctl00_CP_OnlinePaymentList").removeClass("active");
    $("#ctl00_CP_OnlineLearningList").removeClass("active");

    GetDepositHead();
}

function PhotoAndDocumentDetailsShow() {
    $('#ctl00_CP_DashBoardDiv').hide();
    $('#ctl00_CP_StudentFullProfileDiv').hide();
    $('#ctl00_CP_FeeDiv').hide();
    $('#ctl00_CP_AttendanceDiv').hide();
    $('#ctl00_CP_AssessmentDiv').hide();
    $('#ctl00_CP_CertificateDiv').hide();
    $('#ctl00_CP_DepositDiv').hide();
    $('#ctl00_CP_AlertDiv').hide();
    $('#ctl00_CP_HostelDiv').hide();
    $('#ctl00_CP_TransportDiv').hide();
    $('#ctl00_CP_LibraryDiv').hide();
    $('#ctl00_CP_OnlinePaymentDiv').hide();
    $('#ctl00_CP_OnlineLearningDiv').hide();
    $('#ctl00_CP_ChargeDiv').hide();
    $('#ctl00_CP_PhotoAndDocumentDiv').show();

    $("#ChangeClassRedirectButton").hide();
    $("#ChangeDivisionRedirectButton").hide();

    $("#ctl00_CP_OverviewList").removeClass("active");
    $("#ctl00_CP_StudentDetailsList").removeClass("active");
    $("#ctl00_CP_FeeList").removeClass("active");
    $("#ctl00_CP_AttendanceList").removeClass("active");
    $("#ctl00_CP_AssessmentList").removeClass("active");
    $("#ctl00_CP_CertificateList").removeClass("active");
    $("#ctl00_CP_ChargeList").removeClass("active");
    $("#ctl00_CP_DepositList").removeClass("active");
    $("#ctl00_CP_PhotosAndDocumentList").addClass("active");
    $("#ctl00_CP_AlertList").removeClass("active");
    $("#ctl00_CP_HostelList").removeClass("active");
    $("#ctl00_CP_TransportList").removeClass("active");
    $("#ctl00_CP_LibraryList").removeClass("active");
    $("#ctl00_CP_OnlinePaymentList").removeClass("active");
    $("#ctl00_CP_OnlineLearningList").removeClass("active");
}

function AlertDetailsShow() {
    $('#ctl00_CP_DashBoardDiv').hide();
    $('#ctl00_CP_StudentFullProfileDiv').hide();
    $('#ctl00_CP_FeeDiv').hide();
    $('#ctl00_CP_AttendanceDiv').hide();
    $('#ctl00_CP_AssessmentDiv').hide();
    $('#ctl00_CP_CertificateDiv').hide();
    $('#ctl00_CP_DepositDiv').hide();
    $('#ctl00_CP_AlertDiv').show();
    $('#ctl00_CP_HostelDiv').hide();
    $('#ctl00_CP_TransportDiv').hide();
    $('#ctl00_CP_LibraryDiv').hide();
    $('#ctl00_CP_OnlinePaymentDiv').hide();
    $('#ctl00_CP_OnlineLearningDiv').hide();
    $('#ctl00_CP_ChargeDiv').hide();
    $('#ctl00_CP_PhotoAndDocumentDiv').hide();

    $("#ChangeClassRedirectButton").hide();
    $("#ChangeDivisionRedirectButton").hide();

    $("#ctl00_CP_OverviewList").removeClass("active");
    $("#ctl00_CP_StudentDetailsList").removeClass("active");
    $("#ctl00_CP_FeeList").removeClass("active");
    $("#ctl00_CP_AttendanceList").removeClass("active");
    $("#ctl00_CP_AssessmentList").removeClass("active");
    $("#ctl00_CP_CertificateList").removeClass("active");
    $("#ctl00_CP_ChargeList").removeClass("active");
    $("#ctl00_CP_DepositList").removeClass("active");
    $("#ctl00_CP_PhotosAndDocumentList").removeClass("active");
    $("#ctl00_CP_AlertList").addClass("active");
    $("#ctl00_CP_HostelList").removeClass("active");
    $("#ctl00_CP_TransportList").removeClass("active");
    $("#ctl00_CP_LibraryList").removeClass("active");
    $("#ctl00_CP_OnlinePaymentList").removeClass("active");
    $("#ctl00_CP_OnlineLearningList").removeClass("active");

    var AlertMode = 0;
    if ($("#ctl00_CP_SMSList").hasClass("icon active") == true)
        AlertMode = 2;
    else if ($("#ctl00_CP_EmailList").hasClass("icon active") == true)
        AlertMode = 1;
    else if ($("#ctl00_CP_WhatsAppList").hasClass("icon active") == true)
        AlertMode = 4;
    else if ($("#ctl00_CP_NotificationList").hasClass("icon active") == true)
        AlertMode = 3;

    $.ajax({

        type: "POST",
        url: "/Pages/StudentManagement/StudentDetailForm.aspx/GetAlertDeatil",
        data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "AlertModeId":"' + AlertMode + '"}',
        contentType: "application/json;charset=utf-8",
        dataType: "json",
        success: function (data) {
            var datas = $.parseJSON(data.d)[0].Alertgrid;
            if (datas == '') {
                $('#dvAlertGridDiv').html('<tr><td colspan="10">No Record found !</td><tr>');
            }
            else {
                $('#dvAlertGridDiv').html(datas);
            }
        },
        error: function (xhr, status, error) {
            var err = eval("(" + xhr.responseText + ")");
            console.log(err.Message);
        }
    });
}

function HostelDetailsShow() {
    $('#ctl00_CP_DashBoardDiv').hide();
    $('#ctl00_CP_StudentFullProfileDiv').hide();
    $('#ctl00_CP_FeeDiv').hide();
    $('#ctl00_CP_AttendanceDiv').hide();
    $('#ctl00_CP_AssessmentDiv').hide();
    $('#ctl00_CP_CertificateDiv').hide();
    $('#ctl00_CP_DepositDiv').hide();
    $('#ctl00_CP_AlertDiv').hide();
    $('#ctl00_CP_HostelDiv').show();
    $('#ctl00_CP_TransportDiv').hide();
    $('#ctl00_CP_LibraryDiv').hide();
    $('#ctl00_CP_OnlinePaymentDiv').hide();
    $('#ctl00_CP_OnlineLearningDiv').hide();
    $('#ctl00_CP_ChargeDiv').hide();
    $('#ctl00_CP_PhotoAndDocumentDiv').hide();

    $("#ChangeClassRedirectButton").hide();
    $("#ChangeDivisionRedirectButton").hide();

    $("#ctl00_CP_OverviewList").removeClass("active");
    $("#ctl00_CP_StudentDetailsList").removeClass("active");
    $("#ctl00_CP_FeeList").removeClass("active");
    $("#ctl00_CP_AttendanceList").removeClass("active");
    $("#ctl00_CP_AssessmentList").removeClass("active");
    $("#ctl00_CP_CertificateList").removeClass("active");
    $("#ctl00_CP_ChargeList").removeClass("active");
    $("#ctl00_CP_DepositList").removeClass("active");
    $("#ctl00_CP_PhotosAndDocumentList").removeClass("active");
    $("#ctl00_CP_AlertList").removeClass("active");
    $("#ctl00_CP_HostelList").addClass("active");
    $("#ctl00_CP_TransportList").removeClass("active");
    $("#ctl00_CP_LibraryList").removeClass("active");
    $("#ctl00_CP_OnlinePaymentList").removeClass("active");
    $("#ctl00_CP_OnlineLearningList").removeClass("active");

    if (StudentFullProfile.length > 0) {
        document.getElementById("ctl00_CP_HostelDetailsLabel").innerText = StudentFullProfile[0].Hostel;
        document.getElementById("ctl00_CP_RoomNoDetailsLabel").innerText = StudentFullProfile[0].RoomNo;
        document.getElementById("ctl00_CP_WardenNameDetailsLabel").innerText = StudentFullProfile[0].WardenName;
        document.getElementById("ctl00_CP_WardenPhoneNoDetailsLabel").innerText = StudentFullProfile[0].WardenPhoneNo;
        document.getElementById("ctl00_CP_HostelWardenExtNoLabel").innerText = StudentFullProfile[0].WardenExtNo;
        document.getElementById("ctl00_CP_WardenMobileNoDetailsLabel").innerText = StudentFullProfile[0].WardenMobileNo;
        document.getElementById("ctl00_CP_AssignedRoomByDetailsLabel").innerText = StudentFullProfile[0].AssignedRoomBy;
        document.getElementById("ctl00_CP_AssignedRoomByPhoneNoDetailsLabel").innerText = StudentFullProfile[0].AssignedRoomByPhoneNo;
        document.getElementById("ctl00_CP_AssignedRoomByExtNoDetailsLabel").innerText = StudentFullProfile[0].AssignedRoomByExtNo;
        document.getElementById("ctl00_CP_AssignedRoomByMobileNoDetailsLabel").innerText = StudentFullProfile[0].AssignedRoomByMobileNo;
    }
}

function TransportDetailsShow() {
    $('#ctl00_CP_DashBoardDiv').hide();
    $('#ctl00_CP_StudentFullProfileDiv').hide();
    $('#ctl00_CP_FeeDiv').hide();
    $('#ctl00_CP_AttendanceDiv').hide();
    $('#ctl00_CP_AssessmentDiv').hide();
    $('#ctl00_CP_CertificateDiv').hide();
    $('#ctl00_CP_DepositDiv').hide();
    $('#ctl00_CP_AlertDiv').hide();
    $('#ctl00_CP_HostelDiv').hide();
    $('#ctl00_CP_TransportDiv').show();
    $('#ctl00_CP_LibraryDiv').hide();
    $('#ctl00_CP_OnlinePaymentDiv').hide();
    $('#ctl00_CP_OnlineLearningDiv').hide();
    $('#ctl00_CP_ChargeDiv').hide();
    $('#ctl00_CP_PhotoAndDocumentDiv').hide();

    $("#ChangeClassRedirectButton").hide();
    $("#ChangeDivisionRedirectButton").hide();

    $("#ctl00_CP_OverviewList").removeClass("active");
    $("#ctl00_CP_StudentDetailsList").removeClass("active");
    $("#ctl00_CP_FeeList").removeClass("active");
    $("#ctl00_CP_AttendanceList").removeClass("active");
    $("#ctl00_CP_AssessmentList").removeClass("active");
    $("#ctl00_CP_CertificateList").removeClass("active");
    $("#ctl00_CP_ChargeList").removeClass("active");
    $("#ctl00_CP_DepositList").removeClass("active");
    $("#ctl00_CP_PhotosAndDocumentList").removeClass("active");
    $("#ctl00_CP_AlertList").removeClass("active");
    $("#ctl00_CP_HostelList").removeClass("active");
    $("#ctl00_CP_TransportList").addClass("active");
    $("#ctl00_CP_LibraryList").removeClass("active");
    $("#ctl00_CP_OnlinePaymentList").removeClass("active");
    $("#ctl00_CP_OnlineLearningList").removeClass("active");

    if (StudentFullProfile.length > 0) {
        document.getElementById("ctl00_CP_BusRouteDetailsLabel").innerText = StudentFullProfile[0].BusRoute;
        document.getElementById("ctl00_CP_PickupPointDetailsLabel").innerText = StudentFullProfile[0].BusRouteDestination;
        document.getElementById("ctl00_CP_VehicleNameDetailsLabel").innerText = StudentFullProfile[0].VehicleName;
        document.getElementById("ctl00_CP_VehicleRegistrationDetailsLabel").innerText = StudentFullProfile[0].VehicleRegistrationNumber;
        document.getElementById("ctl00_CP_TypeOfVehicleDetailsLabel").innerText = StudentFullProfile[0].TypeOfVehicle;
        document.getElementById("ctl00_CP_DriverNameDetailsLabel").innerText = StudentFullProfile[0].DriverName;
        document.getElementById("ctl00_CP_DriverMobileNoDetailsLabel").innerText = StudentFullProfile[0].DriverMobileNo;
        document.getElementById("ctl00_CP_ConductorNameDetailsLabel").innerText = StudentFullProfile[0].ConductorName;
        document.getElementById("ctl00_CP_CondictorMobileNoDetailsLabel").innerText = StudentFullProfile[0].ConductorMobileNo;
        document.getElementById("ctl00_CP_DropRouteDetailsLabel").innerText = StudentFullProfile[0].DropRoute;
        document.getElementById("ctl00_CP_DropPointDetailsLabel").innerText = StudentFullProfile[0].DropDestination;
        document.getElementById("ctl00_CP_DropVehicleNameDetailsLabel").innerText = StudentFullProfile[0].DropVehicleName;
        document.getElementById("ctl00_CP_DropVehicleRegistrationNumberDetailsLabel").innerText = StudentFullProfile[0].DropVehicleRegistrationNumber;
        document.getElementById("ctl00_CP_DropTypeOfVehicleDetailsLabel").innerText = StudentFullProfile[0].DropTypeOfVehicle;
        document.getElementById("ctl00_CP_DropDriverNameDetailsLabel").innerText = StudentFullProfile[0].DropRouteDriverName;;
        document.getElementById("ctl00_CP_DropDriverMobileNoDetailsLabel").innerText = StudentFullProfile[0].DropRouteDriverMobileNo;
        document.getElementById("ctl00_CP_DropConductorNameDetailsLabel").innerText = StudentFullProfile[0].DropRouteConductorName;
        document.getElementById("ctl00_CP_DropConductorMobileNoLabel").innerText = StudentFullProfile[0].DropRouteConductorMobileNo;
    }
}

function LibraryDetailsShow() {
    $('#ctl00_CP_DashBoardDiv').hide();
    $('#ctl00_CP_StudentFullProfileDiv').hide();
    $('#ctl00_CP_FeeDiv').hide();
    $('#ctl00_CP_AttendanceDiv').hide();
    $('#ctl00_CP_AssessmentDiv').hide();
    $('#ctl00_CP_CertificateDiv').hide();
    $('#ctl00_CP_DepositDiv').hide();
    $('#ctl00_CP_AlertDiv').hide();
    $('#ctl00_CP_HostelDiv').hide();
    $('#ctl00_CP_TransportDiv').hide();
    $('#ctl00_CP_LibraryDiv').show();
    $('#ctl00_CP_OnlinePaymentDiv').hide();
    $('#ctl00_CP_OnlineLearningDiv').hide();
    $('#ctl00_CP_ChargeDiv').hide();
    $('#ctl00_CP_PhotoAndDocumentDiv').hide();

    $("#ChangeClassRedirectButton").hide();
    $("#ChangeDivisionRedirectButton").hide();

    $("#ctl00_CP_OverviewList").removeClass("active");
    $("#ctl00_CP_StudentDetailsList").removeClass("active");
    $("#ctl00_CP_FeeList").removeClass("active");
    $("#ctl00_CP_AttendanceList").removeClass("active");
    $("#ctl00_CP_AssessmentList").removeClass("active");
    $("#ctl00_CP_CertificateList").removeClass("active");
    $("#ctl00_CP_ChargeList").removeClass("active");
    $("#ctl00_CP_DepositList").removeClass("active");
    $("#ctl00_CP_PhotosAndDocumentList").removeClass("active");
    $("#ctl00_CP_AlertList").removeClass("active");
    $("#ctl00_CP_HostelList").removeClass("active");
    $("#ctl00_CP_TransportList").removeClass("active");
    $("#ctl00_CP_LibraryList").addClass("active");
    $("#ctl00_CP_OnlinePaymentList").removeClass("active");
    $("#ctl00_CP_OnlineLearningList").removeClass("active");

    $.ajax({
        type: "POST",
        url: "/Pages/StudentManagement/StudentDetailForm.aspx/GetLibraryDeatil",
        data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '"}',
        contentType: "application/json;charset=utf-8",
        dataType: "json",
        success: function (data) {
            var datas = $.parseJSON(data.d)
            if (datas[0].Bookgrid == '') {
                $('#dvBookGridDiv').html('<tr><td colspan="6">No Record found !</td><tr>');
            }
            else {
                $('#dvBookGridDiv').html(datas[0].Bookgrid);
            }
        },
        error: function (xhr, status, error) {
            var err = eval("(" + xhr.responseText + ")");
            console.log(err.Message);
        }
    });
}

function OnlinePaymentDetailsShow() {
    $('#ctl00_CP_DashBoardDiv').hide();
    $('#ctl00_CP_StudentFullProfileDiv').hide();
    $('#ctl00_CP_FeeDiv').hide();
    $('#ctl00_CP_AttendanceDiv').hide();
    $('#ctl00_CP_AssessmentDiv').hide();
    $('#ctl00_CP_CertificateDiv').hide();
    $('#ctl00_CP_DepositDiv').hide();
    $('#ctl00_CP_AlertDiv').hide();
    $('#ctl00_CP_HostelDiv').hide();
    $('#ctl00_CP_TransportDiv').hide();
    $('#ctl00_CP_LibraryDiv').hide();
    $('#ctl00_CP_OnlinePaymentDiv').show();
    $('#ctl00_CP_OnlineLearningDiv').hide();
    $('#ctl00_CP_ChargeDiv').hide();
    $('#ctl00_CP_PhotoAndDocumentDiv').hide();

    $("#ChangeClassRedirectButton").hide();
    $("#ChangeDivisionRedirectButton").hide();

    $("#ctl00_CP_OverviewList").removeClass("active");
    $("#ctl00_CP_StudentDetailsList").removeClass("active");
    $("#ctl00_CP_FeeList").removeClass("active");
    $("#ctl00_CP_AttendanceList").removeClass("active");
    $("#ctl00_CP_AssessmentList").removeClass("active");
    $("#ctl00_CP_CertificateList").removeClass("active");
    $("#ctl00_CP_ChargeList").removeClass("active");
    $("#ctl00_CP_DepositList").removeClass("active");
    $("#ctl00_CP_PhotosAndDocumentList").removeClass("active");
    $("#ctl00_CP_AlertList").removeClass("active");
    $("#ctl00_CP_HostelList").removeClass("active");
    $("#ctl00_CP_TransportList").removeClass("active");
    $("#ctl00_CP_LibraryList").removeClass("active");
    $("#ctl00_CP_OnlinePaymentList").addClass("active");
    $("#ctl00_CP_OnlineLearningList").removeClass("active");

    $.ajax({
        type: "POST",
        url: "/Pages/StudentManagement/StudentDetailForm.aspx/GetPaymentTransactionDetails",
        data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '"}',
        contentType: "application/json;charset=utf-8",
        dataType: "json",
        success: function (data) {
            var html = '';
            var datas = $.parseJSON(data.d);
            if (datas.length > 0) {
                for (var i = 0; i < datas.length; i++) {
                    html += '<tr><td>' + datas[i].OSType + '</td>';
                    html += '<td>' + datas[i].PaymentTransactionId + '</td>'
                    html += '<td>' + DateTimeConverter(datas[i].PayDateTime) + '</td>'
                    html += '<td>' + datas[i].Functionality + '</td>'
                    html += '<td>' + datas[i].ReceiptBook + '</td>'
                    html += '<td>' + datas[i].PayAmount + '</td>'
                    html += '<td style="background-color:' + datas[i].ColorCode + '">' + datas[i].TransactionStatus + '</td>'
                    if (datas[i].TransactionStatus == "Payment Initiated" || datas[i].TransactionStatus == "Payment Failure")
                        html += '<td><input type="button" id="UpdateTransactionButton" value="&#xf2f9;" onclick="UpdateTransaction(this);" class="btn btn-download fas" title="Update Transaction" /></td>';

                    html += '</tr>';
                }
                $('#dvOnlinePaymentGridDiv').html(html);
            }
            else {
                $('#dvOnlinePaymentGridDiv').html('<tr><td colspan="7">No Record found !</td><tr>');
            }
        },
        error: function (xhr, status, error) {
            var err = eval("(" + xhr.responseText + ")");
            console.log(err.Message);
        }
    });
}
function OnlineLearningDetailsShow() {
    $('#ctl00_CP_DashBoardDiv').hide();
    $('#ctl00_CP_StudentFullProfileDiv').hide();
    $('#ctl00_CP_FeeDiv').hide();
    $('#ctl00_CP_AttendanceDiv').hide();
    $('#ctl00_CP_AssessmentDiv').hide();
    $('#ctl00_CP_CertificateDiv').hide();
    $('#ctl00_CP_DepositDiv').hide();
    $('#ctl00_CP_AlertDiv').hide();
    $('#ctl00_CP_HostelDiv').hide();
    $('#ctl00_CP_TransportDiv').hide();
    $('#ctl00_CP_LibraryDiv').hide();
    $('#ctl00_CP_OnlinePaymentDiv').hide();
    $('#ctl00_CP_OnlineLearningDiv').show();
    $('#ctl00_CP_ChargeDiv').hide();
    $('#ctl00_CP_PhotoAndDocumentDiv').hide();

    $("#ChangeClassRedirectButton").hide();
    $("#ChangeDivisionRedirectButton").hide();

    $("#ctl00_CP_OverviewList").removeClass("active");
    $("#ctl00_CP_StudentDetailsList").removeClass("active");
    $("#ctl00_CP_FeeList").removeClass("active");
    $("#ctl00_CP_AttendanceList").removeClass("active");
    $("#ctl00_CP_AssessmentList").removeClass("active");
    $("#ctl00_CP_CertificateList").removeClass("active");
    $("#ctl00_CP_ChargeList").removeClass("active");
    $("#ctl00_CP_DepositList").removeClass("active");
    $("#ctl00_CP_PhotosAndDocumentList").removeClass("active");
    $("#ctl00_CP_AlertList").removeClass("active");
    $("#ctl00_CP_HostelList").removeClass("active");
    $("#ctl00_CP_TransportList").removeClass("active");
    $("#ctl00_CP_LibraryList").removeClass("active");
    $("#ctl00_CP_OnlinePaymentList").removeClass("active");
    $("#ctl00_CP_OnlineLearningList").addClass("active");

    $.ajax({
        type: "POST",
        url: "/Pages/StudentManagement/StudentDetailForm.aspx/GetOLDetails",
        data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "Type":"OLLecture"}',
        contentType: "application/json;charset=utf-8",
        dataType: "json",
        success: function (data) {
            var html = '';
            var datas = $.parseJSON(data.d);
            if (datas.length > 0) {
                for (var i = 0; i < datas.length; i++) {
                    html += '<tr><td>' + datas[i].LearningType + '</td>';
                    html += '<td>' + datas[i].Subject + '</td>'
                    html += '<td>' + datas[i].OLTitle + '</td>'
                    html += '<td>' + datas[i].EmployeeName + '</td>'
                    html += '<td>' + datas[i].StartTime.Hours + ":" + datas[i].StartTime.Minutes + '</td>'
                    html += '<td>' + datas[i].EndTime.Hours + ":" + datas[i].EndTime.Minutes + '</td>'

                    html += '</tr>';
                }
                $('#dvOLLectureGridDiv').html(html);
            }
            else {
                $('#dvOLLectureGridDiv').html('<tr><td colspan="6">No Record found !</td><tr>');
            }
        },
        error: function (xhr, status, error) {
            var err = eval("(" + xhr.responseText + ")");
            console.log(err.Message);
        }
    });
    $.ajax({
        type: "POST",
        url: "/Pages/StudentManagement/StudentDetailForm.aspx/GetOLDetails",
        data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "Type":"OLAttendance"}',
        contentType: "application/json;charset=utf-8",
        dataType: "json",
        success: function (data) {
            var html = '';
            var datas = $.parseJSON(data.d);
            if (datas.length > 0) {
                for (var i = 0; i < datas.length; i++) {
                    html += '<tr><td>' + datas[i].PresentCount + '</td>';
                    html += '<td>' + datas[i].AbsentCount + '</td>'
                    html += '<td>' + datas[i].PresentPercentage + '</td>'

                    html += '</tr>';
                }
                $('#dvOLAttendanceGridDiv').html(html);
            }
            else {
                $('#dvOLAttendanceGridDiv').html('<tr><td colspan="3">No Record found !</td><tr>');
            }
        },
        error: function (xhr, status, error) {
            var err = eval("(" + xhr.responseText + ")");
            console.log(err.Message);
        }
    });
}

function DateTimeConverter(DateTime) {
    var obj = { DOB: DateTime };
    var DOBValue = parseInt(obj.DOB.replace(/\/Date\((\d+)\)\//g, "$1"));
    obj.DOB = new Date(DOBValue);
    obj.DOB = ((obj.DOB.getDate() > 9) ? obj.DOB.getDate() : ('0' + obj.DOB.getDate())) + '/' + ((obj.DOB.getMonth() > 8) ? (obj.DOB.getMonth() + 1) : ('0' + (obj.DOB.getMonth() + 1))) + '/' + obj.DOB.getFullYear();
    return obj.DOB;
}

function DateTimeConverterWithTime(DateTime) {
    var obj = { DOB: DateTime };
    var DOBValue = parseInt(obj.DOB.replace(/\/Date\((\d+)\)\//g, "$1"));
    obj.DOB = new Date(DOBValue);
    obj.DOB = ((obj.DOB.getDate() > 9) ? obj.DOB.getDate() : ('0' + obj.DOB.getDate())) + '/' + ((obj.DOB.getMonth() > 8) ? (obj.DOB.getMonth() + 1) : ('0' + (obj.DOB.getMonth() + 1))) + '/' + obj.DOB.getFullYear() + ' ' + obj.DOB.getHours() + ':' + obj.DOB.getMinutes() + ':' + obj.DOB.getSeconds();
    return obj.DOB;
}

function arrayBufferToBase64(buffer) {
    var binary = '';
    var bytes = new Uint8Array(buffer);
    var len = bytes.byteLength;
    for (var i = 0; i < len; i++) {
        binary += String.fromCharCode(bytes[i]);
    }
    return window.btoa(binary);
}

function GetAttedanceDeatil() {
    //Based on Attendance Type dropdown change event        
    var AttendanceTypeId = document.getElementById("ctl00_CP_AttendanceTypeDropDownList").value;
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/GetAttedanceDeatil",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '","AttendanceTypeId":"' + AttendanceTypeId + '"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                var datas = data.d;
                if (AttendanceTypeId == 5) {
                    $('#Atddiv').hide();
                    $('#Subjectatdiv').show();
                    if (datas == '') {
                        $('#dvsubjectGridDiv').html('<tr><td colspan="3">No Record found !</td><tr>');
                    }
                    else {
                        $('#dvsubjectGridDiv').html(datas);
                    }
                }
                else {
                    $('#Atddiv').show();
                    $('#Subjectatdiv').hide();
                    if (datas == '') {
                        $('#dvAttedanceGridDiv').html('<tr><td colspan="7">No Record found !</td><tr>');
                    }
                    else {
                        $('#dvAttedanceGridDiv').html(datas);
                    }
                }
            },
            error: function (xhr, status, error) {

                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

//Binding AttendanceType DropDown
function GetAttedanceType() {
    $('#ctl00_CP_AttendanceTypeDropDownList').empty();
    $.ajax({
        type: "POST",
        url: "/Pages/StudentManagement/StudentDetailForm.aspx/GetAttedanceType",
        data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '"}',
        contentType: "application/json;charset=utf-8",
        dataType: "json",
        success: function (data) {
            var ddlCustomers = $("#ctl00_CP_AttendanceTypeDropDownList");
            $('#ctl00_CP__AttendanceTypeDropDownList').empty();
            $.each(data.d, function () {
                ddlCustomers.append($("<option></option>").val(this['Value']).html(this['Text']));
            });
            GetAttedanceDeatil();
        },
        error: function (xhr, status, error) {
            var err = eval("(" + xhr.responseText + ")");
            console.log(err.Message);
        }
    });
}

function GetDepositHeadDeatil() {
    //Based on DepositHead dropdown change event        
    var DepositHeadId = document.getElementById("ctl00_CP_DepositHeadDropDownList").value;
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/GetDepositHeadDeatil",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '","DepositHeadId":"' + DepositHeadId + '"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                var html = '';
                var BalanceSum = 0;
                var DebitSum = 0;
                var DepositDetails = $.parseJSON(data.d);
                if (DepositDetails.length > 0) {
                    for (var i = 0; i < DepositDetails.length; i++) {
                        BalanceSum += DepositDetails[i].Credit;
                    }
                    for (var i = 0; i < DepositDetails.length; i++) {
                        html += '<tr><td>' + DateTimeConverter(DepositDetails[0].DepositDate) + '</td>';
                        html += '<td>' + DepositDetails[i].ExpenseType + '</td>'
                        html += '<td>' + DepositDetails[i].Credit + '</td>'
                        html += '<td>' + DepositDetails[i].Debit + '</td>'
                        DebitSum += parseFloat(DepositDetails[i].Debit);
                        html += '<td>' + (parseFloat(BalanceSum) - parseFloat(DebitSum)).toString() + '</td>'
                        html += '<td>' + DepositDetails[i].BatchName + '</td></tr>'
                    }
                    document.getElementById("dvDepositGridDiv").innerHTML = html;
                }
                else
                    $('#dvDepositGridDiv').html('<tr><td colspan="6">No Record found !</td><tr>');
            },
            error: function (xhr, status, error) {

                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

//Binding DepositHead DropDown
function GetDepositHead() {
    $('#ctl00_CP_AttendanceTypeDropDownList').empty();
    $.ajax({
        type: "POST",
        url: "/Pages/StudentManagement/StudentDetailForm.aspx/GetDepositHead",
        data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '"}',
        contentType: "application/json;charset=utf-8",
        dataType: "json",
        success: function (data) {
            var ddlCustomers = $("#ctl00_CP_DepositHeadDropDownList");
            $('#ctl00_CP__DepositHeadDropDownList').empty();
            $.each(data.d, function () {
                ddlCustomers.append($("<option></option>").val(this['Value']).html(this['Text']));
            });
            GetDepositHeadDeatil();
        },
        error: function (xhr, status, error) {
            var err = eval("(" + xhr.responseText + ")");
            console.log(err.Message);
        }
    });
}

//FeeButtonsDiv
function FeeReceiptRedirect(IsOverview) {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"FeeReceipt:' + Boolean(IsOverview) + '" }',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/FeeManagement/FeeReceipt.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function PayOnlineFeeRedirect(IsOverview) {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"PayOnlineFee:' + Boolean(IsOverview) + '" }',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/FeeManagement/PayStudentFee.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function AssignOptionalFeeRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"AssignOptionalFee"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/FeeManagement/AssignOptionalFee.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function ReceiptChequeClearRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"ReceiptChequeClear"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/FeeManagement/ReceiptChequeClear.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function FeeRefundRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"FeeRefund"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/FeeManagement/FeeRefund.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function SendFeeAlertRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"SendFeeAlert"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Components/Alert/SMSPredefine.aspx?ModuleId=154";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function PendingFeeSlipReport() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/ReportPrint",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "ReportId":"10147"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                if (data.d == "1") {
                    var e = "../Common/Report/ReportPDF.aspx"
                    return window.open(e, '', "height=1500px,width=1500px,left=0px,top=0px,toolbar=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=yes ,modal=yes"), !1;
                }
                else if (data.d == "0") {
                    alert('No records found');
                }
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function UpdateStudentDetailRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"UpdateStudentDetail"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/StudentManagement/StudentDetailUpdate.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function ChangeIdRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"ChangeId"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/StudentManagement/IDNoGeneration.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function ChangeSuidRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"ChangeSuid"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/StudentManagement/SUIDGeneration.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function StudentProfileRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"StudentProfile"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/StudentManagement/StudentFullProfile.aspx?ScreenSource=Search";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function UploadStudentPhotosRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"UploadStudentPhotos"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/BaseFramework/Utilities/UploadStudentPhoto.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function StudentDocumentsRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"UploadStudentDocuments"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/BaseFramework/Utilities/UploadStudentdocument.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}


function StudentSublingRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"StudentSibling"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/StudentManagement/StudentSibling.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function StudentICardReport() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/StudentICardReport",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"StudentICard"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                if (data.d == "1") {
                    var e = "../Common/Report/ReportPDF.aspx"
                    return window.open(e, '', "height=1500px,width=1500px,left=0px,top=0px,toolbar=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=yes ,modal=yes"), !1;
                }
                else if (data.d == "0") {
                    alert('No records found');
                }
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function StudentLeaveEntryRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"StudentLeaveEntry"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Communication/MyLeaveRequest.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function AttendanceSendAlertRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"SendAttendanceAlert"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Components/Alert/SMSPredefine.aspx?ModuleId=153";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function PrintCertificate(obj) {
    var CertificateNumber = obj.parentNode.parentNode.cells[3].innerHTML;
    var CertificateType = obj.id.split(' ')[1];
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/CertificatePrint",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "CertificateNumber":"' + CertificateNumber + '","CertificateType":"' + CertificateType + '"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                if (data.d == "1") {
                    var e = "../Common/Report/ReportPDF.aspx"
                    return window.open(e, '', "height=1500px,width=1500px,left=0px,top=0px,toolbar=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=yes ,modal=yes"), !1;
                }
                else if (data.d == "0") {
                    alert('No records found');
                }
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function ChargeReceiptRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"ChargeReceipt"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/FeeManagement/ChargeReceipt.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function AssignOptionalSubjectRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"AssignOptionalSubject"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Assessment/General/OptionalSubject.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function StudentResultRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"StudentResult"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Assessment/General/StudentResult.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function SendPredefineAlertRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"SendPredefineAlert"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Components/Alert/SMSPredefine.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function SendCustomAlertRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"SendCustomAlert"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Components/Alert/SMSToAll.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function AlertHistoryRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"AlertHistory"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Components/Alert/SMSHistory.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function HostelChangeRoomRedirect() {
    var SessionValue = "ChangeRoom"
    if ($('#ctl00_CP_HostelSelectTransportDiv').is(":visible")) {
        if ($("#ctl00_CP_HostelSelectTransportDropDownList")[0].selectedIndex > 0)
            SessionValue = SessionValue + ":" + $('#ctl00_CP_HostelSelectTransportDropDownList').val();
        else {
            alert('Select Hostel first')
            return;
        }
    }
    else if ($('#ctl00_CP_HostelHiddenField').val() != '')
        SessionValue = SessionValue + ":" + $('#ctl00_CP_HostelHiddenField').val();

    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"' + SessionValue + '"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Hostel/SelectHostel.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function HostelGatepassRedirect() {
    var SessionValue = "HostelStudentGatepass"
    if ($('#ctl00_CP_HostelSelectTransportDiv').is(":visible")) {
        if ($("#ctl00_CP_HostelSelectTransportDropDownList")[0].selectedIndex > 0)
            SessionValue = SessionValue + ":" + $('#ctl00_CP_HostelSelectTransportDropDownList').val();
        else {
            alert('Select Hostel first')
            return;
        }
    }
    else if ($('#ctl00_CP_HostelHiddenField').val() != '')
        SessionValue = SessionValue + ":" + $('#ctl00_CP_HostelHiddenField').val();

    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"' + SessionValue + '"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Hostel/SelectHostel.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function HostelStudentLedgerRedirect() {
    var SessionValue = "StudentLedger"
    if ($('#ctl00_CP_HostelSelectTransportDiv').is(":visible")) {
        if ($("#ctl00_CP_HostelSelectTransportDropDownList")[0].selectedIndex > 0)
            SessionValue = SessionValue + ":" + $('#ctl00_CP_HostelSelectTransportDropDownList').val();
        else {
            alert('Select Hostel first')
            return;
        }
    }
    else if ($('#ctl00_CP_HostelHiddenField').val() != '')
        SessionValue = SessionValue + ":" + $('#ctl00_CP_HostelHiddenField').val();


    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"' + SessionValue + '"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Hostel/SelectHostel.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function UpdateHostelFeeRedirect() {
    var SessionValue = "UpdateHostelFee"
    if ($('#ctl00_CP_HostelSelectTransportDiv').is(":visible")) {
        if ($("#ctl00_CP_HostelSelectTransportDropDownList")[0].selectedIndex > 0)
            SessionValue = SessionValue + ":" + $('#ctl00_CP_HostelSelectTransportDropDownList').val();
        else {
            alert('Select Hostel first')
            return;
        }
    }
    else if ($('#ctl00_CP_HostelHiddenField').val() != '')
        SessionValue = SessionValue + ":" + $('#ctl00_CP_HostelHiddenField').val();

    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"' + SessionValue + '"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Hostel/UpdateHostelFee.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function TransportChangeRouteRedirect() {
    var SessionValue = "TransportChangeRoute"
    if ($('#ctl00_CP_TransportSelectTransportDiv').is(":visible")) {
        if ($("#ctl00_CP_TransportSelectTransportDropDownList")[0].selectedIndex > 0)
            SessionValue = SessionValue + ":" + $('#ctl00_CP_TransportSelectTransportDropDownList').val();
        else {
            alert('Select Transport first')
            return;
        }
    }
    else if ($('#ctl00_CP_TransportHiddenField').val() != '')
        SessionValue = SessionValue + ":" + $('#ctl00_CP_TransportHiddenField').val();

    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"' + SessionValue + '"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Transport/SelectTransport.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function UpdateTransportFeeRedirect() {
    var SessionValue = "UpdateTransportFee"
    if ($('#ctl00_CP_TransportSelectTransportDiv').is(":visible")) {
        if ($("#ctl00_CP_TransportSelectTransportDropDownList")[0].selectedIndex > 0)
            SessionValue = SessionValue + ":" + $('#ctl00_CP_TransportSelectTransportDropDownList').val();
        else {
            alert('Select Transport first')
            return;
        }
    }
    else if ($('#ctl00_CP_TransportHiddenField').val() != '')
        SessionValue = SessionValue + ":" + $('#ctl00_CP_TransportHiddenField').val();

    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"' + SessionValue + '"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Transport/SelectTransport.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function BookIssueReturnRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"BookIssueReturn"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Library/SelectLibrary.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function SendLibraryAlertRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"SendLibraryAlert"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Components/Alert/SMSPredefine.aspx?ModuleId=210";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function StudentFullProfileGet() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/StudentFullProfileGet",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                StudentFullProfile = $.parseJSON(data.d);
            }
        });
        //Changes for Mantis Id :0035425 By Hemali
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/GetStudentSiblingDetail",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                var SiblingDetails = $.parseJSON(data.d);
                var html = '';
                if (SiblingDetails.length > 0) {
                    for (var i = 0; i < SiblingDetails.length; i++) {
                        html += '<tr><td align="left" scope="col">' + SiblingDetails[i].OrganizationName + '</td>';
                        html += '<td align="left" scope="col">' + SiblingDetails[i].Code + '</td>';
                        html += '<td align="left" scope="col">' + SiblingDetails[i].Name + '</td>';
                        html += '<td align="left" scope="col">' + SiblingDetails[i].DivDept + '</td>';
                        html += '<td align="left" scope="col">' + SiblingDetails[i].StatusName + '</td></tr>'; // Mantis Id : 0036426
                    }
                    $('#StudentSiblingDiv').html(html);
                }
            }
        });
    }
}

function PrintAdmitCard(obj) {
    var ExamName = obj.parentNode.parentNode.cells[0].innerText;
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/ExamReport",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "ExamName":"' + ExamName + '","ReportType":"AdmitCard"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                if (data.d == "1") {
                    var e = "../Common/Report/ReportPDF.aspx"
                    return window.open(e, '', "height=1500px,width=1500px,left=0px,top=0px,toolbar=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=yes ,modal=yes"), !1;
                }
                else if (data.d == "0") {
                    alert('No records found');
                }
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function PrintExamTimeTable(obj) {
    var ExamName = obj.parentNode.parentNode.cells[0].innerText;
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/ExamReport",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "ExamName":"' + ExamName + '","ReportType":"ExamTimeTable"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                if (data.d == "1") {
                    var e = "../Common/Report/ReportPDF.aspx"
                    return window.open(e, '', "height=1500px,width=1500px,left=0px,top=0px,toolbar=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=yes ,modal=yes"), !1;
                }
                else if (data.d == "0") {
                    alert('No records found');
                }
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function PrintResultSheet(obj) {
    var ExamName = obj.parentNode.parentNode.cells[0].innerText;
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/ExamReport",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "ExamName":"' + ExamName + '","ReportType":"ResultSheetReport"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                if (data.d == "1") {
                    var e = "../Common/Report/ReportPDF.aspx"
                    return window.open(e, '', "height=1500px,width=1500px,left=0px,top=0px,toolbar=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=yes ,modal=yes"), !1;
                }
                else if (data.d == "0") {
                    alert('No records found');
                }
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function UpdateTransaction(obj) {
    var del = confirm("Are you sure you want to update this transaction ?");
    if (del == true) {
        var TransactionId = obj.parentNode.parentNode.cells[1].innerText;
        if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
            $.ajax({
                type: "POST",
                url: "/Pages/StudentManagement/StudentDetailForm.aspx/UpdateTransaction",
                data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '","PaymentTransactionId":"' + TransactionId + '"}',
                contentType: "application/json;charset=utf-8",
                dataType: "json",
                success: function (data) {
                    if (data.d == "1") {
                        alert("Transaction Updated");
                    }
                },
                error: function (xhr, status, error) {
                    var err = eval("(" + xhr.responseText + ")");
                    console.log(err.Message);
                }
            });
        }
    }
}

function ChangeClassRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"ChangeClass"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/StudentManagement/ChangeClass.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function ChangeDivisionRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"ChangeDivision"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/StudentManagement/DivisionAllotment.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function AssignRouteRedirect() {
    var SessionValue = "AssignRoute"
    if ($('#ctl00_CP_TransportSelectOverViewDiv').is(":visible")) {
        if ($("#ctl00_CP_TransportSelectDropDownListOverView")[0].selectedIndex > 0)
            SessionValue = SessionValue + ":" + $('#ctl00_CP_TransportSelectDropDownListOverView').val();
        else {
            alert('Select Transport first')
            return;
        }
    }
    else if ($('#ctl00_CP_TransportHiddenField').val() != '')
        SessionValue = SessionValue + ":" + $('#ctl00_CP_TransportHiddenField').val();

    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"' + SessionValue + '"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Transport/SelectTransport.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function TransportAttendanceDetailsRedirectRedirect() {
    var SessionValue = "TransportAttendanceDetails"
    if ($('#ctl00_CP_TransportSelectOverViewDiv').is(":visible")) {
        if ($("#ctl00_CP_TransportSelectDropDownListOverView")[0].selectedIndex > 0)
            SessionValue = SessionValue + ":" + $('#ctl00_CP_TransportSelectDropDownListOverView').val();
        else {
            alert('Select Transport first')
            return;
        }
    }
    else if ($('#ctl00_CP_TransportHiddenField').val() != '')
        SessionValue = SessionValue + ":" + $('#ctl00_CP_TransportHiddenField').val();

    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"' + SessionValue + '"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Transport/SelectTransport.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function AssignRoomRedirect() {
    var SessionValue = "AssignRoom"
    if ($('#ctl00_CP_HostelSelectOverViewDiv').is(":visible")) {
        if ($("#ctl00_CP_HostelSelectDropDownListOverView")[0].selectedIndex > 0)
            SessionValue = SessionValue + ":" + $('#ctl00_CP_HostelSelectDropDownListOverView').val();
        else {
            alert('Select Hostel first')
            return;
        }
    }
    else if ($('#ctl00_CP_HostelHiddenField').val() != '')
        SessionValue = SessionValue + ":" + $('#ctl00_CP_HostelHiddenField').val();

    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"' + SessionValue + '"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Hostel/SelectHostel.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function HostelAttendanceDetailsRedirectRedirect() {
    var SessionValue = "HostelAttendanceDetails"
    if ($('#ctl00_CP_HostelSelectOverViewDiv').is(":visible")) {
        if ($("#ctl00_CP_HostelSelectDropDownListOverView")[0].selectedIndex > 0)
            SessionValue = SessionValue + ":" + $('#ctl00_CP_HostelSelectDropDownListOverView').val();
        else {
            alert('Select Hostel first')
            return;
        }
    }
    else if ($('#ctl00_CP_HostelHiddenField').val() != '')
        SessionValue = SessionValue + ":" + $('#ctl00_CP_HostelHiddenField').val();

    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"' + SessionValue + '"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Hostel/SelectHostel.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function textToBase64Barcode(text) {
    var canvas = document.createElement("canvas");
    JsBarcode(canvas, text, { format: "CODE128" });
    return canvas.toDataURL("image/png");
}

function toggleFullScreen() {
    $("body").toggleClass("sidebar-collapse");
}

function PrintFeeReceipt(obj, ReceiptId, ReceiptBookId) {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '' && ReceiptId != '' && ReceiptBookId != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/ReceiptPrint",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "ReceiptId":"' + ReceiptId + '", "ReceiptBookId":"' + ReceiptBookId + '"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                if (data.d == "1") {
                    var e = "../Common/Report/ReportPDF.aspx"
                    return window.open(e, '', "height=1500px,width=1500px,left=0px,top=0px,toolbar=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=yes ,modal=yes"), !1;
                }
                else if (data.d == "0") {
                    alert('No records found');
                }
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function DepositAdjustmentRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"DepositAdjustment"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/FeeManagement/DepositAdjustment.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function DepositAddRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"DepositAdd"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/FeeManagement/DepositAdd.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function DepositRefundRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"DepositRefund"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/FeeManagement/DepositRefund.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function GetSMSAlert() {
    $("#ctl00_CP_SMSList").addClass("active");
    $("#ctl00_CP_EmailList").removeClass("active");
    $("#ctl00_CP_WhatsAppList").removeClass("active");
    $("#ctl00_CP_NotificationList").removeClass("active");

    $("#ctl00_CP_AlertTypeLabel")[0].innerHTML = "Alert Type: SMS";

    AlertDetailsShow();
}

function GetEmailAlert() {
    $("#ctl00_CP_SMSList").removeClass("active");
    $("#ctl00_CP_EmailList").addClass("active");
    $("#ctl00_CP_WhatsAppList").removeClass("active");
    $("#ctl00_CP_NotificationList").removeClass("active");

    $("#ctl00_CP_AlertTypeLabel")[0].innerHTML = "Alert Type: Email";

    AlertDetailsShow();
}

function GetWhatsAppAlert() {
    $("#ctl00_CP_SMSList").removeClass("active");
    $("#ctl00_CP_EmailList").removeClass("active");
    $("#ctl00_CP_WhatsAppList").addClass("active");
    $("#ctl00_CP_NotificationList").removeClass("active");

    $("#ctl00_CP_AlertTypeLabel")[0].innerHTML = "Alert Type: WhatsApp";

    AlertDetailsShow();
}

function GetNotificationAlert() {
    $("#ctl00_CP_SMSList").removeClass("active");
    $("#ctl00_CP_EmailList").removeClass("active");
    $("#ctl00_CP_WhatsAppList").removeClass("active");
    $("#ctl00_CP_NotificationList").addClass("active");

    $("#ctl00_CP_AlertTypeLabel")[0].innerHTML = "Alert Type: Notification";

    AlertDetailsShow();
}

function ChangeLogRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"ChangeLog"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/StudentManagement/StudentAllDetails.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function FeeReceiptEdit(ReceiptBookId, PayTypeId, ReceiptNumber) {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"FeeReceiptEdit:' + ReceiptBookId + ':' + PayTypeId + ':' + ReceiptNumber + '"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/FeeManagement/FeeReceipt.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function StudentProfileEditRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"StudentProfileEdit"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/StudentManagement/StudentAllDetails.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function FeeReportRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"FeeReport"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/FeeManagement/ReportCriteria/FeeReportCriteria.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function AddBonafideCertificateRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"BonafideCertificate"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Certificate/Bonafide.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function AddLCRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"LeavingCertificate"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Certificate/Leaving.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function AddCharacterCertificateRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"CharacterCertificate"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Certificate/Character.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function AddFirstTrialCertificateRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"FirstTrialCertificate"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Certificate/FirstTrial.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function AddTransferCertificateRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"TransferCertificate"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Certificate/Transfer.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function LoadCertificateDetails(obj, Id) {
    var Name = obj.parentNode.parentNode.cells[0].lastChild.innerHTML;
    if (Name == "Bonafied")
        Name = "Bonafide";
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"' + Name + 'Certificate:' + Id + '"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                if (Name == 'Bonafide')
                    window.location = "/Pages/Certificate/Bonafide.aspx";
                else if (Name == 'Character')
                    window.location = "/Pages/Certificate/Character.aspx";
                else if (Name == 'Leaving')
                    window.location = "/Pages/Certificate/Leaving.aspx";
                else if (Name == 'FirstTrial')
                    window.location = "/Pages/Certificate/FirstTrial.aspx";
                else if (Name == 'Transfer')
                    window.location = "/Pages/Certificate/Transfer.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function GetExamDetailList(ExamId, AcademicId) {
    var obj = {
        "AcademicId": AcademicId,
        "ExamId": ExamId
    };
    $.ajax({
        type: "POST",
        url: "/Pages/StudentManagement/Student360View.aspx/GetSubjectWiseExamList",
        data: JSON.stringify(obj),
        contentType: "application/json;charset=utf-8",
        dataType: "json",
        success: function (data) {
            openpopup1();
            $('#StudentExamDetailsdiv').innerHTML = data.d;
            if (data.d != '') {
                $('#ctl00_CP_StudentExamDetailsdiv').css('display', '');
                $('#ctl00_CP_StudentExamDetailsdiv').html(data.d);
            }
            else {
                $("#ctl00_CP_StudentExamDetailsdiv").css('display', 'none');
                $('#ctl00_CP_StudentExamDetailsdiv').innerHTML = "<table id='ExamDataTbl' class='table table-striped table-bordered table-hover'><tbody><tr><td>No Records Found !!</td></tr></tbody>";
            }
        }
    });
}

function openpopup1() {
    window.setTimeout(function () {
        $('.hls-bg').show();
        $('#ctl00_CP_dvexamdetailpopup').show();
    }, 1000);
}

function Closepopupexam() {
    $('.hls-bg').hide();
    $('#ctl00_CP_dvexamdetailpopup').hide();
}

function FeeCertificatePrint() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/FeeCertificate",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                if (data.d == "1") {
                    var e = "../Common/Report/ReportPDF.aspx"
                    return window.open(e, '', "height=1500px,width=1500px,left=0px,top=0px,toolbar=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=yes ,modal=yes"), !1;
                }
                else if (data.d == "0") {
                    alert('No records found');
                }
                else if (data.d == "-1") {
                    alert('Please configure from Select Report Format Page');
                }
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}

function AddBehaviorRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"AddBehavior"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/Communication/BehaviourEntry.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}
function AssignExemtionTypeRedirect() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/SetSession",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '", "SessionValue":"AssignExemptionType"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location = "/Pages/FeeManagement/AssignExemptionType.aspx";
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}
function StudentFeeDetailsReportPrint() {
    if ($("#ctl00_CP_StudentAutoSearchTextBox").val() != '') {
        $.ajax({
            type: "POST",
            url: "/Pages/StudentManagement/StudentDetailForm.aspx/StudentFeeDetailsReport",
            data: '{"Student":"' + $("#ctl00_CP_StudentAutoSearchTextBox").val() + '"}',
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                if (data.d == "1") {
                    var e = "../Common/Report/ReportPDF.aspx"
                    return window.open(e, '', "height=1500px,width=1500px,left=0px,top=0px,toolbar=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=yes ,modal=yes"), !1;
                }
                else if (data.d == "0") {
                    alert('No records found');
                }
                else if (data.d == "-1") {
                    alert('Please configure from Select Report Format Page');
                }
            },
            error: function (xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
                console.log(err.Message);
            }
        });
    }
}