<%--
    Document   : DepositKYCInquiry
    Created on : Mar 15, 2016, 3:46:48 PM
    Author     : Kaushik
--%>

<%@page import="DataEntryBean.DepositKYCCreationHdrBean"%>
<%@page import="DataEntryBean.DepositKYCCreationDetailBean"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="LoginDb.DbHandler"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.io.*"%>
<%@page import="java.util.*"%>
<%@page import="java.sql.Connection"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@page import="java.util.UUID" %>
<%String uuid = UUID.randomUUID().toString();%>
<% try {
%>


<html>
    <head>
        <title>Customer Enquiry</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script src="${pageContext.request.contextPath}/js/Calendar.js?pacs=<%=((new java.util.Date()).getTime())%>"></script>
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/TableCSSCode.css?pacs=<%=((new java.util.Date()).getTime())%>" />
        <link rel="shortcut icon" href="${pageContext.request.contextPath}/img/favicon.ico?pacs=<%=((new java.util.Date()).getTime())%>" type="image/x-icon" />
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/styles.css?pacs=<%=((new java.util.Date()).getTime())%>"/>
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/ButtonAndText.css?pacs=<%=((new java.util.Date()).getTime())%>" />
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/info.css?pacs=<%=((new java.util.Date()).getTime())%>" />
        <script type="text/javascript" src="${pageContext.request.contextPath}/jquery-ui-1.10.4.custom/development-bundle/jquery-1.10.2.js?pacs=<%=((new java.util.Date()).getTime())%>"></script>
        <script type="text/javascript" src="/PacsApplication/chromejs/chrome.js?pacs=<%=((new java.util.Date()).getTime())%>"></script>
        <script type="text/javascript" src="/PacsApplication/js/iFrame_killer.js"></script>
        <style>
            body {
                font-family: Arial, Helvetica, sans-serif;
            }

            #blah {
                border-radius: 5px;
                cursor: pointer;
                transition: 0.3s;
            }

            #blah:hover {
                opacity: 0.7;
            }

            .idImg {
                border-radius: 5px;
                cursor: pointer;
                transition: 0.3s;
            }

            .idImg:hover {
                opacity: 0.7;
            }

            #image-holder{
                position: absolute;
                top:430;
                right: 100;
                left: 750;
                bottom:180;
                width: auto;

            }
            /* Added by Bishnu */
            /* The Modal (background) */
            .modal {
                display: none; /* Hidden by default */
                position: fixed; /* Stay in place */
                z-index: 1; /* Sit on top */
                padding-top: 100px; /* Location of the box */
                left: 0;
                top: 0;
                width: 100%; /* Full width */
                height: 100%; /* Full height */
                overflow: auto; /* Enable scroll if needed */
                background-color: rgb(0,0,0); /* Fallback color */
                background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
            }

            /* Modal Content (image) */
            .modal-content {
                margin: auto;
                display: block;
                width: 80%;
                max-width: 700px;
            }

            /* Add Animation */
            .modal-content, #caption {
                -webkit-animation-name: zoom;
                -webkit-animation-duration: 0.6s;
                animation-name: zoom;
                animation-duration: 0.6s;
            }

            @-webkit-keyframes zoom {
                from {
                    -webkit-transform:scale(0)
                }
                to {
                    -webkit-transform:scale(1)
                }
            }

            @keyframes zoom {
                from {
                    transform:scale(0)
                }
                to {
                    transform:scale(1)
                }
            }
            /* The Close Button */
            .close {
                position: absolute;
                top: 15px;
                right: 35px;
                color: #f1f1f1;
                font-size: 40px;
                font-weight: bold;
                transition: 0.3s;
            }

            .close:hover,
            .close:focus {
                color: #bbb;
                text-decoration: none;
                cursor: pointer;
            }
            /* 100% Image Width on Smaller Screens */
            <%--@media only screen and (max-width: 700px){
                .modal-content {
                    width: 100%;
                }
            }--%>

        </style>
    </head>
    <body  onload="noBack()">

        <script type="text/javascript">
            function noBack()
            {
                window.history.forward();
                $('#oldId1').hide();
                $('#oldId2').hide();
                $('#newId').hide();
            }

            function popup_CIF(width, height, cifNumber, cifName) {

                if (window.innerWidth) {
                    LeftPosition = (window.innerWidth - width) / 2;
                    TopPosition = ((window.innerHeight - height) / 2) - 20;
                } else {
                    LeftPosition = (parseInt(window.screen.width) - width) / 2;
                    TopPosition = ((parseInt(window.screen.height) - height) / 2) - 20;
                }
                attr = 'resizable=yes,scrollbars=yes,width=' + width + ',height=' +
                        height + ',screenX=300,screenY=200,left=' + LeftPosition + ',top=' +
                        TopPosition + '';
                var screenName = "DepositKYCInquiry.jsp";
                var lovKey = "PickUPCustomer";
                popWin = open('${pageContext.request.contextPath}/CommonSearchInformationDepositLOV.jsp?cifName=' + cifName + '&cifNumber=' + cifNumber + '&screenName=' + screenName + '&lovKey=' + lovKey, 'PickUPCustomer', attr);
                popWin.focus();
            }

            function popup_CIFNAME(width, height, cifName, cifNumber) {

                if (window.innerWidth) {
                    LeftPosition = (window.innerWidth - width) / 2;
                    TopPosition = ((window.innerHeight - height) / 2) - 20;
                } else {
                    LeftPosition = (parseInt(window.screen.width) - width) / 2;
                    TopPosition = ((parseInt(window.screen.height) - height) / 2) - 20;
                }
                attr = 'resizable=yes,scrollbars=yes,width=' + width + ',height=' +
                        height + ',screenX=300,screenY=200,left=' + LeftPosition + ',top=' +
                        TopPosition + '';
                var screenName = "DepositKYCInquiry.jsp";
                var lovKey = "PickUPCustomer";
                popWin = open('${pageContext.request.contextPath}/CommonSearchInformationDepositLOV.jsp?cifName=' + cifName + '&cifNumber=' + cifNumber + '&screenName=' + screenName + '&lovKey=' + lovKey, 'PickUPCustomer', attr);
                popWin.focus();
            }
            function popup_kycDet(width, height, kycID) {

                if (window.innerWidth) {
                    LeftPosition = (window.innerWidth - width) / 2;
                    TopPosition = ((window.innerHeight - height) / 2) - 20;
                } else {
                    LeftPosition = (parseInt(window.screen.width) - width) / 2;
                    TopPosition = ((parseInt(window.screen.height) - height) / 2) - 20;
                }
                attr = 'resizable=yes,scrollbars=yes,width=' + width + ',height=' +
                        height + ',screenX=300,screenY=200,left=' + LeftPosition + ',top=' +
                        TopPosition + '';
                var screenName = "DepositKYCInquiry.jsp";
                var lovKey = "PickUPKYC";
                popWin = open('${pageContext.request.contextPath}/CommonSearchInfoLOVNew.jsp?kycID=' + kycID + '&screenName=' + screenName + '&lovKey=' + lovKey, 'PickUPCustomer', attr);
                popWin.focus();
            }
            $(document).ready(function () {
                $('select#searchCust').change(function () {
                    var shouldEnable = $(this).val();
                    switch (shouldEnable)
                    {
                        case 'C':
                            $('#oldId1').show();
                            $('#oldId2').show();
                            $('#newId').hide();
                            break;
                        case 'I':
                            $('#oldId1').hide();
                            $('#oldId2').hide();
                            $('#newId').show();
                            break;
                        default:
                            $('#oldId1').hide();
                            $('#oldId2').hide();
                            $('#newId').hide();
                            break;
                    }
                });
            });

            function submitform(customerEnquiry)
            {
                if (customerEnquiry.searchCust.value == "")
                {
                    alert("Please select Search Customer By.");
                    customerEnquiry.searchCust.focus();
                    return false;
                }
                if (customerEnquiry.cifNumber.value == "" && customerEnquiry.cifName.value == "" && customerEnquiry.kycID.value == "")
                {
                    alert("All the search fields are empty.");
                    customerEnquiry.cifNumber.focus();
                    return false;
                }
                document.forms[0].handle_id.value = "SearchCIF";
                document.forms[0].action = '/PacsApplication/DepositKYCCreationServlet';
                document.forms[0].submit();
            }

            function checkImages()
            {
                if (document.getElementById("file").value != "")
                {
                    if (!hasExtension('file', ['.jpg', '.JPG'])) {
                        alert("Invalid Photo! Please select valid JPG/JPEG Photograph.");
                        return false;
                    } else
                    {
                        var photo = document.getElementById("file");
                        var size1 = parseFloat(photo.files[0].size / 1024).toFixed(2);
                        if (size1 > 50)
                        {
                            alert("Please upload Photograph within 50 KB by size.");
                            return false;
                        }
                    }
                }
                if (document.getElementById("sigUpld").value != "")
                {
                    if (!hasExtension('sigUpld', ['.jpg', '.JPG'])) {
                        alert("Invalid Photo! Please select valid JPG/JPEG Signature.");
                        return false;
                    } else
                    {
                        var photo = document.getElementById("sigUpld");
                        var size1 = parseFloat(photo.files[0].size / 1024).toFixed(2);
                        if (size1 > 30)
                        {
                            alert("Please upload Signature within 30 KB by size.");
                            return false;
                        }
                    }
                }

                //var counter = ($("#order-list tr").length)-1;
                // alert("counter:"+counter);

                var browse1 = $("#file1").val();
                var browse2 = $("#file2").val();
                var browse3 = $("#file3").val();
                var browse4 = $("#file4").val();
                var browse5 = $("#file5").val();
                //alert("browse5"+browse5);

                //if (counter >= 5 ) {
                if (browse5 != "" && browse5 != undefined)
                {
                    if (!hasExtension('file5', ['.jpg', '.JPG'])) {
                        alert("Invalid Photo! Please select valid JPG/JPEG ID Scan Image.");
                        return false;
                    } else
                    {
                        var photo = document.getElementById("file5");
                        var size1 = parseFloat(photo.files[0].size / 1024).toFixed(2);
                        if (size1 > 50)
                        {
                            alert("Please upload ID Scan Image within 50 KB by size.");
                            return false;
                        }
                    }
                }
                //if (counter >= 4 ) {
                if (browse4 != "" && browse4 != undefined)
                {
                    if (!hasExtension('file4', ['.jpg', '.JPG'])) {
                        alert("Invalid Photo! Please select valid JPG/JPEG ID Scan Image.");
                        return false;
                    } else
                    {
                        var photo = document.getElementById("file4");
                        var size1 = parseFloat(photo.files[0].size / 1024).toFixed(2);
                        if (size1 > 50)
                        {
                            alert("Please upload ID Scan Image within 50 KB by size.");
                            return false;
                        }
                    }
                }
                //if (counter >= 3 ) {
                if (browse3 != "" && browse3 != undefined)
                {
                    if (!hasExtension('file3', ['.jpg', '.JPG'])) {
                        alert("Invalid Photo! Please select valid JPG/JPEG ID Scan Image.");
                        return false;
                    } else
                    {
                        var photo = document.getElementById("file3");
                        var size1 = parseFloat(photo.files[0].size / 1024).toFixed(2);
                        if (size1 > 50)
                        {
                            alert("Please upload ID Scan Image within 50 KB by size.");
                            return false;
                        }
                    }
                }
                //if (counter >= 2 ) {
                if (browse2 != "" && browse2 != undefined)
                {
                    if (!hasExtension('file2', ['.jpg', '.JPG'])) {
                        alert("Invalid Photo! Please select valid JPG/JPEG ID Scan Image.");
                        return false;
                    } else
                    {
                        var photo = document.getElementById("file2");
                        var size1 = parseFloat(photo.files[0].size / 1024).toFixed(2);
                        if (size1 > 50)
                        {
                            alert("Please upload ID Scan Image within 50 KB by size.");
                            return false;
                        }
                    }
                }
                //if (counter >= 1 ) {
                //if (document.getElementById("file1").value != "" || $("#file1").val() )
                if (browse1 != "" && browse1 != undefined)
                {
                    if (!hasExtension('file1', ['.jpg', '.JPG'])) {
                        alert("Invalid Photo! Please select valid JPG/JPEG ID Scan Image.");
                        return false;
                    } else
                    {
                        var photo = document.getElementById("file1");
                        var size1 = parseFloat(photo.files[0].size / 1024).toFixed(2);
                        if (size1 > 50)
                        {
                            alert("Please upload ID Scan Image within 50 KB by size.");
                            return false;
                        }
                    }
                }

                return true;
            }


            function UpdateForm(customerEnquiry)
            {
                if (checkBeforeUpdate(customerEnquiry))
                {
                    if (checkImages()) {

                        if (checkDuplicateID()) {
                            document.customerEnquiry.handle_id.value = "Update";
                            document.customerEnquiry.action = '/PacsApplication/DepositKYCCreationServlet';
                            document.customerEnquiry.submit();
                        }
                    }
                }
            }
            function checkBeforeUpdate(customerEnquiry)
            {
                if (customerEnquiry.tittleAmend.value == "")
                {
                    alert("Tittle must be filled.");
                    customerEnquiry.tittleAmend.focus();
                    return false;
                }
                if (customerEnquiry.fNameAmend.value == "")
                {
                    alert("First Name must be filled.");
                    customerEnquiry.fNameAmend.focus();
                    return false;
                }
                if (customerEnquiry.lNameAmend.value == "")
                {
                    alert("Last Name must be filled3");
                    customerEnquiry.lNameAmend.focus();
                    return false;
                }
                if (customerEnquiry.motherNameAmend.value == "")
                {
                    alert("Mother's Name must be filled.");
                    customerEnquiry.motherNameAmend.focus();
                    return false;
                }
                if (customerEnquiry.add1Amend.value == "")
                {
                    alert("Address Line1 must be filled.");
                    customerEnquiry.add1Amend.focus();
                    return false;
                }
                if (customerEnquiry.add3Amend.value == "")
                {
                    alert("Address Line3 must be filled.");
                    customerEnquiry.add3Amend.focus();
                    return false;
                }
                if (customerEnquiry.pinAmend.value == "")
                {
                    alert(" PIN Code must be filled.");
                    customerEnquiry.pinAmend.focus();
                    return false;
                }
                if (customerEnquiry.distnameAmend.value == "")
                {
                    alert(" District must be filled.");
                    customerEnquiry.distnameAmend.focus();
                    return false;
                }
                if (customerEnquiry.farmerTypeAmend.value == "")
                {
                    alert("Farmer Type must be filled.");
                    customerEnquiry.farmerTypeAmend.focus();
                    return false;
                }
                if (customerEnquiry.genderAmend.value == "")
                {
                    alert("Gender must be filled.");
                    customerEnquiry.genderAmend.focus();
                    return false;
                }
                if (customerEnquiry.religionAmend.value == "")
                {
                    alert("Religion must be filled.");
                    customerEnquiry.religionAmend.focus();
                    return false;
                }
                if (customerEnquiry.casteAmend.value == "")
                {
                    alert("Caste must be filled");
                    customerEnquiry.casteAmend.focus();
                    return false;
                }
                if (customerEnquiry.dobAmend.value == "")
                {
                    alert("Date Of Birth must be filled.");
                    customerEnquiry.dobAmend.focus();
                    return false;
                }
                if (customerEnquiry.mNumberAmend.value != "")
                {
                    if (customerEnquiry.mNumberAmend.value.length != 10)
                    {
                        alert("Mobile Number Details must contain 10 digit.");
                        customerEnquiry.mNumberAmend.focus();
                        return false;
                    }
                }

                var chkdate = document.getElementById("dobAmend").value;
                var edate = chkdate.split("/");
                var spdate = new Date();
                var sdd = spdate.getDate();
                var smm = spdate.getMonth();
                var syyyy = spdate.getFullYear() - 0;
                var today = new Date(syyyy, smm, sdd).getTime();
                var e_date = new Date(edate[2], edate[1] - 1, edate[0]).getTime();
                if (e_date > today)
                {
                    alert("Please provide appropriate Date of Birth.");
                    return false;
                }

                var counter = document.forms[0].all_rowsAdded.value;

                try {
                    for (var i = 1; i <= counter; i++) {

                        var document_mst_idAmend = document.getElementById("document_mst_idAmend" + i).value;
                        var idIssueAtAmend = document.getElementById("idIssueAtAmend" + i).value;
                        var idNumberAmend = document.getElementById("idNumberAmend" + i).value;
                        var idIssueDateAmend = document.getElementById("idIssueDateAmend" + i).value;


                        if (document_mst_idAmend == "" || idIssueAtAmend == "" || idNumberAmend == "" || idIssueDateAmend == "") {
                            alert("All Fields are mandatory.");
                            return false;
                        }

                        var chkdate = document.getElementById("idIssueDateAmend" + i).value;
                        var edate = chkdate.split("/");
                        var spdate = new Date();
                        var sdd = spdate.getDate();
                        var smm = spdate.getMonth();
                        var syyyy = spdate.getFullYear() - 0;
                        var today = new Date(syyyy, smm, sdd).getTime();
                        var e_date = new Date(edate[2], edate[1] - 1, edate[0]).getTime();
            <%--if(e_date > today)
            {
                alert("Please provide appropriate Date of ID Issue!");
                return false;
            }--%>

                    }
                } catch (e) {

                }
                return true;
            }

            function ShowParent()
            {
                document.forms[0].action = "${pageContext.request.contextPath}/Deposit/DepositKYCInquiry.jsp";
                document.forms[0].submit();
            }

            function checkDuplicateID() {
                var arr = [];
                $("#order-list tbody tr").each(function () {
                    arr.push($(this).find("td:nth-child(5) input").val());

                });
                for (var i = 0; i < arr.length; i++)
                {
                    for (var j = 0; j < arr.length; j++)
                    {
                        if (i != j)
                        {
                            if (arr[i] == arr[j])
                            {
                                alert("Please do not repeat ID Number.");
                                return false;
                            }
                        }
                    }
                }
                arr = [];
                return true;
            }

            function readURL(input) {
                if (input.files && input.files[0]) {
                    var reader = new FileReader();

                    reader.onload = function (e) {
                        $('#blah').attr('src', e.target.result);
                    }

                    reader.readAsDataURL(input.files[0]);
                }
            }

            function sigreadURL(input) {
                if (input.files && input.files[0]) {
                    var reader = new FileReader();

                    reader.onload = function (e) {
                        $('#blahsig').attr('src', e.target.result);
                        $('#nosig').hide();

                    }

                    reader.readAsDataURL(input.files[0]);
                }
            }

            $(document).ready(function () {
                $("#file").change(function () {
                    readURL(this);
                    $('#image-holder').show();
                });
                $("#sigUpld").change(function () {
                    sigreadURL(this);
                    $('#blahsig').show();
                });
            });

            function hasExtension(inputID, exts) {
                var fileName = document.getElementById(inputID).value;
                return (new RegExp('(' + exts.join('|').replace(/\./g, '\\.') + ')$')).test(fileName);
            }

        </script>
        <script type="text/javascript">
            (function ($) {
                $.fn.ajaxfileupload = function (options) {
                    var settings = {
                        params: {},
                        action: '',
                        onStart: function () { },
                        onComplete: function (response) { },
                        onCancel: function () { },
                        validate_extensions: true,
                        valid_extensions: ['jpg'],
                        submit_button: null
                    };

                    var uploading_file = false;

                    if (options) {
                        $.extend(settings, options);
                    }


                    // 'this' is a jQuery collection of one or more (hopefully)
                    //  file elements, but doesn't check for this yet
                    return this.each(function () {
                        var $element = $(this);

                        // Skip elements that are already setup. May replace this
                        //  with uninit() later, to allow updating that settings
                        if ($element.data('ajaxUploader-setup') === true)
                            return;

                        $element.change(function ()
                        {
                            // since a new image was selected, reset the marker
                            uploading_file = false;

                            // only update the file from here if we haven't assigned a submit button
                            if (settings.submit_button == null)
                            {
                                upload_file();
                            }
                        });

                        if (settings.submit_button == null)
                        {
                            // do nothing
                        } else
                        {
                            settings.submit_button.click(function (e)
                            {
                                // Prevent non-AJAXy submit
                                e.preventDefault();

                                // only attempt to upload file if we're not uploading
                                if (!uploading_file)
                                {
                                    upload_file();
                                }
                            });
                        }

                        var upload_file = function ()
                        {
                            if ($element.val() == '')
                                return settings.onCancel.apply($element, [settings.params]);

                            // make sure extension is valid
                            var ext = $element.val().split('.').pop().toLowerCase();
                            if (true === settings.validate_extensions && $.inArray(ext, settings.valid_extensions) == -1)
                            {
                                // Pass back to the user
                                settings.onComplete.apply($element, [{status: false, message: 'The select file type is invalid. File must be ' + settings.valid_extensions.join(', ') + '.'}, settings.params]);
                            } else
                            {
                                uploading_file = true;
                                // Creates the form, extra inputs and iframe used to
                                //  submit / upload the file
                                wrapElement($element);

                                // Call user-supplied (or default) onStart(), setting
                                //  it's this context to the file DOM element
                                var ret = settings.onStart.apply($element, [settings.params]);

                                // let onStart have the option to cancel the upload
                                if (ret !== false)
                                {
                                    $element.parent('form').submit(function (e) {
                                        e.stopPropagation();
                                    }).submit();
                                } else {
                                    uploading_file = false;
                                }
                            }
                        };

                        // Mark this element as setup
                        $element.data('ajaxUploader-setup', true);
                        /*
                         // Internal handler that tries to parse the response
                         //  and clean up after ourselves.
                         */
                        var handleResponse = function (loadedFrame, element) {
                            var response, responseStr = $(loadedFrame).contents().text();
                            try {
                                //response = $.parseJSON($.trim(responseStr));
                                response = JSON.parse(responseStr);
                            } catch (e) {
                                response = responseStr;
                            }
                            // Tear-down the wrapper form
                            element.siblings().remove();
                            element.unwrap();

                            uploading_file = false;

                            // Pass back to the user
                            settings.onComplete.apply(element, [{
                                    status: true,
                                    message: 'Your file has been uploaded!'
                                }, settings.params]);
                        };

                        /*
                         // Wraps element in a <form> tag, and inserts hidden inputs for each
                         //  key:value pair in settings.params so they can be sent along with
                         //  the upload. Then, creates an iframe that the whole thing is
                         //  uploaded through.
                         */
                        var wrapElement = function (element) {
                            // Create an iframe to submit through, using a semi-unique ID
                            var frame_id = 'ajaxUploader-iframe-' + Math.round(new Date().getTime() / 1000)
                            $('body').after('<iframe width="0" height="0" style="display:none;" name="' + frame_id + '" id="' + frame_id + '"/>');
                            $('#' + frame_id).get(0).onload = function () {
                                handleResponse(this, element);
                            };
                            // Wrap it in a form
                            element.wrap(function () {
                                return '<form action="' + settings.action + '" method="POST" enctype="multipart/form-data" target="' + frame_id + '" />'
                            })
                                    // Insert <input type='hidden'>'s for each param
                                    .before(function () {
                                        var key, html = '';
                                        for (key in settings.params) {
                                            var paramVal = settings.params[key];
                                            if (typeof paramVal === 'function') {
                                                paramVal = paramVal();
                                            }
                                            html += '<input type="hidden" name="' + key + '" value="' + paramVal + '" />';
                                        }
                                        return html;
                                    });
                        }
                    });
                }
            })(jQuery)
        </script>
        <script lang="Javascript">
            $(document).ready(function () {
                $('#file').ajaxfileupload({
                    'action': '/PacsApplication/UploadFile',
                    'onComplete': function (response) {
                        $('#upload').hide();
                        $('#message').show();

                        var statusVal = JSON.stringify(response.status);

                        if (statusVal == "false")
                        {
                            $("#message").html("<font color='red'>" + JSON.stringify(response.message) + "</font>");
                        }
                        if (statusVal == "true")
                        {
                            $("#message").html("<font color='green'>" + JSON.stringify(response.message) + "</font>");
                        }
                    },
                    'onStart': function () {
                        $('#upload').show();
                        $('#message').hide();
                    }
                });
                $('#sigUpld').ajaxfileupload({
                    'action': '/PacsApplication/SigUploadFile',
                    'onComplete': function (response) {
                        $('#sigupload').hide();
                        $('#sigmessage').show();

                        var statusVal = JSON.stringify(response.status);

                        if (statusVal == "false")
                        {
                            $("#sigmessage").html("<font color='red'>" + JSON.stringify(response.message) + "</font>");
                        }
                        if (statusVal == "true")
                        {
                            $("#sigmessage").html("<font color='green'>" + JSON.stringify(response.message) + "</font>");
                        }
                    },
                    'onStart': function () {
                        $('#sigupload').show();
                        $('#sigmessage').hide();
                    }
                });
            });
            $(document).on("DOMNodeInserted", function () {

                $('.upldId').ajaxfileupload({
                    'action': '/PacsApplication/UploadIdFile',
                    //url: '/PacsApplication/UploadIdFile',
                    //data: { 'name': $("#document_mst_id1").val() },
                    //dataType: 'html',
                    'onComplete': function (response) {
                        var id = $(this).attr('id');

                        //alert(id[id.length -1]);
                        var rowno = id[id.length - 1];
                        $('#idUpload' + rowno).hide();
                        $('#message' + rowno).show();
                        $('#upldFlag' + rowno).val('1');
                        var statusVal = JSON.stringify(response.status);

                        if (statusVal == "false")
                        {
                            $("#message" + rowno).html("<font color='red'>" + JSON.stringify(response.message) + "</font>");
                        }
                        if (statusVal == "true")
                        {
                            $("#message" + rowno).html("<font color='green'>" + JSON.stringify(response.message) + "</font>");
                        }
                    },
                    'onStart': function () {
                        var id = $(this).attr('id');
                        var rowno = id[id.length - 1];
                        $('#upload' + rowno).show();
                        $('#message' + rowno).hide();
                    }
                });
            });

        // to restrict back button
            history.pushState(null, null, location.href);
            window.addEventListener('popstate', function (event) {
                history.pushState(null, null, location.href);
            });

        </script>

        <%
            String ModuleName = new String();

            ModuleName = (String) session.getAttribute("moduleName");
        %>

        <%if (ModuleName.equalsIgnoreCase("Deposit")) {%>
        <jsp:include page="/Deposit/MenuHead_Deposit.jsp" flush="true" />
        <%} else if (ModuleName.equalsIgnoreCase("Loan")) {%>
        <jsp:include page="/Loan/MenuHead_Loan.jsp" flush="true" />
        <%} else if (ModuleName.equalsIgnoreCase("SpecialBothKcc")) {%>
        <jsp:include page="/MenuHead.jsp" flush="true" />
        <%} else if (ModuleName.equalsIgnoreCase("SpecialBothDep")) {%>
        <jsp:include page="/Deposit/MenuHead_Deposit.jsp" flush="true" />
        <%} else if (ModuleName.equalsIgnoreCase("SpecialBoth")) {%>
        <jsp:include page="/Deposit/MenuHead_Deposit.jsp" flush="true" />
        <%} else if (ModuleName.equalsIgnoreCase("KCC")) {%>
        <jsp:include page="/MenuHead.jsp" flush="true" />
        <%}%>
        <br>

        <%int count = 1;
            int populatedRows = 0;
            int idScore = 0;
            String error_msg = "";
            Object error = request.getAttribute("message");
            if (error != null) {
                error_msg = error.toString();
            }
        %>

        <%
            String displayFlag = "";
            Object display = request.getAttribute("displayFlag");
            if (display != null) {
                displayFlag = display.toString();
            }
        %>

        <%
            Object oDepositKYCCreationHdrBeanObj = request.getAttribute("oDepositKYCCreationBeanObj");
            DepositKYCCreationHdrBean oDepositKYCCreationHdrBean = new DepositKYCCreationHdrBean();
            if (oDepositKYCCreationHdrBeanObj != null) {
                oDepositKYCCreationHdrBean = (DepositKYCCreationHdrBean) request.getAttribute("oDepositKYCCreationBeanObj");
            }
        %>

        <%
            Object alDepositKYCCreationDetailBeanObj = request.getAttribute("alDepositKYCCreationDetailBean");
            ArrayList<DepositKYCCreationDetailBean> alDepositKYCCreationDetailBean = new ArrayList<DepositKYCCreationDetailBean>();
            DepositKYCCreationDetailBean oDepositKYCCreationDetailBean = new DepositKYCCreationDetailBean();
            if (alDepositKYCCreationDetailBeanObj != null) {
                alDepositKYCCreationDetailBean = (ArrayList<DepositKYCCreationDetailBean>) request.getAttribute("alDepositKYCCreationDetailBean");

            }
        %>

        <fieldset style="border-color: black; background-image: url('/PacsApplication/img/download.jpg'); border-width: 3px">
            <legend style="padding: 8px; border-radius: 20px; background-color: #006600; color: white">Customer (KYC) Details</legend>
            <form name="customerEnquiry" id="customerEnquiry" action="" method="post">


                <%if (!error_msg.equalsIgnoreCase("")) {%>
                <center><div class="info" id="errorMessage"><center><%= error_msg%></center></div></center>
                            <% }%>
                <br>
                <br>
                <center>
                    <table>
                        <tr><td>Search Customer By:</td><td><select id="searchCust" name="searchCust"><option value=""> --Select-- </option><option value="C">CIF Number/ Name</option><option value="I">KYC ID Details</option></select></td></tr>
                        <tr><td> <br></td></tr>
                        <tr id="oldId1"><td>Enter CIF Number: </td>
                            <td><input type="text" style="text-align:right;" name="cifNumber" id="cifNumber" onkeypress='return event.charCode >= 48 && event.charCode <= 57'/><input type="button" value="Search" id="Search" onclick="javascript:popup_CIF(1050, 200, document.customerEnquiry.cifNumber.value, document.customerEnquiry.cifName.value);"/></td></tr>
                        <tr><td> <br></td></tr>
                        <tr id="oldId2"><td>Enter CIF Name: </td>
                            <td><input type="text" style="text-align:left;" name="cifName" id="cifName" onkeypress='return event.charCode >= 65 && event.charCode <= 90' /><input type="button" value="Search" id="Search" onclick="javascript:popup_CIFNAME(1050, 200, document.customerEnquiry.cifName.value, document.customerEnquiry.cifNumber.value);"/></td></tr>
                        <tr><td> <br></td></tr>
                        <tr id="newId"><td>Enter KYC ID Number: </td>
                            <td><input type="text" style="text-align:right;" name="kycID" id="kycID"/><input type="button" value="Search" id="Search" onclick="javascript:popup_kycDet(1050, 200, document.customerEnquiry.kycID.value);"/></td></tr>
                        <tr><td> <br></td></tr>
                    </table>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="button" value="Submit" id="Submit" onclick="javascript:submitform(customerEnquiry)"/>
                    <input type="button" value="Reset" id="Reset" onclick="ShowParent();" />
                </center>
                <br>
                <%!
                    String blankNull(String s) {
                        return (s == null) ? "" : s;
                    }
                %>
                <%
                    if (displayFlag.equalsIgnoreCase("Y")) {
                %>
                <div id="show" align="left" >
                    <h3>CIF Details :</h3>

                    <table>
                        <tbody>
                            <tr>
                                <td>Select Photograph:</td>
                                <td><input type="file" name="file" id="file" />
                                    <div id="upload" style="display: none;">Uploading..</div>
                                    <div id="message"></div>
                                </td>
                            </tr>
                            <tr>
                                <td>Select Signature:</td>
                                <td><input type="file" name="sigUpld" id="sigUpld" />
                                    <div id="sigupload" style="display: none;">Uploading..</div>
                                    <div id="sigmessage"></div>
                                </td>
                            </tr>
                            <tr>
                                <td>CIF Number:</td>
                                <td><input type="text" readonly="true" name="cifNoAmend"  id="cifNoAmend" style="text-align:right" style="width: 260px" value="<%=blankNull(oDepositKYCCreationHdrBean.getCif())%>" /></td>
                            </tr>
                            <tr>
                                <td>Customer Type:</td>
                                <td><input type="text" name="cTypeAmend"  id="cTypeAmend" style="width: 260px" value="<%=blankNull(oDepositKYCCreationHdrBean.getcType())%>" /></td>
                            </tr>

                            <tr>
                                <td>Tittle:<font color="red" >*</font></td>
                                <td><select id="tittleAmend" name="tittleAmend">
                                        <option value="">--- Select ---</option>
                                        <option value="Mr." <%if (oDepositKYCCreationHdrBean.getTitle().equals("Mr.")) {%> selected <%}%>>Mr.</option>
                                        <option value="Mrs." <%if (oDepositKYCCreationHdrBean.getTitle().equals("Mrs.")) {%> selected <%}%>>Mrs.</option>
                                        <option value="M/S." <%if (oDepositKYCCreationHdrBean.getTitle().equals("M/S.")) {%> selected <%}%>>M/S.</option>                                        
                                    </select></td>
                            </tr>
                            <tr>
                                <td>First Name:<font color="red" >*</font></td>
                                <td><input type="text" style="text-align:left;" name="fNameAmend" style="width: 260px" id="fNameAmend" value="<%=blankNull(oDepositKYCCreationHdrBean.getfName())%>" /></td>
                            </tr>
                            <tr>
                                <td>Middle Name: </td>
                                <td><input type="text" style="text-align:left;" name="mNameAmend" style="width: 260px" id="mNameAmend" value="<%=blankNull(oDepositKYCCreationHdrBean.getmName())%>"/></td>
                            </tr>
                            <tr>
                                <td>Last Name:<font color="red" >*</font></td>
                                <td><input type="text" style="text-align:left;" name="lNameAmend" style="width: 260px" id="lNameAmend" value="<%=blankNull(oDepositKYCCreationHdrBean.getlName())%>" /></td>
                            </tr>
                            <tr>
                                <td>Guardian Name/ Husband Name: </td>
                                <td><input type="text" style="text-align:left;" name="gNameAmend" style="width: 260px" id="gNameAmend" value="<%=blankNull(oDepositKYCCreationHdrBean.getgName())%>"  /></td>

                                <td>Mother's Name:<font color="red" >*</font></td>
                                <td><input type="text" style="text-align:left;" name="motherNameAmend" style="width: 260px" id="motherNameAmend" value="<%=blankNull(oDepositKYCCreationHdrBean.getMotherName())%>"  /></td>
                            </tr>
                            <tr>
                                <td>
                                    Address Line1:<font color="red" >*</font>
                                </td>
                                <td>
                                    <textarea name="add1Amend" id="add1Amend" ><%=blankNull(oDepositKYCCreationHdrBean.getAdd1())%></textarea>
                                </td>

                                <td>
                                    Address Line2:
                                </td>
                                <td>
                                    <textarea name="add2Amend" id="add2Amend"> <%=blankNull(oDepositKYCCreationHdrBean.getAdd2())%></textarea>
                                </td>
                                <td>
                                    Address Line3:<font color="red" >*</font>
                                </td>
                                <td>
                                    <textarea name="add3Amend" id="add3Amend" ><%=blankNull(oDepositKYCCreationHdrBean.getAdd3())%></textarea>
                                </td>
                            </tr>
                            <tr>
                                <td>Block: </td>
                                <td><input type="text" name="blockAmend" id="blockAmend" value="<%=blankNull(oDepositKYCCreationHdrBean.getBlock())%>" /></td>

                                <td>PIN Code:<font color="red">*</font> </td>
                                <td><input type="text" name="pinAmend" id="pinAmend" value="<%=blankNull(oDepositKYCCreationHdrBean.getPin())%>" /></td>
                                
                                <td>Area/Ward: </td>
                                <td><input type="text" name="wardAmend" id="wardAmend" value="<%=blankNull(oDepositKYCCreationHdrBean.getWard())%>" /></td>
                            </tr>
                            <tr>
                                <td>District<font color="red" >*</font>:</td>
                                <td><input type="text" style="text-align:left;" name="distnameAmend" style="width: 260px" id="distnameAmend" value="<%=blankNull(oDepositKYCCreationHdrBean.getDistname())%>" /></td>
                                <td>City/Town: </td>
                                <td><input type="text" style="text-align:left;" name="citynameAmend" id="citynameAmend" value="<%=blankNull(oDepositKYCCreationHdrBean.getCity())%>" /></td>

                                <td>State: </td>
                                <td><input type="text" style="text-align:left;" name="statenameAmend" id="statenameAmend" value="<%=blankNull(oDepositKYCCreationHdrBean.getStatename())%>" /></td>
                            </tr>
                            <tr>
                                <td>Date Of Birth<font color="red" >*</font>: </td>
                                <td><input  type="text" id="dobAmend" name="dobAmend" readonly value="<%=blankNull(oDepositKYCCreationHdrBean.getDob())%>" />&nbsp;<a href="#" onclick="return getCalendar(document.forms[0].dobAmend);"><img src="${pageContext.request.contextPath}/img/calendar.jpg" name="imgr" border="0" width="25" height="20" /></a></td>
                                <td>Membership Number: </td>
                                <td><input type="text" style="text-align:left;" id="mem_noAmend" name="mem_noAmend" value="<%=blankNull(oDepositKYCCreationHdrBean.getMem_no())%>" /></td>
                                <td>Farmer Type<font color="red" >*</font>: </td>
                                <td><select id="farmerTypeAmend" name="farmerTypeAmend">
                                        <option value="" <%if (oDepositKYCCreationHdrBean.getFarmerType() == null || oDepositKYCCreationHdrBean.getFarmerType() == "") {%> selected <%}%> >--- Select ---</option>
                                        <option value="S" <%if (blankNull(oDepositKYCCreationHdrBean.getFarmerType()).equalsIgnoreCase("S")) {%> selected <%}%>>Small/Marginal</option>
                                        <option value="O" <%if (blankNull(oDepositKYCCreationHdrBean.getFarmerType()).equalsIgnoreCase("O")) {%> selected <%}%>>Other</option>
                                    </select></td>
                            </tr>
                            <tr>
                                <td>Gender<font color="red" >*</font>:</td>
                                <td><select id="genderAmend" name="genderAmend">
                                        <option value="">--- Select ---</option>
                                        <option value="M" <%if (oDepositKYCCreationHdrBean.getGender().equals("M")) {%> selected <%}%>>Male</option>
                                        <option value="F" <%if (oDepositKYCCreationHdrBean.getGender().equals("F")) {%> selected <%}%>>Female</option>
                                        <option value="O" <%if (oDepositKYCCreationHdrBean.getGender().equals("O")) {%> selected <%}%>>Other</option>

                                    </select></td>
                                <td>Religion<font color="red" >*</font>:</td>
                                <td><select id="religionAmend" name="religionAmend">
                                        <option value="" disabled selected>--- Select ---</option>
                                        <option value="1" <%if (oDepositKYCCreationHdrBean.getReligion().equals("1")) {%> selected <%}%>>Hindu</option>
                                        <option value="2" <%if (oDepositKYCCreationHdrBean.getReligion().equals("2")) {%> selected <%}%>>Muslim</option>
                                        <option value="3" <%if (oDepositKYCCreationHdrBean.getReligion().equals("3")) {%> selected <%}%>>Christian</option>
                                        <option value="4" <%if (oDepositKYCCreationHdrBean.getReligion().equals("4")) {%> selected <%}%>>Sikh</option>
                                        <option value="5" <%if (oDepositKYCCreationHdrBean.getReligion().equals("5")) {%> selected <%}%>>Jain</option>
                                        <option value="6" <%if (oDepositKYCCreationHdrBean.getReligion().equals("6")) {%> selected <%}%>>Buddhist</option>
                                        <option value="7" <%if (oDepositKYCCreationHdrBean.getReligion().equals("7")) {%> selected <%}%>>Parsi</option>
                                        <option value="8" <%if (oDepositKYCCreationHdrBean.getReligion().equals("8")) {%> selected <%}%>>Others</option>
                                    </select>
                                </td>
                                <td>Caste<font color="red" >*</font>:</td>
                                <td><select id="casteAmend" name="casteAmend">
                                        <option value="" selected disabled>--- Select ---</option>
                                        <option value="1" <%if (oDepositKYCCreationHdrBean.getCaste().equals("1")) {%> selected <%}%>>General</option>
                                        <option value="2" <%if (oDepositKYCCreationHdrBean.getCaste().equals("2")) {%> selected <%}%>>SC</option>
                                        <option value="3" <%if (oDepositKYCCreationHdrBean.getCaste().equals("3")) {%> selected <%}%>>ST</option>
                                        <option value="4" <%if (oDepositKYCCreationHdrBean.getCaste().equals("4")) {%> selected <%}%>>Others</option>
                                    </select>
                                </td></tr>
                            <tr>
                                <td>Mobile Number: </td>
                                <td><input type="text" style="text-align:right;" maxlength=10 name="mNumberAmend" id="mNumberAmend" onkeypress='return event.charCode >= 48 && event.charCode <= 57' value="<%=blankNull(oDepositKYCCreationHdrBean.getmNumber())%>" /></td>
                                <td>Email Id: </td>
                                <td><input  type="text" name="emailId" id="emailId" value="<%=blankNull(oDepositKYCCreationHdrBean.getEmailId())%>" /></td>
                            </tr>
                            <tr><td>Mother Bank CIF: </td><td><input type="text" readonly style="text-align:right;" maxlength="11" name="bankCIF" id="bankCIF" onkeypress='return event.charCode >= 48 && event.charCode <= 57' value="<%=blankNull(oDepositKYCCreationHdrBean.getBankCIF())%>" ></td></tr>
                            <tr><td>Alive/Dead: </td><td><select id="lstatus" name="lstatus"><option value="" selected disabled>--select--</option>
                                        <option value="A" <%if (oDepositKYCCreationHdrBean.getAliveDead().equals("A")) {%> selected <%}%>>Alive</option>
                                        <option value="D" <%if (oDepositKYCCreationHdrBean.getAliveDead().equals("D")) {%> selected <%}%>>Dead</option>
                                    </select></td></tr>
                            <tr id="showdate"><td>Date of Death: </td><td><input  type="text" style="text-align:center;" id="doDeath" name="doDeath" value="<%=blankNull(oDepositKYCCreationHdrBean.getDoDeath())%>" />&nbsp;<a href="#" onclick="return getCalendar(document.forms[0].doDeath);"><img src="${pageContext.request.contextPath}/img/calendar.jpg" name="imgr" border="0" width="25" height="20" /></a></td></tr>
                        </tbody>
                    </table>

                    <h3>Linked ID Details :</h3>
                    <center>
                        <table id="order-list" border="2" width="auto" cellspacing="1" cellpadding="1" style="text-align: center ;overflow-y: scroll; font-size: 15px">
                            <thead class="CSSTableGenerator" >
                                <tr>
                                    <td></td>
                                    <td colspan="2">ID Type</td>
                                    <td>Score </td>
                                    <td>ID Number </td>
                                    <td>ID Issued At</td>
                                    <td colspan="2">ID Issue Date</td>
                                    <td>Scanned Photo</td>
                                    <td>ID Scan Image</td>
                                </tr>
                            </thead>
                            <tbody>

                                <%
                                    oDepositKYCCreationDetailBean = new DepositKYCCreationDetailBean();
                                    count = 0;

                                    for (int i = 0; i < alDepositKYCCreationDetailBean.size(); i++) {
                                        oDepositKYCCreationDetailBean = alDepositKYCCreationDetailBean.get(i);

                                        count++;
                                        populatedRows++;

                                        try {
                                            if (oDepositKYCCreationDetailBean.getIDScore() != null
                                                    || !(oDepositKYCCreationDetailBean.getIDScore().equalsIgnoreCase(""))) {
                                                idScore = idScore + Integer.parseInt(oDepositKYCCreationDetailBean.getIDScore());
                                            }
                                        } catch (NumberFormatException e) {
                                            idScore = idScore + 0;
                                        }

                                %>

                                <tr class="tRow">
                                    <td><input type="checkbox" name="chckbox<%=count%>" id="chckbox<%=count%>" onclick="checkboxTrue(<%=count%>);" value="<%=blankNull(oDepositKYCCreationDetailBean.getKYCCreation_dtl_id())%>" /></td>

                                    <td><input  type="text" style="width: 100%;padding: 5px;margin: 0px;border: 1px solid #CCC;" readonly name="idTypeAmend<%=count%>" id="idTypeAmend<%=count%>" value="<%=blankNull(oDepositKYCCreationDetailBean.getIdType())%>"/></td>
                                    <td><input type="button" style="cursor:not-allowed;margin-right:-30px" name="SearchAsset<%=count%>" id="SearchAsset<%=count%>" value="Select ID"  onclick="" /></td>
                                    <td><input  type="text" style="width: 100%;padding: 5px;margin: 0px;border: 1px solid #CCC; text-align: center;" readonly size="5" class="IDScore" name="ScoreAmend<%=count%>" id="ScoreAmend<%=count%>" value="<%=blankNull(oDepositKYCCreationDetailBean.getIDScore())%>"/></td>
                                    <td><input  type="text" style="width: 100%;padding: 5px;margin: 0px;border: 1px solid #CCC;" maxlength="28" name="idNumberAmend<%=count%>" id="idNumberAmend<%=count%>" value="<%=blankNull(oDepositKYCCreationDetailBean.getIdNumber())%>"/></td>
                                    <td><input type="text" style="width: 100%;padding: 5px;margin: 0px;border: 1px solid #CCC;" maxlength="20"  name="idIssueAtAmend<%=count%>" id="idIssueAtAmend<%=count%>" value="<%=blankNull(oDepositKYCCreationDetailBean.getIdIssueAt())%>"/></td>
                                    <td><input type="text" style="width: 100%;padding: 5px;margin: 0px;border: 1px solid #CCC;" id="idIssueDateAmend<%=count%>" name="idIssueDateAmend<%=count%>" size="10" readonly="true" value="<%=blankNull(oDepositKYCCreationDetailBean.getIdIssueDate())%>"></td>
                                    <td><a href="#" onclick="return getCalendar(document.forms[0].idIssueDateAmend<%=count%>);"><img src="${pageContext.request.contextPath}/img/calendar.jpg" name="imgr" style="display:block;"  height="100%" width="20" /></a></td>
                                    <td><a ><%if (oDepositKYCCreationDetailBean.getScanImg() == null || oDepositKYCCreationDetailBean.getScanImg().isEmpty()) {%>No Image found<%} else {%><img class="idImg" id="idImg<%=count%>" src="${pageContext.request.contextPath}/UploadedFiles/<%=blankNull(oDepositKYCCreationDetailBean.getScanImg())%>" alt="" height="25" width="25" border="1px" onmouseover="javascript:idImgClick(<%=count%>)"/><%}%></a></td>
                                    <td><input type="file" class="upldId" name="file<%=count%>" id="file<%=count%>" />
                                        <div id="idUpload<%=count%>" style="display: none;">Uploading..</div>
                                        <div id="message<%=count%>"></div>
                                    </td>
                                    <td style="display:none;"><input type="hidden" name="upldFlag<%=count%>" id="upldFlag<%=count%>" value="0" /></td>
                                    <td style="display: none;"><input type="hidden"  name="document_mst_idAmend<%=count%>" id="document_mst_idAmend<%=count%>" value="<%=blankNull(oDepositKYCCreationDetailBean.getDocument_mst_id())%>"/></td>
                                    <td style="display: none;"><input type="hidden" name="rowStatus<%=count%>" id="rowStatus<%=count%>" value="A"/></td>
                                    <td style="display: none;"><input type="hidden" name="KYCCreation_dtl_id<%=count%>" id="KYCCreation_dtl_id<%=count%>" value="<%=blankNull(oDepositKYCCreationDetailBean.getKYCCreation_dtl_id())%>" /></td>                                    

                                </tr>

                                <%}%>
                            </tbody>
                        </table>
                    </center>
                    <center>
                        <table>
                            <tr><td></td></tr>
                            <tr><td></td></tr>
                            <tr><td></td></tr>
                            <tr><td></td></tr>
                            <tr>
                                <td><B>Total ID Score</B></td>
                                <td></td><td></td>
                                <td><input type="text" size="4" readonly style="text-align: center;font-weight: bold;"  name="grandTotal" id="grandTotal" value="<%=idScore%>"/></td>
                            </tr>

                        </table></center>

                </div>

                <div id="myModal" class="modal">    // Added by Bishnu
                    <span class="close">&times;</span>
                    <img class="modal-content" id="img01">
                </div>
                <script>
                    function idImgClick(i) {
                        // Get the modal
                        var modal = document.getElementById('myModal');
                        $('#idImgZoom').val(i);
                        // Get the image and insert it inside the modal - use its "alt" text as a caption
                        var img = document.getElementById('idImg' + $('#idImgZoom').val());
                        //var img = document.getElementById('blah');
                        var modalImg = document.getElementById("img01");
                        img.onmouseover = function () {
                            modal.style.display = "block";
                            modalImg.src = this.src;
                            //captionText.innerHTML = this.alt;
                        }

                        // Get the <span> element that closes the modal
                        var span = document.getElementsByClassName("close")[0];

                        // When the user clicks on <span> (x), close the modal
                        span.onclick = function () {
                            modal.style.display = "none";
                        }
                    }
                </script>

                <div id="image-holder">
                    <table>
                        <tr>
                            <td><img id="blah" name="blah" height="180" width="166" border="1px" <% if (blankNull(oDepositKYCCreationHdrBean.getFile()).isEmpty()) {%>
                                     src="${pageContext.request.contextPath}/img/faceDefault - Copy.jpg" <%} else {%>
                                     src="${pageContext.request.contextPath}/UploadedFiles/<%=oDepositKYCCreationHdrBean.getFile()%>" <%}%>/> </td>

                            <!--    For Signature -->
                            <td valign="bottom"><b id="nosig" name="nosig"
                                                   <% if (blankNull(oDepositKYCCreationHdrBean.getSigUpld()).isEmpty()) {%> style="display: block" <%} else {%> style="display: none" <%}%>>No Siganture Found</b>

                                <img id="blahsig" name="blahsig" src="${pageContext.request.contextPath}/UploadedFiles/<%=oDepositKYCCreationHdrBean.getSigUpld()%>" height="80" width="180" border="1px"
                                     <% if (blankNull(oDepositKYCCreationHdrBean.getSigUpld()).isEmpty()) {%> style="display: none" <%} else {%> style="display: block; vertical-align: bottom" <%}%> />
                            </td>
                        </tr>
                    </table>
                </div>


                <!--      <div id="sig-holder">
                                  For Signature
                                <b id="nosig" name="nosig"
                <% if (blankNull(oDepositKYCCreationHdrBean.getSigUpld()).isEmpty()) {%> style="display: block" <%} else {%> style="display: none" <%}%>>No Siganture Found</b>

                 <img id="blahsig" name="blahsig" src="${pageContext.request.contextPath}/UploadedFiles/<%=oDepositKYCCreationHdrBean.getSigUpld()%>" height="80" width="180" border="1px"
                <% if (blankNull(oDepositKYCCreationHdrBean.getSigUpld()).isEmpty()) {%> style="display: none" <%} else {%> style="display: block" <%}%> />
      </div> -->
                <br>
                <br>

                <center>
                    <table>
                        <tr>
                            <td><input type="button" id="addRow" value="Add Row"/></td>
                            <td><input type="button" id="deleteRow" value="Delete Row"/></td>
                            <td> <input type="button" value="Update Customer Details" onclick="javascript:UpdateForm(customerEnquiry)"></td>
                            <td><input type="button" value="Reset" onclick="ShowParent();" /></td>
                        </tr>
                    </table>
                </center>
                <label style=" font-family: Berlin Sans FB; font-weight:normal; ">* marked fields are mandatory</label>
                <% }%>
                <input type="hidden" name="deletedRows" id="deletedRows" value=""/>
                <input type="hidden" name="handle_id" value="" >
                <input type="hidden" name="idImgZoom" id="idImgZoom" value="" >
                <input type="hidden" name="rowCounterDeleteCreate" id="rowCounterDeleteCreate" value="<%=count%>">
                <input type="hidden" name="rowCounter" id="rowCounter" value="<%=count%>">
                <input type="hidden" name="chkboxCounter" id="chkboxCounter" value="0"/>
                <input type="hidden" name="all_rowsAdded" id="all_rowsAdded" value="<%=populatedRows%>">
                <input type="hidden" name="FirstPopulatedRows" id="FirstPopulatedRows" value="<%=populatedRows%>">
            </form>
            <script>
                var y = $("#FirstPopulatedRows").val();
                var x = parseInt(y);
                function checkboxTrue(i) {

                    if (document.getElementById("chckbox" + i).checked == true) {

                        var counter = $("#chkboxCounter").val();
                        counter++;
                        $("#chkboxCounter").val(counter);

                    } else {

                        var counter = $("#chkboxCounter").val();
                        counter--;
                        $("#chkboxCounter").val(counter);
                    }
                }
                $('table').on('keydown', '#cifNumber', function (event) {
                    if (event.shiftKey == true) {
                        event.preventDefault();
                    }

                    if ((event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode >= 96 && event.keyCode <= 105) || event.keyCode == 8 || event.keyCode == 37 || event.keyCode == 39 || event.keyCode == 46 || (event.ctrlKey && event.keyCode == 86)) {

                    } else {
                        event.preventDefault();
                    }
                });
                $("#addRow").click(function () {
                    x = x + 1;

                    $("#all_rowsAdded").val(x);
                    var counter = $("#rowCounter").val();
                    counter++;
                    $('#order-list tr:last').after('<tr class="tRow"><td><input type="checkbox" name="chckbox' + x + '" id="chckbox' + x + '" onclick="checkboxTrue(' + x + ');"/></td>  \n\
                <td><input  type="text" style="width: 100%;padding: 5px;margin: 0px;border: 1px solid #CCC;" readonly name="idTypeAmend' + x + '" id="idTypeAmend' + x + '"/></td>\n\
<td><input type="button" style="margin-right:-30px" name="SearchAsset' + x + '" id="SearchAsset' + x + '" value="Select ID"  onclick="SearchAsset(280,240,' + x + ')" /></td> \n\
<td><input  type="text" style="width: 100%;padding: 5px;margin: 0px;border: 1px solid #CCC; text-align: center;" readonly size="5" class="IDScore" name="ScoreAmend' + x + '" id="ScoreAmend' + x + '" value=""/></td>\n\
<td><input  type="text" style="width: 100%;padding: 5px;margin: 0px;border: 1px solid #CCC;" maxlength="28" name="idNumberAmend' + x + '" id="idNumberAmend' + x + '" value=""/></td>\n\\n\
<td><input type="text" style="width: 100%;padding: 5px;margin: 0px;border: 1px solid #CCC;" maxlength="20" name="idIssueAtAmend' + x + '" id="idIssueAtAmend' + x + '" value=""/></td>\n\
<td><input type="text" style="width: 100%;padding: 5px;margin: 0px;border: 1px solid #CCC;" size="10" id="idIssueDateAmend' + x + '" name="idIssueDateAmend' + x + '" readonly="true"></td>\n\                                            \n\
<td><a href="#" onclick="return getCalendar(document.forms[0].idIssueDateAmend' + x + ');"><img src="${pageContext.request.contextPath}/img/calendar.jpg" name="imgr" style="display:block;"  height="100%" width="20"  /></a></td>\n\
<td><a>No Image found</a></td><td><input type="file" class="upldId" name="file' + x + '" id="file' + x + '" /><div id="message' + x + '"></div><div id="idUpload' + x + '" style="display: none;">Uploading..</div></td>\n\\n\\n\
<td style="display:none"><input type="hidden" name="upldFlag' + x + '" id="upldFlag' + x + '" value="0" /></td>\n\
<td style="display:none;"><input type="hidden"  name="document_mst_idAmend' + x + '" id="document_mst_idAmend' + x + '"/></td> <td style="display:none;"><input type="hidden" name="rowStatus' + x + '" id="rowStatus' + x + '" value="N"/></td>\n\
<td style="display:none;"><input type="hidden" name="KYCCreation_dtl_id' + x + '" id="KYCCreation_dtl_id' + x + '" value="" /></td>\n\                </tr>');

                    $("#rowCounter").val(counter);
                    counter = $("#rowCounterDeleteCreate").val();
                    counter++;
                    $("#rowCounterDeleteCreate").val(counter);
                });


                $("#deleteRow").click(function () {

                    var len = ($("#order-list tr").length) - 1;
                    var counter = $("#rowCounterDeleteCreate").val();
                    var chkboxCounter = $("#chkboxCounter").val();

                    var counterDelete = counter - chkboxCounter;

                    if (counterDelete == 0) {

                        alert("All rows cannot be deleted");
                    } else {

                        if (len == chkboxCounter) {
                            alert("All rows can not be deleted");
                            return false;
                        }

                        var selchbox = [];        // array that will store the value of selected checkboxes
                        selchbox = getSelectedChbox(customerEnquiry);
                        $("#deletedRows").val(selchbox);

                        $('input:checkbox:checked').closest('tr').remove();
                        $("#rowCounterDeleteCreate").val(counterDelete);

                        chkboxCounter = 0;
                        $("#chkboxCounter").val(chkboxCounter);
                        var total = 0;
                        var test;
                        for (var i = 1; i <= x; i++) {

                            try {

                                var k = document.getElementById("ScoreAmend" + i);
                                if (k !== null && k.value === "") {

                                    test = 0;
                                } else
                                    test = parseInt(document.getElementById("ScoreAmend" + i).value);

                            } catch (err) {

                                test = 0;
                            }
                            total = parseInt(total) + test;

                            document.getElementById("grandTotal").value = total;
                        }
                        if (isNaN(document.getElementById("grandTotal").value)) {
                            document.getElementById("grandTotal").value = 0;
                        }
                    }
                });

                function getSelectedChbox(customerEnquiry) {
                    var selchbox = [];        // array that will store the value of selected checkboxes
                    // gets all the input tags in frm, and their number
                    var inpfields = customerEnquiry.getElementsByTagName('input');
                    var nr_inpfields = inpfields.length;

                    // traverse the inpfields elements, and adds the value of selected (checked) checkbox in selchbox
                    for (var i = 0; i < nr_inpfields; i++) {
                        if (inpfields[i].type == 'checkbox' && inpfields[i].checked == true) {
                            if (inpfields[i].value != null || inpfields[i].value != "") {
                                selchbox.push(inpfields[i].value);
                            }
                        }
                    }
                    return selchbox;
                }

                function SearchAsset(width, height, i)
                {
                    if (window.innerWidth) {
                        LeftPosition = (window.innerWidth - width) / 2;
                        TopPosition = ((window.innerHeight - height) / 2) - 20;
                    } else {
                        LeftPosition = (parseInt(window.screen.width) - width) / 2;
                        TopPosition = ((parseInt(window.screen.height) - height) / 2) - 20;
                    }
                    attr = 'resizable=yes,scrollbars=yes,width=' + width + ',height=' +
                            height + ',screenX=300,screenY=200,left=' + LeftPosition + ',top=' +
                            TopPosition + '';
                    var screenName = "DepositKYCInquiry.jsp";
                    var lovKey = "IDTypeScoreSearch"
                    popWin = open('${pageContext.request.contextPath}/CommonSearchInformationDepositLOV.jsp?screenName=' + screenName + '&lovKey=' + lovKey + '&textIndex=' + i, 'IDTypeScoreSearch', attr);
                    popWin.focus();

                }

                jQuery('#order-list').on('change', '.IDScore',
                        function () {
                            var counter = document.forms[0].all_rowsAdded.value;
                            var total = 0;
                            var test;
                            for (var i = 1; i <= counter; i++) {
                                try {
                                    var k = document.getElementById("ScoreAmend" + i);
                                    if (k !== null && k.value === "") {
                                        test = 0;
                                    } else
                                        test = parseInt(document.getElementById("ScoreAmend" + i).value);
                                } catch (err) {
                                    test = 0;
                                }
                                total = parseInt(total) + test;
                                document.getElementById("grandTotal").value = total;
                            }
                            if (isNaN(document.getElementById("grandTotal").value)) {
                                document.getElementById("grandTotal").value = 0;
                            }
                        });

                $("body").click(function () {
                    $(".IDScore").change();
                });

                function ShowParent(    )
                {
                    document.forms[0].action = "${pageContext.request.contextPath}/Deposit/DepositKYCInquiry.jsp";
                    document.forms[0].submit();
                }

                function checkIDScore() {
                    $(".IDScore").change();
                    alert("ID Score checked");
                }

            </script>
        </fieldset>
    </body>
</html>
<% 	} catch (Exception e) {
        
%>
