<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/FiniqAppMasterPage.Master" CodeBehind="FinIQ_Email_Setup.aspx.vb" Inherits="FinIQWebApp.FinIQ_Email_Setup" %>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server"></asp:ScriptManagerProxy>
    <%-- <asp:ScriptManager ID="ScriptManager1" runat="server" />--%>

    <%--<script src="https://code.jquery.com/jquery-3.2.1.js"></script>--%>
    <%--   <script src="../FinIQJS/jquery-1.10.2.js"></script>
    <script src="../FinIQJS/jquery-ui.min.js"></script>
    <link href="../FinIQJS/jquery-ui.min.css" rel="stylesheet" />--%>

    <style>
        .entitytemp {
            margin-left: 10px;
        }

        .searchtemp {
            margin-left: 30px;
        }

        .newtemp {
            margin-left: 10px;
        }

        .pwdtemp {
            width: 250px !important;
        }

        .txttemp {
            width: 650px !important;
        }

        .emaillattachwidthtemp {
        }

        .PopUpDiv {
            width: 180px;
            padding: 6px;
            background-color: #ffffff;
            border: 1px solid #d5d4d4;
            z-index: 1;
            position: fixed;
            left: 600px;
            top: 270px;
        }

        .hideControl {
            display: none;
        }

        .DisabledBtn {
            cursor: not-allowed;
        }

        .txtEmailSubjectCss {
            width: 442px !important;
        }

        .SelectedRowStyle {
            background-color: AliceBlue;
        }

        .tdHidden {
            display: none;
        }

        .txtSMTPDetail {
            width: 250px;
        }
    </style>
    <link href="EmailCss/Css_EmailSetup.css" rel="stylesheet" />
    <script src="EmailJS/Js_EmailSetup.js"></script>

    <script>
        //var strValue = "";
        //function checkalphanumeric(value) {
        //    strValue = value;
        //    return strValue.match(/[A-Za-z][A-Za-z0-9 ]*/);
        //    // return ((keyCode >= 65 && keyCode <= 90) || keyCode == 8 || keyCode == 32)
        // }
        // function checknumeric(value) {
        //     return value.match(/^[1-9]\d*$/);
        //     //return ((keyCode >= 65 && keyCode <= 90) || keyCode == 8 || keyCode == 32)
        // }
        // function checkalphabets(value) {
        //     return value.match(/^[A-z]+$/);
        //    // return ((keyCode >= 65 && keyCode <= 90) || keyCode == 8 || keyCode == 32)
        // }
        // function checkemail(value) {
        //     return value.match(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);
        //    // return ((keyCode >= 65 && keyCode <= 90) || keyCode == 8 || keyCode == 32)
        // }

        // Function to check letters and numbers  
        function alphanumeric(evt) {

            var letters = /^[A-Za-z\d\s]+$/;
            var charCode = (evt.which) ? evt.which : event.keyCode;
            var keyPressed = String.fromCharCode(charCode);

            if (letters.test(keyPressed)) {
                return true;
            }
            else {
                return false;
            }
        }


        function alphanumericwithdot(evt) {

            var letters = /[a-zA-Z0-9.]/
            var charCode = (evt.which) ? evt.which : event.keyCode;
            var keyPressed = String.fromCharCode(charCode);

            if (letters.test(keyPressed)) {
                return true;
            }
            else {
                return false;
            }
        }

        // Function to check letters and numbers  
        function numeric(evt) {

            var letters = /^[0-9.,\b]+$/;
            var charCode = (evt.which) ? evt.which : event.keyCode;
            var keyPressed = String.fromCharCode(charCode);

            if (letters.test(keyPressed)) {
                return true;
            }
            else {
                return false;
            }
        }
        function alphabets(evt) {
            ///^[a-zA-Z0-9._\b]+$/
            var letters = /^[a-zA-Z \b]*$/;
            var charCode = (evt.which) ? evt.which : event.keyCode;
            var keyPressed = String.fromCharCode(charCode);

            if (letters.test(keyPressed)) {
                return true;
            }
            else {
                return false;
            }
        }
        function checkemail() {
            var filter = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
            var emailText = document.getElementById('<%= txtSenderEmail.ClientID%>');

            if (!filter.test(emailText.value)) {
                document.getElementById('<%= lblError.ClientID%>').innerText = "Email format may be incorrect. Please enter a correct email."
                document.getElementById('<%= hdnIsCorrectEmail.ClientID%>').value = "False"
                return false;
            }
            else {

                document.getElementById('<%= lblError.ClientID%>').innerText = ""
                document.getElementById('<%= hdnIsCorrectEmail.ClientID%>').value = "True"
                return true;
            }



        }
        // function checkUniqueOrSpecialCharacters() {
        //     var letters = /^[ A-Za-z0-9_@./#&+-]*$/;
        //     var charCode = (evt.which) ? evt.which : event.keyCode;
        //     var keyPressed = String.fromCharCode(charCode);

        //     if (letters.test(keyPressed)) {
        //         return true;
        //     }
        //     else {
        //         return false;
        //     }



        //}


        function ExpandCollapse(e) {
            
            //alert('hi');
            $(e).parent().parent().parent().parent().parent().parent().parent().parent().parent().closest('table').find('.tdtoggle').toggle();


        }
    </script>




    <asp:UpdatePanel ID="UpdatePanelEmailSetup" runat="server" class="PanelPad">
        <ContentTemplate>

            <table id="tblError">
                <tr>
                    <td>
                        <asp:Label ID="lblError" CssClass="MsgPrompt lblError" runat="server" Text=""></asp:Label>
                    </td>
                </tr>
            </table>

            <table id="tblFilter">
                <tr>
                    <td>
                        <asp:Label runat="server" Text="Entity " ID="lblEntity" CssClass="lbl lblEntity entitytemp" />
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlEntity" runat="server" CssClass="ddl" AutoPostBack="true" Style="width: 300px;" OnSelectedIndexChanged="ddlEntity_SelectedIndexChanged" />
                    </td>
                    <td>
                        <asp:Label runat="server" Text="Event " ID="lblSearch" CssClass="lbl lblSearch searchtemp" />
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlSearch" runat="server" CssClass="ddl" AutoPostBack="true" Style="width: 300px;" />
                    </td>
                    

                    <td>
                        <asp:Button runat="server" Text="Add New" CssClass="btn newtemp" ID="btnAddNew" Width="75px"></asp:Button>
                    </td>
                    <td>
                        <asp:Button runat="server" Text="Save" CssClass="btn" ID="btnSave" OnClientClick="return ConfirmationBox();" Width="75px"></asp:Button>
                        <%--  OnClientClick="return confirm('Do you want to proceed?');"--%>
                    </td>
                    <td>
                        <asp:Button runat="server" Text="Cancel" CssClass="btn" ID="btnCancel" Width="75px"></asp:Button>
                    </td>

                    <td>
                        <asp:Button runat="server" Text="Delete" CssClass="btn" ID="btnDelete" OnClientClick="return confirm('Are you sure that you want to delete these record(s)?');" Width="75px"></asp:Button>
                    </td>
                    <td>
                        <asp:Button runat="server" Text="Expand/Collapse" CssClass="btn" ID="btnExpand" Width="120px" OnClientClick="ExpandCollapse(this);return false;"></asp:Button>
                    </td>
                    <td>
                      <asp:Button runat="server" Text="Excel Export" CssClass="btn" ID="btnExcel"  Width="120px"></asp:Button>
                    </td>
                    <td>
                        <asp:Button runat="server" Text="Update" CssClass="btn hideControl" ID="btnEditAll" Width="100px"></asp:Button>
                    </td>
                </tr>
            </table>



            <table id="tblEntry">
                <tr>
                    <td>
                        <table id="SMTPTD">
                            <tr>
                                <td class="SMTPTD" style="padding-top: 5px;">
                                    <asp:UpdatePanel ID="UpdatePanel2" runat="server" class="PanelPad">
                                        <ContentTemplate>
                                            <fieldset class="SMTPFieldSet ">
                                                <legend>
                                                    <table class="tblSMTPLegend">
                                                        <tr>
                                                            <td>
                                                                <asp:Label runat="server" Text="SMTP Info." ID="Label4" CssClass="lbl lblSMTPLegend"></asp:Label>
                                                            </td>
                                                            <td></td>
                                                            <td class="SMTPLegendChckBoxTD">&nbsp;&nbsp;&nbsp;&nbsp;<asp:CheckBox runat="server" ID="chkCopyServerInfo" AutoPostBack="true" OnCheckedChanged="chkCopyServerInfo_CheckedChanged"></asp:CheckBox>
                                                            </td>
                                                            <td>
                                                                <asp:Label runat="server" Text="Default Values" ID="Label3" CssClass="lbl"></asp:Label>
                                                                <%--Server info.--%>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </legend>
                                                <table class="tblSMTP" style="height: 229px;">
                                                    <tr>
                                                        <td>
                                                            <asp:Label runat="server" Text="SMTP Server Name" ID="Label5" CssClass="lbl"></asp:Label>
                                                        </td>
                                                        <td class="tblSMTP2TD">
                                                            <asp:TextBox runat="server" CssClass="txtSMTPDetail" ID="txtServerName" onkeypress="return alphanumericwithdot(event)"></asp:TextBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label runat="server" Text="SMTP Port No." ID="Label6" CssClass="lbl"></asp:Label>
                                                        </td>
                                                        <td class="tblSMTP2TD">
                                                            <asp:TextBox runat="server" CssClass="txtSMTPDetail" ID="txtPortNo" onkeydown="return numeric(event.keyCode);"></asp:TextBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label runat="server" Text="Authentication" ID="Label7" CssClass="lbl"></asp:Label>
                                                        </td>
                                                        <td class="tblSMTP2TD">
                                                            <table class="tblrdoAuthentication">
                                                                <tr>
                                                                    <td>
                                                                        <input id="rdoAuthenticationYES" type="radio" name="rdoAuthentication" runat="server" class="rdoAuthentication" />

                                                                    </td>
                                                                    <td>
                                                                        <asp:Label ID="Label2" runat="server" Text="Yes" for="rdoAuthenticationY"></asp:Label>
                                                                    </td>
                                                                    <%--   </tr>
                                                            </table>
                                                            <table class="tblrdoAuthentication rdoN">
                                                                <tr>--%>
                                                                    <td>
                                                                        <input id="rdoAuthenticationNO" type="radio" name="rdoAuthentication" runat="server" class="rdoAuthentication" />
                                                                    </td>
                                                                    <td>
                                                                        <asp:Label ID="Label8" runat="server" Text="No" for="rdoAuthenticationN"></asp:Label>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label runat="server" Text="Sender Name" ID="Label9" CssClass="lbl"></asp:Label>
                                                        </td>
                                                        <td class="tblSMTP2TD">
                                                            <asp:TextBox runat="server" CssClass="txtSMTPDetail" ID="txtSenderName" onkeydown="return alphabets(event.keyCode);"></asp:TextBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label runat="server" Text="Sender Email" ID="Label10" CssClass="lbl"></asp:Label>
                                                        </td>
                                                        <td class="tblSMTP2TD">
                                                            <%--commented and added by Pratibha || Asked by Sandip sir--%>
                                                            <%-- <asp:TextBox runat="server" Text="" CssClass="txtSMTPDetail" ID="txtSenderEmail" onblur="return checkemail()"></asp:TextBox>--%>
                                                            <asp:TextBox runat="server" Text="" CssClass="txtSMTPDetail" ID="txtSenderEmail"></asp:TextBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label runat="server" Text="Password" ID="Label11" CssClass="lbl"></asp:Label>
                                                        </td>
                                                        <td class="tblSMTP2TD">
                                                            <asp:TextBox runat="server" CssClass="txtSMTPDetail txtPwd pwdtemp" ID="txtPassword" TextMode="password" OnKeyUp="setPasswordtoHiddenField(); "></asp:TextBox>
                                                            <%--OnKeyUp="setPasswordtoHiddenField()"--%>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label runat="server" Text="SSL" ID="Label12" CssClass="lbl"></asp:Label>
                                                        </td>
                                                        <td class="tblSMTP2TD">
                                                            <table class="tblrdoSSL">
                                                                <tr>
                                                                    <td>
                                                                        <input id="rdoSSLYES" type="radio" name="rdoSSL" runat="server" class="RadioBtn" />
                                                                    </td>
                                                                    <td>
                                                                        <asp:Label ID="Label13" runat="server" Text="Yes" for="rdoSSLY"></asp:Label>
                                                                    </td>
                                                                    <%--  </tr>
                                                            </table>
                                                            <table class="tblrdoSSL rdoN">
                                                                <tr>--%>
                                                                    <td>
                                                                        <input id="rdoSSLNO" type="radio" name="rdoSSL" runat="server" class="RadioBtn" />
                                                                    </td>
                                                                    <td>
                                                                        <asp:Label ID="Label14" runat="server" Text="No" for="rdoSSLN"></asp:Label>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                </table>

                                            </fieldset>
                                        </ContentTemplate>
                                    </asp:UpdatePanel>
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td>
                        <table id="ReceiverInfo">
                            <tr>
                                <%-- style chnages by Suvarna 24-Nov-2021 || INT1FIN47-253 || asked by Sandip B sir--%>
                                <td class="SMTPTD" style="padding-top: 5px;">
                                    <asp:UpdatePanel ID="UpdatePanel1" runat="server" class="PanelPad">
                                        <ContentTemplate>
                                            <fieldset class="ReceiverInfoFieldSet">
                                                <legend>
                                                    <table class="tblReceiverInfoLegendTD">
                                                        <tr>
                                                            <td>
                                                                <asp:Label runat="server" Text="Receiver Info" ID="Label1" CssClass="lbl"></asp:Label>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </legend>

                                                <%-- style chnages by Suvarna 24-Nov-2021 || INT1FIN47-253 || asked by Sandip B sir--%>

                                               <%-- <asp:Panel ID="pnlReceivedGrid" runat="server" Width="100%" Style="height: 226px;"> --%>
                                                    <%-- <table style="padding-top: 3px;" > --%>
                                                        <table class="tblSMTP" style="height: 230px;">
                                                        <tr>
                                                            <td>
                                                                <asp:Label runat="server" Text="Event" ID="lblEmailAlertInfo" CssClass="lbl"></asp:Label>
                                                            </td>
                                                            <td>
                                                                <asp:DropDownList runat="server" ID="ddlEvent" CssClass="ddl" Width="350px" AutoPostBack="true"></asp:DropDownList>
                                                            </td>
                                                            <td>
                                                                <asp:Label runat="server" Text="Event Type " ID="lblEventType" CssClass="lbl lblSearch searchtemp" />
                                                           </td>
                                                            <%--Added by Prasad P on 21 June 2021 || START--%>
                                                           <td>
                                                                <asp:DropDownList ID="ddlEventType" runat="server" CssClass="ddl" AutoPostBack="true" Style="width: 200px;">
                                                                <asp:ListItem Text="Internal" Value="Internal" />
                                                                <asp:ListItem Text="External" Value="External" />                        
                                                                </asp:DropDownList>
                                                           </td>
                                                           <%-- Added by Prasad P on 21 June 2021 || END--%>
                                                        </tr>
                                                         <%--Added by Pratibha on 02-JUNE-2020 || Add product filter || Asked by Sandip sir <Start>--%>
                                                        <tr>
                                                            <td>
                                                                <asp:Label runat="server" Text="Product" ID="lblProduct" CssClass="lbl"></asp:Label>
                                                            </td>
                                                            <td>
                                                                <asp:DropDownList runat="server" ID="ddlProduct" CssClass="ddl" Width="350px" AutoPostBack="true"></asp:DropDownList>
                                                            </td>
                                                        </tr>
                                                        <%--Added by Pratibha on 02-JUNE-2020 || Add product filter || Asked by Sandip sir <End>--%>
                                                   
                                                        <tr>
                                                            <td>
                                                                <asp:Label runat="server" Text="Template" ID="lblTemplate" CssClass="lbl"></asp:Label>
                                                                <%--style="margin-left: 59px !important;"--%>
                                                            </td>
                                                            <td>
                                                                <asp:DropDownList runat="server" ID="ddlTemplate" CssClass="ddl" Width="350px" AutoPostBack="true"></asp:DropDownList>
                                                            </td>
                                                        </tr>
                                                            <tr>
                                                           <td>
                                                               <asp:CheckBox runat="server" ID="chkTo" CssClass="chk" AutoPostBack="true" Style="margin-left: 0px;" />
                                                              
                                                                <asp:Label ID="Label15" Text="To" runat="server"> </asp:Label>
                                                                  <%--TextAlign="left" style="display:inline-block"--%>
                                                            </td>
                                                             <td colspan="3">

                                                                <asp:TextBox runat="server" ID="txtTo" CssClass="txt txttemp" ReadOnly="true"></asp:TextBox>
                                                            </td>
                                                            
                                                           
                                                        </tr>
                                                        <tr>
                                                           
                                                            <td>
                                                                <asp:CheckBox runat="server" ID="chkCc" CssClass="chk" AutoPostBack="true" Style="margin-left: 0px;" />
                                                    
                                                                <asp:Label ID="LabeCcl16" Text="Cc" runat="server"> </asp:Label>
                                                            </td>
                                                             <td colspan="3">

                                                                <asp:TextBox runat="server" ID="txtCc" CssClass="txt txttemp" ReadOnly="true"></asp:TextBox>
                                                            </td>
                                                            
                                                        </tr>
                                                        <tr>
                                                            
                                                            <td>
                                                                  <asp:CheckBox runat="server" ID="chkBcc" CssClass="chk" AutoPostBack="true" Style="margin-left: 0px;" />
                                                           
                                                                <asp:Label ID="Label16" Text="Bcc" runat="server"> </asp:Label>
                                                            </td>
                                                             <td colspan="3">

                                                                <asp:TextBox runat="server" ID="txtBcc" CssClass="txt txttemp" ReadOnly="true"></asp:TextBox>
                                                            </td>
                                                           
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                               <%-- style chnages by Suvarna 24-Nov-2021 || INT1FIN47-253 || asked by Sandip B sir--%>
                                                                <asp:CheckBox runat="server" ID="chkEmailAttachment" CssClass="chk" AutoPostBack="true" Style="margin-left: 0px;" />
                                                                <%--Style="margin: 0px 6px;"--%>
                                                                <asp:Label runat="server" Text="Attachment" ID="lblEmailAttachment" CssClass="lbl" ></asp:Label>
                                                           </td>
                                                                <td colspan="3">
                                                               <asp:TextBox runat="server" ID="txtAttachment" CssClass="txt txttemp" ReadOnly="true"></asp:TextBox>

                                                            </td>
                                                        </tr>

                                                        <tr id="EmailSubject">
                                                            <td>
                                                                <asp:Label runat="server" Text="Email Subject" ID="lblEmailSubject" CssClass="lbl" Visible="false"></asp:Label>
                                                            </td>
                                                            <td colspan="3">
                                                                <asp:TextBox runat="server" ID="txtEmailSubject" CssClass="txt txtEmailSubjectCss" Visible="false"></asp:TextBox>
                                                            </td>
                                                        </tr>
                                                        <tr id="EmailTemplate">

                                                            <td>
                                                                <asp:Label runat="server" Text="Email Body Template Path" ID="lblEmailBodyTemplatePath" CssClass="lbl" Visible="true"></asp:Label>
                                                            </td>
                                                            <td colspan="3">
                                                                <%--<asp:TextBox runat="server" ID="txtEmailBodyTemplatePath" CssClass="txt" Width="470px"></asp:TextBox>--%>
                                                                <asp:FileUpload runat="server" ID="fileUploadEmailBodyTemplatePath" CssClass="txt" Width="454px" ClientIDMode="Static" Visible="true" />
                                                                <%-- <input id="fileUploadEmailBodyTemplatePath" style="width: 256px; height: 22px" type="file" size="23"  name="fileUploadEmailBodyTemplatePath" runat="server" />--%>

                                                                <%-- <asp:TextBox runat="server" ID="txtTemplatePath" CssClass="txt" Width="354px" ></asp:TextBox>
                                                                 <asp:Button runat="server" ID="btnUpload" Text="Select" OnClientClick="Upload_Click()" OnClick="btnUpload_Click" CssClass="btn"></asp:Button>--%>

                                                            </td>

                                                        </tr>
                                                    </table>
                                                <%--</asp:Panel>--%>
                                            </fieldset>

                                            <%-- <iframe id="Iframe_UploadDetails" runat="server" style="position: absolute; width: 400px; heitght: 200px; border: 0px" visible="false"></iframe>
                                            --%>
                                            <asp:Panel ID="PopUPDiv" runat="server" CssClass="ConfirmationPopup" Style="top: 300px; left: 700px; position: absolute; z-index: 10; width: auto; height: 500px; background-color: #FFFFFF; border: solid 1px #DDDDDD; border-bottom: solid 2px #DDDDDD; border-right: solid 2px #DDDDDD; overflow-y:scroll" Visible="false" Placement="Center">

                                                <table>
                                                    <tr>
                                                        <td>
                                                            <asp:Label runat="server" Text="" CssClass="lbl PopUpUpperLeft  hideControl" ID="lblPopUP"></asp:Label></td>
                                                        <td style="white-space: nowrap; text-align: right; width: 120px;">
                                                            <asp:Button runat="server" CssClass="btn btnApply" Text="Apply" ID="btnApply"></asp:Button>
                                                            &nbsp;
                                                <asp:Button runat="server" CssClass="btn btnClose" Text="X" ID="btnClose"></asp:Button></td>

                                                    </tr>


                                                    <tr>
                                                        <td class="LowerTDPopUp" colspan="2">
                                                            <asp:GridView runat="server" ID="dgPopUp" AutoGenerateColumns="false" AllowPaging="true" PageSize="28">
                                                                <HeaderStyle CssClass="GridHeader" Font-Size="X-Small" Font-Bold="False"
                                                                    ForeColor="White" HorizontalAlign="Center" Wrap="false" />
                                                                <RowStyle CssClass="GridItem" Wrap="false" />
                                                                <Columns>
                                                                    <asp:TemplateField HeaderText="">
                                                                        <HeaderStyle HorizontalAlign="Center" Width="60px" VerticalAlign="Middle"></HeaderStyle>
                                                                        <ItemStyle HorizontalAlign="Center" Width="40px" VerticalAlign="Middle" />
                                                                        <ItemTemplate>
                                                                            <asp:CheckBox ID="chk" runat="server" Checked="false" />
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>
                                                                    <asp:TemplateField HeaderText="Email Group">
                                                                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle"></HeaderStyle>
                                                                        <ItemTemplate>
                                                                            <asp:Label ID="lblEmailGroup" runat="server" Text='<%# Eval("Email_Group")%>'></asp:Label>
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>

                                                                </Columns>
                                                            </asp:GridView>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </asp:Panel>
                                       <%--Email Attachment event changes start || by Suvarna P 24Sep2021 INT1FIN47 - 90 || asked by Sandip B and Allan--%>
                                             <asp:Panel ID="PopUPDivAttachment" runat="server" CssClass="ConfirmationPopup" Style="top: 300px; left: 700px; position: absolute; z-index: 10; width: auto; height: 500px; background-color: #FFFFFF; border: solid 1px #DDDDDD; border-bottom: solid 2px #DDDDDD; border-right: solid 2px #DDDDDD; overflow-y:scroll" Visible="false" Placement="Center">

                                                <table style>
                                                    <tr>
                                                        <td>
                                                            <asp:Label runat="server" Text="" CssClass="lbl PopUpUpperLeft  hideControl" ID="lblPopUPAttachment"></asp:Label>
                                                            <asp:TextBox runat="server" ID="txtSearchEvent" CssClass="txt" Style="width: 250px;" ></asp:TextBox>
                                                            <asp:Button runat="server" Text="Search" CssClass="btn btnApply" ID="btnEventSearch"></asp:Button>
                                                            <asp:Button runat="server" CssClass="btn btnApply" Text="Apply" ID="btnApplyAttachment"></asp:Button>

                                                        </td>
                                                        <td style="white-space: nowrap; text-align: right; width: 120px;">
                                                           <asp:Button runat="server" CssClass="btn btnClose" Text="X" ID="btnCloseAttachment"></asp:Button>

                                                        </td>

                                                    </tr>


                                                    <tr>
                                                        <td class="LowerTDPopUp" colspan="2">
                                                            <asp:GridView runat="server" ID="dgPopUpAttachment" AutoGenerateColumns="false" AllowPaging="true" PageSize="28" AllowSorting="true" Width = "100%">
                      
                                                                <%--<asp:GridView ID="MainGrid" runat="server" CellPadding="3" EmptyDataText="No data found."
                                                                    AutoGenerateColumns="False" CssClass="Grid" AllowPaging="True" ShowHeaderWhenEmpty="true" 
                                                                    AllowSorting="true" TabIndex="6" BorderColor="White" GridLines="Both">--%>
                                                                
                                                                <HeaderStyle CssClass="GridHeader" Font-Size="X-Small" Font-Bold="False"
                                                                    ForeColor="White" HorizontalAlign="Center" Wrap="false" Width="100%" />
                                                                <RowStyle CssClass="GridItem" Wrap="false" />
                                                                <Columns>
                                                                    <asp:TemplateField HeaderText="">
                                                                        <HeaderStyle HorizontalAlign="Center" Width="20%" VerticalAlign="Middle"></HeaderStyle>
                                                                        <ItemStyle HorizontalAlign="Center" Width="20%" VerticalAlign="Middle" />
                                                                        <ItemTemplate>
                                                                            <%--INT1FIN47-155 || by suvarna 13Oct2021 || reported by Sandip B sir --%>
                                                                            <asp:CheckBox ID="chkAttachment" runat="server" Checked="false"  AutoPostBack="true" OnCheckedChanged="onChkAttachmentEventCode" />
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>
                                                                    <asp:TemplateField HeaderText="Attachment Event">
                                                                        <HeaderStyle HorizontalAlign="Center"  Width="80%" VerticalAlign="Middle"></HeaderStyle>
                                                                        <ItemTemplate>
                                                                            <%--<asp:Label ID="lblEmailGroup" runat="server" Text='<%# Eval("Email_Group")%>'></asp:Label>--%>
                                                                            <asp:Label ID="Event_NameAttachment"  Width="80%" runat="server" Text='<%# Eval("Event_Name")%>'></asp:Label>
                                                                            
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>

                                                                </Columns>
                                                            </asp:GridView>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </asp:Panel>
                                             <%--Email Attachment event changes end || by Suvarna P 24Sep2021 INT1FIN47 - 90 || asked by Sandip B and Allan--%>
                                            </ContentTemplate>

                                    </asp:UpdatePanel>



                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>



            <table id="tblGridView">
                <tr>
                    <td>
                        <asp:GridView runat="server" ID="dgvEmailSettings" AutoGenerateColumns="false" AllowPaging="true" PageSize="15" SelectedRowStyle-BackColor="AliceBlue"
                            EmptyDataText="No Records Found" AllowSorting="true" ShowHeaderWhenEmpty="true" CssClass="Grid">
                            <SelectedRowStyle CssClass="SelectedRowStyle" />
                            <%--"#cccccc"--%>
                            <HeaderStyle CssClass="GridHeader" Font-Size="X-Small" Font-Bold="False"
                                HorizontalAlign="Center" Wrap="false" />
                            <RowStyle CssClass="GridItem" Wrap="false" />
                            <PagerSettings Mode="NumericFirstLast"
                                FirstPageText="First"
                                LastPageText="Last"
                                Position="Bottom" />
                            <FooterStyle CssClass="GridFooter" />
                            <PagerStyle CssClass="GridPager" />
                            <EmptyDataTemplate>
                                <asp:Label ID="lblqueuedatagrid" runat="server" Text="No data found."></asp:Label>
                            </EmptyDataTemplate>
                            <%--Grid--%>
                            <Columns>
                                <%-- <asp:TemplateField HeaderText="">
                                    <ItemStyle Width="40" />
                                    <ItemTemplate>
                                        <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Select" Text='Select'></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>--%>
                                <asp:TemplateField>
                                    <HeaderTemplate>
                                        <asp:CheckBox runat="server" ID="chkHeader" OnCheckedChanged="chkHeader_CheckedChanged" AutoPostBack="true" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:CheckBox runat="server" ID="chkChild" OnCheckedChanged="chkChild_CheckedChanged" AutoPostBack="true" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="ID" Visible="false" ControlStyle-Width="50px">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px"></HeaderStyle>
                                    <ItemStyle Width="50px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblID" runat="server" Text='<%# Eval("ID")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Setting Name">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" CssClass="hideControl" Width="100px"></HeaderStyle>
                                    <ItemStyle Width="100px" CssClass="hideControl" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblSettingName" runat="server" Text='<%# Eval("SettingName")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Email Alert Name" SortExpression="Event_Name">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" CssClass="EmailAlertColWidth" Width="100px"></HeaderStyle>
                                    <ItemStyle Width="100px" />
                                    <ItemTemplate>
                                        <%--<asp:Label ID="lblEmailAlertName" runat="server" Text='<%# Eval("EmailAlertName")%>'></asp:Label>--%>
                                        <asp:LinkButton ID="lnkEmailAlertName" runat="server" Text='<%# Eval("Event_Name")%>' OnClick="lnkEmailAlertName_Click" CommandName="HighlightMe"></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                  <%--Added by Pratibha on 02-JUNE-2020 || Add product filter || Asked by Sandip sir <Start>--%>
                                <asp:TemplateField HeaderText="Product" SortExpression="Product_Name">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" CssClass="TemplateColWidth "></HeaderStyle>
                                    <ItemStyle Width="200" CssClass="" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblProduct_Name" runat="server" Text='<%# Eval("Product_Name")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <%--Added by Pratibha on 02-JUNE-2020 || Add product filter || Asked by Sandip sir <End>--%>
                        
                                <asp:TemplateField HeaderText="Template" SortExpression="Template_Name">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" CssClass="TemplateColWidth " Width="150px"></HeaderStyle>
                                    <ItemStyle Width="150px" CssClass="" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblTemplate_Name" runat="server" Text='<%# Eval("Template_Name")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <%--Added by Pratibha on 02-JUNE-2020 || Add product filter || Asked by Sandip sir <End>--%>
                               <%-- <asp:TemplateField HeaderText="User Name" Visible="false">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px"></HeaderStyle>
                                    <ItemStyle Width="50px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblUserName" runat="server" Text='<%# Eval("UserName")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Password" Visible="false">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px"></HeaderStyle>
                                    <ItemStyle Width="50px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblUserPAssword" runat="server" Text='<%# Eval("UserPAssword")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
								--%>
                                  <asp:TemplateField HeaderText="Email Group TO">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" CssClass="EmailToColWidth" Width="150px"></HeaderStyle>
                                    <ItemStyle Width="150px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblEmailGroupTO" runat="server" Text='<%# Eval("EmailGroupTO")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Email Group CC">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" CssClass="EmailToColWidth" Width="150px"></HeaderStyle>
                                    <ItemStyle Width="150px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblEmailGroupCC" runat="server" Text='<%# Eval("EmailGroupCC")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Email Group BCC">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" CssClass="EmailToColWidth" Width="150px"></HeaderStyle>
                                    <ItemStyle Width="150px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblEmailGroupBCC" runat="server" Text='<%# Eval("EmailGroupBCC")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                 <asp:TemplateField HeaderText="Sender Email">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px"></HeaderStyle>
                                    <ItemStyle Width="100px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblSenderEmail" runat="server" Text='<%# Eval("SenderEmail")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                 <asp:TemplateField HeaderText="Attachment">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px"></HeaderStyle>
                                    <ItemStyle Width="50px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblAttachment" runat="server" Text='<%# Eval("IsAttach")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                 <%--Email Attachment event changes || by Suvarna P 24Sep2021 INT1FIN47 - 90 || asked by Sandip B and Allan--%>
                                 <asp:TemplateField HeaderText="Attachment Event" HeaderStyle-HorizontalAlign="Center" Visible="true" HeaderStyle-Height="30px">
                                    <HeaderStyle HorizontalAlign="Center" Wrap="True" />
                                    <ItemStyle Wrap="True" HorizontalAlign="Left" VerticalAlign="Middle"></ItemStyle>
                                    <ItemTemplate>
                                        <%--<asp:Label ID="lblAttactEvtCode" runat="server" CssClass="extraLargeWidth" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.BEN_Attach_Event_Code").ToString)%>' />--%>
                                       <asp:Label ID="lblAttachEvtCode" runat="server" CssClass="extraLargeWidth" Text='<%# Eval("EmailAttachmentEvent")%>' />

                                    </ItemTemplate>
                                    <%--<EditItemTemplate>
                                    <asp:ListBox ID="ddlAttachEvtCode"  runat="server" Style="height: 150px;" CssClass="listbox" AutoPostBack="false"
                                            onChange="UpdateList(this)" SelectionMode="Multiple" >
                                     </asp:ListBox>
                                        
                                    </EditItemTemplate>--%>
                                </asp:TemplateField>
                                 <asp:TemplateField HeaderText="SMTP Sever Name">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" >
                                        <%--CssClass="tdtoggle tdHidden"--%>
                                    </HeaderStyle>
                                    <ItemStyle Width="50px"  />
                                    <%-- CssClass="tdtoggle tdHidden"--%>
                                    <ItemTemplate>
                                        <asp:Label ID="lblSMTPSeverName" runat="server" Text='<%# Eval("SMTPSeverName")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="SMTP Port No." ControlStyle-Width="40px">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="40px" >
                                        <%--CssClass="tdtoggle tdHidden SMTPPortColWidth"--%>
                                    </HeaderStyle>
                                    <ItemStyle Width="50px" HorizontalAlign="Right"  />
                                    <%--CssClass="tdtoggle tdHidden"--%>
                                    <ItemTemplate>
                                        <asp:Label ID="lblSMTPPortNo" runat="server" Text='<%# Eval("SMTPPortNo")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                               <%-- <asp:TemplateField HeaderText="Entity Name">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" CssClass="tdtoggle tdHidden"></HeaderStyle>
                                    <ItemStyle Width="50px" CssClass="tdtoggle tdHidden" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblEntity_Name" runat="server" Text='<%# Eval("entity_name")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField> --%>
                                 <asp:TemplateField HeaderText="Sender Name">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" >
                                        <%--CssClass="tdtoggle tdHidden"--%>
                                    </HeaderStyle>
                                    <ItemStyle Width="50px"  />
                                     <%--CssClass="tdtoggle tdHidden"--%>
                                    <ItemTemplate>
                                        <asp:Label ID="lblSenderName" runat="server" Text='<%# Eval("SenderName")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                 <asp:TemplateField HeaderText="Authentication">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px"></HeaderStyle>
                                    <ItemStyle Width="50px" HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblUserAuthentication" runat="server" Text='<%# Eval("UserAuthentication")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="SSL">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px"></HeaderStyle>
                                    <ItemStyle Width="50px" HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblIsSSL" runat="server" Text='<%# Eval("IsSSL")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                     <asp:TemplateField HeaderText="User Name" Visible="false">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px"></HeaderStyle>
                                    <ItemStyle Width="50px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblUserName" runat="server" Text='<%# Eval("UserName")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Password" Visible="false">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px"></HeaderStyle>
                                    <ItemStyle Width="50px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblUserPAssword" runat="server" Text='<%# Eval("UserPAssword")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>      
                                <asp:TemplateField HeaderText="Template Full Path">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="250px"></HeaderStyle>
                                    <ItemStyle Width="250px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblTemplateFullPath" runat="server" Text='<%# Eval("TemplateFullPath")%>' Width="250px"></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Template_id">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" CssClass="hideControl" Width="50px"></HeaderStyle>
                                    <ItemStyle Width="50px" CssClass="hideControl" />
                                    <ItemTemplate>
                                        <asp:Label ID="lbltemplate_id" runat="server" Text='<%# Eval("template_id")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>


                                <asp:TemplateField HeaderText="Entity Name">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px"></HeaderStyle>
                                    <ItemStyle Width="50px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblEntity_Name" runat="server" Text='<%# Eval("entity_name")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>

                               

                                <asp:TemplateField HeaderText="Email Subject" Visible="false">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" CssClass=""></HeaderStyle>
                                    <ItemStyle CssClass="" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblemail_subject" runat="server" Text='<%# Eval("email_subject")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                               
                               
                                <asp:TemplateField HeaderText="Created By">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" CssClass="tdtoggle tdHidden"></HeaderStyle>
                                    <ItemStyle Width="100px" CssClass="tdtoggle tdHidden" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblCreatedBy" runat="server" Text='<%# Eval("CreatedBy")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Created At">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" CssClass="tdtoggle tdHidden"></HeaderStyle>
                                    <ItemStyle Width="100px" CssClass="tdtoggle tdHidden" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblCreatedAt" runat="server" Text='<%# Eval("CreatedAt","{0:dd-MMM-yyyy hh:mm:ss tt}")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>

                    </td>
                </tr>
            </table>

            <table></table>

            <%--hidden fields--%>
            <asp:HiddenField ID="lblHideID" runat="server" />
            <asp:HiddenField ID="lnkEmailAlertName" runat="server" />
            <asp:HiddenField runat="server" ID="hdnTemplateSelector"></asp:HiddenField>
            <%--<asp:FileUpload runat="server" ID="TemplateSelector" AutoPostBack="true" onChange="return getFileName(this.id);" Style="display: none;"></asp:FileUpload>--%>
            <asp:HiddenField runat="server" ID="hdnPassword"></asp:HiddenField>
            <asp:HiddenField runat="server" ID="hdnConfigShowEmailSubject"></asp:HiddenField>
            <asp:HiddenField runat="server" ID="hdnConfigShowEmailTemplateSelector"></asp:HiddenField>
            <asp:HiddenField runat="server" ID="hdnRowIDforColor" />
            <asp:HiddenField runat="server" ID="hdnFileUploadValue" />
            <asp:HiddenField runat="server" ID="hdnIsCorrectEmail" />

        </ContentTemplate>

        <Triggers>
            <asp:PostBackTrigger ControlID="btnSave" />
            <asp:PostBackTrigger ControlID="btnExcel" />
        </Triggers>

    </asp:UpdatePanel>

    <script>

        function Upload_Click() {

        }

        function getFileName(id) {
            document.getElementById('<%=hdnTemplateSelector.ClientID%>').value = document.getElementById(id).value;
        }

        function setPasswordtoHiddenField() {
            document.getElementById('<%=hdnPassword.ClientID%>').value = document.getElementById('<%=txtPassword.ClientID%>').value

        }

    </script>
    <script>
        //window.onload = FireFunctionOnLoad()
        function FireFunctionOnLoad() {
            HideEmailSubject();
            //HideEmailTemplateSelector(); //Commented by Pratibha || FIConnect changes || Asked by SandipB
        }

        function HideEmailSubject() {
            //blnShowvar
            //
            try {
                var error;
                var showEmailSubject = document.getElementById('<%=hdnConfigShowEmailSubject.ClientID%>').value

                if (showEmailSubject.toUpperCase() == "NO") {
                    var trs = document.getElementById("EmailSubject");
                    var tds = trs.getElementsByTagName("td");
                    for (var i = 0; i < tds.length; i++) {
                        tds[i].style.display = "none";
                    }
                }
                else {
                    //do nothing. show Email Subject  
                }

            }
            catch (err) {
                error = err.message
            }

        }

        function HideEmailTemplateSelector() {
            //blnShowvar
            //
            try {
                var error;
                var showEmailTemplateSelector = document.getElementById('<%=hdnConfigShowEmailTemplateSelector.ClientID%>').value

                if (showEmailTemplateSelector.toUpperCase() == "NO") {
                    var trs = document.getElementById("EmailTemplate");
                    var tds = trs.getElementsByTagName("td");
                    for (var i = 0; i < tds.length; i++) {
                        tds[i].style.display = "none";
                    }
                }
                else {
                    //do nothing. show Email  Template Selector 
                }

            }
            catch (err) {
                error = err.message
            }

        }

        // document.getElementById('<%=fileUploadEmailBodyTemplatePath.ClientID%>').onchange = function () {

        //}

    </script>
    <script type="text/javascript">
        //variable that will store the id of the last clicked row
        var previousRow;

        function ChangeRowColor(row) {
            //If last clicked row and the current clicked row are same
            if (previousRow == row)
                return;//do nothing
            //If there is row clicked earlier
            else if (previousRow != null)
                //change the color of the previous row back to white
                document.getElementById(previousRow).style.backgroundColor = "#ffffff !important";

            //change the color of the current row to light yellow

            document.getElementById(row).style.backgroundColor = "#f0f8ff !important";
            //assign the current row id to the previous row id
            //for next row to be clicked
            previousRow = row;
        }
    </script>

    <script>
        //function  ConfirmationBox()
        //{
        //    
        //   try {
        //       if (confirm("Do you want to proceed?") == true) {
        //           var control = document.getElementById('chkEmailAttachment');
        //               //document.getElementsByClassName('chkEmailAttachment');

        //           
        //           if (control.checked) {
        //               return true;
        //           }
        //           else {
        //               
        //               if (confirm("Do you want to proceed without selecting the attachment?") == true) { 
        //                   return true;
        //               }
        //               else {
        //                   return false;
        //               }
        //           }
        //       }
        //   }
        //   catch (err) {
        //       //document.getElementById("demo").innerHTML = err.message;
        //   }
        //}

        function ConfirmationBox() {
            //
            try {
                if (!checkemail()) //Added by Pratibha || Validate sender email || Asked by Sandip B. sir
                    return false;
                var control = document.getElementById('chkEmailAttachment');

                if (control.checked) {
                    //
                    if (confirm("Do you want to proceed?") == true) {
                        return true;
                    }
                    else {
                        return false;
                    }

                }
                else {
                    //
                    if (confirm("Do you want to proceed without selecting the attachment?") == true) {
                        return true;
                    }
                    else {
                        return false;
                    }
                }
            }
            catch (err) {
                //document.getElementById("demo").innerHTML = err.message;
            }
        }
    </script>
</asp:Content>

