<%@ page language="C#" masterpagefile="~/MasterFile/TimeCheck.master" autoeventwireup="true" validaterequest="false" inherits="Master_TA_UI_EmailSchedule, App_Web_konjkf2f" %>

<%@ Register TagPrefix="dxGridview" Namespace="DevExpress.Web" Assembly="DevExpress.Web.v14.2" %>
<%@ Register TagPrefix="FTB" Namespace="FreeTextBoxControls" Assembly="FreeTextBox" %>
<asp:Content ID="Content1" ContentPlaceHolderID="BodyContentPH" runat="Server">
    <script src="../plugins/datepicker/jquery-1.11.1.min.js"></script>
    <script language="javascript" src="../js/jquery.autocomplete.js" type="text/javascript"></script>
    <script src="../plugins/datepicker/bootstrap-datepicker.js"></script>
    <script src="../js/GettingWeek_MonthlyData.js" type="text/javascript"></script>
    <script>        
        $(function () 
        {
            $('#ctl00_BodyContentPH_txtTimeToSend').datetimepicker({format: document.getElementById('ctl00_BodyContentPH_hiddenTime').value});
            //user not able to set 05 / 10 mintues actually.We face this issue ohi group. on 25Dec2019 04:51 pM
            //$('#ctl00_BodyContentPH_txtTimeToSendEmp').datetimepicker({format: "hh:mm"});
        });
        function ddlWeekStartDayOnChange(startdate)
        {        
            var options = document.getElementById('ctl00_BodyContentPH_ddlDayTo');
            for (var i=0; i<options.length; i++) {
                options[i].disabled = false;
            }
            if(startdate==1)
            {
                options.selectedIndex=6;
            }
            else
            {
                options.selectedIndex=startdate-2;
            }            
            options[startdate-1].disabled = true;        
            ajaxGetWeekMonthlyData(2,document.getElementById('ctl00_BodyContentPH_ddlDayFrom').value,document.getElementById('ctl00_BodyContentPH_ddlDayTo').value,0,0);
            $(".select2").select2();
            return false;
        }
        function ddlMonthStartDateOnChange(startdate)
        {    
            var options = document.getElementById('ctl00_BodyContentPH_ddlDateTo');
            for (var i=0; i<options.length; i++) {
                options[i].disabled = false;
            }
            if(startdate==1)
            {
                options.selectedIndex=30;               
            }
            else
            {
                options.selectedIndex=startdate-2;              
            }        
            options[startdate-1].disabled = true;
            //        alert(document.getElementById('ctl00_BodyContentPH_ddlDateFrom').value);
            //        alert(document.getElementById('ctl00_BodyContentPH_ddlDateTo').value);        
            ajaxGetWeekMonthlyData(3,0,0,document.getElementById('ctl00_BodyContentPH_ddlDateFrom').value,document.getElementById('ctl00_BodyContentPH_ddlDateTo').value);
            $(".select2").select2();
            return false;
        } 
        function ddlWeekToDayOnChange()
        {        
            ajaxGetWeekMonthlyData(2,document.getElementById('ctl00_BodyContentPH_ddlDayFrom').value,document.getElementById('ctl00_BodyContentPH_ddlDayTo').value,0,0);
            return false;
        }
        function ddlMonthToDateOnChange()
        {       
            ajaxGetWeekMonthlyData(3,0,0,document.getElementById('ctl00_BodyContentPH_ddlDateFrom').value,document.getElementById('ctl00_BodyContentPH_ddlDateTo').value);
            return false;
        }
        function openURL(URL)
        {
            $('#ctl00_BodyContentPH_lbl_ReportName').text($("#ctl00_BodyContentPH_ddlReportName option:selected").text());
            //                document.getElementById('ctl00_BodyContentPH_lbl_ReportName').value=document.getElementById('ctl00_BodyContentPH_ddlReportName').value;
            document.getElementById('ctl00_BodyContentPH_iframeReport').src=URL;
            $(document).ready(function(){
                $("#myModalReport").modal('show');
            });                
            SetFrequency();
            ddlMonthStartDateOnChange(document.getElementById('ctl00_BodyContentPH_ddlDateFrom').value);
            return false;
        }
        function openPopupMailTo() {
            var MailType = "TO";
            document.getElementById('ctl00_BodyContentPH_iframePopup').src ='GetEmailIdsPopup.aspx?MailType=' + MailType + '', '';
            // window.open('GetEmailIdsPopup.aspx?MailType=' + MailType + '', '', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no,height=700,top=200,left=250,width=800;scrollbars=yes');
            return false;
        }
        function openPopupMailCc() {
            var MailType = "CC";
            document.getElementById('ctl00_BodyContentPH_iframePopup').src ='GetEmailIdsPopup.aspx?MailType=' + MailType + '', '';
            // window.open('GetEmailIdsPopup.aspx?MailType=' + MailType + '', '', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no,height=700,top=200,left=250,width=800;scrollbars=yes');
            return false;
        }
        function EnableDisableToAndCC() {
            if (document.getElementById('ctl00_BodyContentPH_rbtnOthers').checked == true) {
                document.getElementById('ctl00_BodyContentPH_divToEmailID').style.display = "";
                document.getElementById('ctl00_BodyContentPH_divCCEmailID').style.display = "";
                document.getElementById('ctl00_BodyContentPH_divgrid').style.display = "none";
                document.getElementById('ctl00_BodyContentPH_divTimeOption').style.display = "none";
                document.getElementById('ctl00_BodyContentPH_txtTimeToSend').style.display = "";
                document.getElementById('ctl00_BodyContentPH_txtTimeToSendEmp').style.display = "none";
                document.getElementById('ctl00_BodyContentPH_divAfterDays').style.display = "none";
            }
            else if (document.getElementById('ctl00_BodyContentPH_rbtnEmployee').checked == true) {
                document.getElementById('ctl00_BodyContentPH_divToEmailID').style.display = "none";
                document.getElementById('ctl00_BodyContentPH_divCCEmailID').style.display = "none";
                document.getElementById('ctl00_BodyContentPH_divgrid').style.display = "";
                document.getElementById('ctl00_BodyContentPH_divTimeOption').style.display = "";
                document.getElementById('ctl00_BodyContentPH_txtTimeToSend').style.display = "none";
                document.getElementById('ctl00_BodyContentPH_txtTimeToSendEmp').style.display = "";
                document.getElementById('ctl00_BodyContentPH_divAfterDays').style.display = "";
            }
            else if (document.getElementById('ctl00_BodyContentPH_rbtnReportingTo').checked == true) {
                document.getElementById('ctl00_BodyContentPH_divToEmailID').style.display = "none";
                document.getElementById('ctl00_BodyContentPH_divCCEmailID').style.display = "none";
                document.getElementById('ctl00_BodyContentPH_divgrid').style.display = "";
                document.getElementById('ctl00_BodyContentPH_divTimeOption').style.display = "";
                document.getElementById('ctl00_BodyContentPH_txtTimeToSend').style.display = "none";
                document.getElementById('ctl00_BodyContentPH_txtTimeToSendEmp').style.display = "";
                document.getElementById('ctl00_BodyContentPH_divAfterDays').style.display = "none";
                $("#ctl00_BodyContentPH_rbtnEmployee").attr('disabled', true);
                $("#ctl00_BodyContentPH_rbtnOthers").attr('disabled', true);

                var e = document.getElementById('ctl00_BodyContentPH_ddlReportName');
                var e = document.getElementById('<%= ddlReportName.ClientID %>');
                myValue = e.options[e.selectedIndex].value;
                var reportName=e.options[e.selectedIndex].text;
                if (myValue == '0' || myValue=='248' || myValue=='249') {
                    $("#ctl00_BodyContentPH_btnChooseFilters").attr('disabled', true);
                }
                else {
                    $("#ctl00_BodyContentPH_btnChooseFilters").attr('disabled', false);
                }

            }
}
function EnableTemplateDiv() {
    if (document.getElementById('ctl00_BodyContentPH_RadioButton3').checked == true) {
        document.getElementById('ctl00_BodyContentPH_divTemplate').style.display = "none";
    }
    else {
        document.getElementById('ctl00_BodyContentPH_divTemplate').style.display = "";
    }
}
function SetFrequency() 
{                            
    if (document.getElementById('ctl00_BodyContentPH_rbDaily').checked == true) 
    {
        document.getElementById('ctl00_BodyContentPH_trWeekly').style.display = "none";
        document.getElementById('ctl00_BodyContentPH_trMonthly').style.display = "none";
        document.getElementById('ctl00_BodyContentPH_trFrequencyType').style.display = "none";
        document.getElementById('ctl00_BodyContentPH_Datailysample').style.display = "block";
        document.getElementById('ctl00_BodyContentPH_WeekSample').style.display = "none";
        document.getElementById('ctl00_BodyContentPH_MonthData').style.display = "none";
        return false;
    }
    else if (document.getElementById('ctl00_BodyContentPH_rbWeekly').checked == true) 
    {
        document.getElementById('ctl00_BodyContentPH_trWeekly').style.display = "block";
        document.getElementById('ctl00_BodyContentPH_trMonthly').style.display = "none";
        document.getElementById('ctl00_BodyContentPH_trFrequencyType').style.display = "";
        document.getElementById('ctl00_BodyContentPH_Datailysample').style.display = "none";
        document.getElementById('ctl00_BodyContentPH_WeekSample').style.display = "block";
        document.getElementById('ctl00_BodyContentPH_MonthData').style.display = "none";
        var session=<%= Convert.ToString(Session["ScheduleId"]) %>;
        if(session==0 || session==null)
        {
            ddlWeekStartDayOnChange(document.getElementById('ctl00_BodyContentPH_ddlDayFrom').value);
        }
        else
        {
            document.getElementById('ctl00_BodyContentPH_rbDaily').style.display = "none";
            document.getElementById('ctl00_BodyContentPH_rbMonthly').style.display = "none";
            var options = document.getElementById('ctl00_BodyContentPH_ddlDayTo');
            var fromvalue=document.getElementById('ctl00_BodyContentPH_ddlDayFrom').value
            options[fromvalue-1].disabled = true; 
            ajaxGetWeekMonthlyData(2,document.getElementById('ctl00_BodyContentPH_ddlDayFrom').value,document.getElementById('ctl00_BodyContentPH_ddlDayTo').value,0,0);
        }
        return false;
    }
    else if (document.getElementById('ctl00_BodyContentPH_rbMonthly').checked == true) 
    {
        document.getElementById('ctl00_BodyContentPH_rbDaily').style.display = "none";
        document.getElementById('ctl00_BodyContentPH_rbWeekly').style.display = "none";
        document.getElementById('ctl00_BodyContentPH_trWeekly').style.display = "none";
        document.getElementById('ctl00_BodyContentPH_trMonthly').style.display = "block";
        document.getElementById('ctl00_BodyContentPH_trFrequencyType').style.display = "";
        document.getElementById('ctl00_BodyContentPH_Datailysample').style.display = "none";
        document.getElementById('ctl00_BodyContentPH_WeekSample').style.display = "none";
        document.getElementById('ctl00_BodyContentPH_MonthData').style.display = "block";
        var session=<%= Convert.ToString(Session["ScheduleId"]) %>;
        if(session==0 || session==null)
        {
            ddlMonthStartDateOnChange(document.getElementById('ctl00_BodyContentPH_ddlDateFrom').value);                
        }
        else
        {
            var options = document.getElementById('ctl00_BodyContentPH_ddlDateTo');
            var fromvalue=document.getElementById('ctl00_BodyContentPH_ddlDateFrom').value;
            options[fromvalue-1].disabled = true; 
            ajaxGetWeekMonthlyData(3,0,0,document.getElementById('ctl00_BodyContentPH_ddlDateFrom').value,document.getElementById('ctl00_BodyContentPH_ddlDateTo').value);
        }
        return false;
    }
}
function SetAuthentication() {
    if (document.getElementById('ctl00_BodyContentPH_rbAttachment').checked == true) {
        document.getElementById('ctl00_BodyContentPH_tdLoginRequired').disabled = true;
        document.getElementById('ctl00_BodyContentPH_ddlFileType').disabled = false;
    }
    else if (document.getElementById('ctl00_BodyContentPH_rbLink').checked == true) {
        document.getElementById('ctl00_BodyContentPH_tdLoginRequired').disabled = false;
        document.getElementById('ctl00_BodyContentPH_ddlFileType').disabled = true;
    }
}
function EnableChooseFilters() {   
    var e = document.getElementById('ctl00_BodyContentPH_ddlReportName');
    var e = document.getElementById('<%= ddlReportName.ClientID %>');
    myValue = e.options[e.selectedIndex].value;
    var reportName=e.options[e.selectedIndex].text;
    if (myValue == '0') {
        $("#ctl00_BodyContentPH_btnChooseFilters").attr('disabled', true);
    }
    else {
        $("#ctl00_BodyContentPH_btnChooseFilters").attr('disabled', false);
        if (myValue != '248' && myValue != '249')
        {
            document.getElementById('ctl00_BodyContentPH_rbtnReportingTo').checked = false;
            //$("#ctl00_BodyContentPH_rbtnReportingTo").attr('disabled', true);
            //document.getElementById('ctl00_BodyContentPH_rbtnEmployee').checked = true;
            document.getElementById('ctl00_BodyContentPH_divgrid').style.display = "";
            $('#ctl00_BodyContentPH_rbtnOthers').attr('disabled', false);
            $('#ctl00_BodyContentPH_rbtnEmployee').attr('disabled', false);
            $("#ctl00_BodyContentPH_rbtnReportingTo").attr('disabled', true);
        }
        else if (myValue == '248' || myValue == '249'){
            document.getElementById("ctl00_BodyContentPH_hdnFilters").value="";
            $("#ctl00_BodyContentPH_btnChooseFilters").attr('disabled', true);
            document.getElementById('ctl00_BodyContentPH_divgrid').style.display = "";
            $('#ctl00_BodyContentPH_rbtnOthers').attr('disabled', true);
            $('#ctl00_BodyContentPH_rbtnEmployee').attr('disabled', true);
            $("#ctl00_BodyContentPH_rbtnReportingTo").attr('disabled', false);
            document.getElementById("ctl00_BodyContentPH_divAfterDays").style.display = "none";
            document.getElementById("ctl00_BodyContentPH_rbtnOthers").checked = false;
            document.getElementById("ctl00_BodyContentPH_rbtnEmployee").checked = false;
            //document.getElementById("ctl00_BodyContentPH_rbtnReportingTo").checked = true;
        }
    }
}
//myField accepts an object reference, myValue accepts the text string to add
function insertAtCursor(myValue) {
    myField = document.getElementById('<%= txtSubject.ClientID %>');
    var e = document.getElementById('<%= ddlInsertFields.ClientID %>');
    myValue = e.options[e.selectedIndex].value;
    if (myValue != '0') {
        //fixed scroll position 
        textAreaScrollPosition = myField.scrollTop;
        //IE support 
        if (document.selection) {
            myField.focus();
            //in effect we are creating a text range with zero 
            //length at the cursor location and replacing it 
            //with myValue 
            sel = document.selection.createRange();
            sel.text = myValue;
            //Mozilla/Firefox/Netscape 7+ support 
        }
        else if (myField.selectionStart || myField.selectionStart == '0') {
            myField.focus();
            //Here we get the start and end points of the 
            //selection. Then we create substrings up to the 
            //start of the selection and from the end point 
            //of the selection to the end of the field value. 
            //Then we concatenate the first substring, myValue, 
            //and the second substring to get the new value. 
            var startPos = myField.selectionStart;
            var endPos = myField.selectionEnd;
            if (startPos == 0) {
                myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length);
            }
            else {
                myField.value = myField.value.substring(0, startPos) + " | " + myValue + myField.value.substring(endPos, myField.value.length);
            }
            //myField.setSelectionRange(endPos + myValue.length, endPos + myValue.length);
        }
        else {
            myField.value += myValue;
        }
        //fixed scroll position
        myField.scrollTop = textAreaScrollPosition;
        document.getElementById('<%= ddlInsertFields.ClientID %>').value = '0';
        document.getElementById('<%= ddlInsertFields.ClientID %>').focus();
    }
}
    </script>
    <div class="content-header">
        <h1 style="background-image: url('../dist/img/email-shudule.png'); background-repeat: no-repeat; padding-left: 35px">
            <asp:Label ID="lbl_EmailSchedule" Text="Email Scheduler" runat="server"></asp:Label>
        </h1>
        <asp:SiteMapPath ID="site" runat="server" CssClass="breadcrumb">
            <NodeStyle CssClass="active" />
        </asp:SiteMapPath>
        <asp:HiddenField ID="hiddenTime" runat="server" />
    </div>
    <div class="content">
        <div id="myModal" class="modal modal-default fade" role="dialog">
            <div class="modal-dialog" style="min-width: 85%;">
                <!-- Modal content-->
                <div class="modal-content" style="margin-top: 50px">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" style="border-radius: 50px;">
                            &times;</button>
                        <h4 class="modal-title" style="padding-bottom: 10px">
                            <asp:Label ID="lblSelectEmployee" runat="server" Text="Select Employee"></asp:Label>
                        </h4>
                    </div>
                    <div class="modal-body" style="padding-top: 0px">
                        <iframe id="iframePopup" runat="server" scrolling="auto" width="100%" height="650px"
                            style="border-style: none"></iframe>
                    </div>
                    <div class="modal-footer" style="display: none">
                        <button type="button" class="btn btn-primary pull-right" data-dismiss="modal">
                            Close</button>
                    </div>
                </div>
            </div>
        </div>
        <div id="myModalReport" class="modal modal-default fade" role="dialog">
            <div class="modal-dialog" style="min-width: 85%;">
                <!-- Modal content-->
                <div class="modal-content" style="margin-top: 50px">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" style="border-radius: 50px;">
                            &times;</button>
                        <h4 class="modal-title" style="padding-bottom: 10px">
                            <asp:Label ID="lbl_ReportName" runat="server" Text="Filter"></asp:Label>
                        </h4>
                    </div>
                    <div class="modal-body" style="padding-top: 0px">
                        <iframe id="iframeReport" runat="server" scrolling="auto" width="100%" height="550px"
                            style="border-style: none"></iframe>
                    </div>
                    <div class="modal-footer" style="display: none">
                        <button type="button" class="btn btn-primary pull-right" data-dismiss="modal">
                            Close</button>
                    </div>
                </div>
            </div>
        </div>
        <div>
            <!--FILTERS-->
            <div class="inr-ftr">
                <div class="row">
                    <div class="col-sm-12 ">
                        <div class="pull-right">
                            <h6>
                                <span style="color: Red">|</span><span style="padding-left: 10px; padding-right: 10px">
                                    <asp:Label ID="lbl_IndicatesMandatoryFields" runat="server"></asp:Label>
                                    (5 No.)</span>
                                <asp:HiddenField ID="hdnFilters" runat="server" />
                                <asp:HiddenField ID="hdnReportType" runat="server" />
                                <asp:HiddenField ID="hdnCompanyId" runat="server" />
                            </h6>
                        </div>
                    </div>
                    <div class="clearfix">
                    </div>
                </div>
            </div>
            <div class="emp-filter">
                <div class="row">
                    <div class="col-md-12">
                        <div class="form-horizontal">
                            <div class="row form-group">
                                <div class="col-md-2 col-sm-2">
                                    <asp:Label ID="lblScheduleName" Text="Schedule Name" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-3 col-sm-3">
                                    <asp:TextBox runat="server" CssClass="form-control man-dat" MaxLength="250" onkeyup="return chkMaxLen(event,this,250,MaxLength);"
                                        ID="txtScheduleName" onkeypress="return Scheduler_AcceptChars_MaxLength(event,this,250,MaxLength);"></asp:TextBox>
                                </div>
                            </div>
                            <div class="row form-group">
                                <div class="col-md-2 col-sm-2">
                                    <asp:Label runat="server" ID="lblReportName" Text="Report Name"></asp:Label>
                                </div>
                                <div class="col-md-3 col-sm-3">
                                    <asp:DropDownList runat="server" ID="ddlReportName" AppendDataBoundItems="true" onchange="EnableChooseFilters();"
                                        CssClass="form-control select2 Man-dat">
                                        <asp:ListItem Value="0" Selected="True" Text="Select"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                                <div class="col-md-2 src-margintop src-padleft col-sm-2">
                                    <span class="input-group-btn">
                                        <asp:LinkButton CssClass="btn save-btn fa-filter" runat="server" Enabled="true" Text=" Choose Filters"
                                            ID="btnChooseFilters" OnClick="btnChooseFilters_Click" OnClientClick="return VaildateFilter();" />
                                    </span>
                                </div>
                            </div>
                            <div class="row" id="divTowhom" runat="server">
                                <div class="col-md-2 col-sm-2">
                                    <asp:Label ID="Label1" runat="server" Text="To Whom"></asp:Label>
                                </div>
                                <div class="col-md-10">
                                    <div class="col-md-1 col-sm-2" style="padding-left: 0px">
                                        <asp:RadioButton runat="server" ID="rbtnOthers" Text="Others" GroupName="ToWhom"
                                            onclick="EnableDisableToAndCC();" CssClass="radio radio-primary" Checked="true" OnCheckedChanged="rbtnEmployee_CheckedChanged" AutoPostBack="true" />
                                    </div>
                                    <div class="col-md-10 col-sm-3" style="width: 90%">
                                        <div class="col-md-3" style="padding-right: 0px">
                                            <asp:RadioButton runat="server" ID="rbtnEmployee" Text="To Employee(s)" GroupName="ToWhom" OnCheckedChanged="rbtnEmployee_CheckedChanged" AutoPostBack="true"
                                                onclick="EnableDisableToAndCC();" CssClass="radio radio-primary" Style="width: 165px" />
                                        </div>
                                        <div class="col-md-6" style="padding-left: 0px;">
                                            <asp:RadioButton runat="server" ID="rbtnReportingTo" Text="Reporting To" GroupName="ToWhom" OnCheckedChanged="rbtnEmployee_CheckedChanged" AutoPostBack="true"
                                                onclick="EnableDisableToAndCC();" CssClass="radio radio-primary" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row form-group" id="divgrid" runat="server" style="display: none">
                                <div class="col-md-12" style="overflow: auto; padding-bottom: 10px">
                                    <asp:GridView CssClass="table das-table1" ID="grv_EmpDetails" Width="100%" runat="server" OnRowDataBound="grv_EmpDetails_RowDataBound"
                                        AllowPaging="True" AutoGenerateColumns="False" PageSize="10" OnPageIndexChanging="grv_EmpDetails_PageIndexChanging"
                                        Font-Size="13px">
                                        <Columns>
                                            <asp:TemplateField HeaderStyle-CssClass="empheader">
                                                <HeaderTemplate>
                                                    <asp:CheckBox ID="checkall" runat="server" Text="" AutoPostBack="true" OnCheckedChanged="grv_CheckAll_CheckedChanged"
                                                        TextAlign="Right" />
                                                </HeaderTemplate>
                                                <ItemTemplate>
                                                    <asp:CheckBox ID="deletethis" runat="server" AutoPostBack="true" OnCheckedChanged="grv_Check_CheckedChanged"></asp:CheckBox>
                                                </ItemTemplate>
                                                <ItemStyle HorizontalAlign="center" />
                                                <HeaderStyle HorizontalAlign="center" />
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Employee ID" HeaderStyle-CssClass="empheader GridColumn50">
                                                <ItemTemplate>
                                                    <asp:Label ID="lbl_EmpId" Text='<%# Eval("Employee_Code_Id")%>' runat="server"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Employee Name" HeaderStyle-CssClass="empheader GridColumn50">
                                                <ItemTemplate>
                                                    <asp:Label ID="lbl_EmpName" Text='<%# Eval("Employee_FirstName")%>' runat="server" Style="word-wrap: break-word; display: inline-block; width: 200px;" CssClass="pull-left-button"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Designation" HeaderStyle-CssClass="empheader GridColumn50">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblTitleName" Text='<%# Eval("TitleName")%>' runat="server" Style="word-wrap: break-word; display: inline-block; width: 200px;" CssClass="pull-left-button"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Email ID" HeaderStyle-CssClass="empheader GridColumn50">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblEmailId" Text='<%# Eval("EmailId")%>' runat="server" Style="word-wrap: break-word; display: inline-block; width: 200px;" CssClass="pull-left-button"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="flag" Visible="false" HeaderStyle-CssClass="empheader GridColumn50">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblflag" Text='<%# Eval("emailScheduler_flag")%>' runat="server"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                        </Columns>

                                        <RowStyle Height="30px" CssClass="table-bg" BorderColor="#C5DFFC" />
                                        <PagerStyle Font-Overline="False" HorizontalAlign="Right" CssClass="GridPager" />
                                        <PagerSettings FirstPageText="<<" LastPageText=">>" Mode="NumericFirstLast" NextPageText=">"
                                            PreviousPageText="<" />
                                        <AlternatingRowStyle BackColor="white" />
                                    </asp:GridView>
                                </div>
                            </div>
                            <div class="row" id="divAfterDays" runat="server" style="display: none;">
                                <div class="col-md-1" style="padding-right: 0px">
                                    <asp:CheckBox CssClass="checkbox checkbox-primary" Text="After" ID="chkboxReporting" runat="server" onclick="ReportingToControls();" />
                                </div>
                                <div class="col-md-1" style="padding-right: 10px; padding-left: 2px; width: 56px;">
                                    <asp:TextBox ID="txtAfter" Enabled="false" runat="server" CssClass="form-control man-dat" Style="width: 50px;" MaxLength="2" onkeypress="return numbers_dot(event,this);"></asp:TextBox>
                                    <%--<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txt_Numberofdays"
                                        SetFocusOnError="True" ErrorMessage="Enter Number of Days applied" Display="none">*</asp:RequiredFieldValidator>--%>
                                    <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="txtAfter"
                                        ErrorMessage="Number of Days should between 1 and 365" MaximumValue="10" MinimumValue="1"
                                        SetFocusOnError="True" Type="Integer">*</asp:RangeValidator>
                                </div>
                                <div class="col-md-9" style="padding-left: 0px;">
                                    <asp:Label ID="lblAfter" Text="Days, reminder mail should be trigger to Reporting To defined in employee master." runat="server" />
                                </div>
                            </div>
                            <div class="row form-group">
                                <div class="col-md-2 col-sm-2">
                                    <asp:Label ID="lblFrequency" runat="server" Text="Frequency"></asp:Label>
                                </div>
                                <div class="col-md-1  col-sm-2">
                                    <asp:RadioButton runat="server" ID="rbDaily" Checked="true" Text="Daily" GroupName="Frequency"
                                        onclick="SetFrequency(1);" CssClass="radio radio-primary" />
                                </div>
                                <div class="col-md-1  col-sm-2">
                                    <asp:RadioButton runat="server" ID="rbWeekly" Text="Weekly" GroupName="Frequency"
                                        onclick="SetFrequency(2);" CssClass="radio radio-primary" />
                                </div>
                                <div class="col-md-1  col-sm-2">
                                    <asp:RadioButton runat="server" ID="rbMonthly" Text="Monthly" GroupName="Frequency"
                                        onclick="SetFrequency(3);" CssClass="radio radio-primary" />
                                </div>
                                <div class="col-md-1  col-sm-0">
                                </div>
                                <div class="col-md-2  col-sm-2">
                                    <asp:Label ID="lblTimeToSend" runat="server" Text="Time To Send"></asp:Label>
                                </div>
                                <div class="col-md-2  col-sm-2" id="divTimeOption" runat="server" style="display: none">
                                    <asp:DropDownList runat="server" ID="ddlTimeOption" AppendDataBoundItems="true" onchange="EnableChooseFilters();"
                                        CssClass="form-control select2 Man-dat">
                                        <asp:ListItem Value="0" Selected="True" Text="Select"></asp:ListItem>
                                        <asp:ListItem Value="1" Text="After shift Start Time"></asp:ListItem>
                                        <asp:ListItem Value="2" Text="Before shift Start Time"></asp:ListItem>
                                        <asp:ListItem Value="3" Text="After shift End Time"></asp:ListItem>
                                        <asp:ListItem Value="4" Text="Before shift End Time"></asp:ListItem>
                                        <asp:ListItem Value="5" Text="Custom"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                                <div class="col-md-2  col-sm-2">
                                    <asp:TextBox ID="txtTimeToSend" CssClass="form-control man-dat" onkeydown="return key_press_nokey(event)"
                                        onkeypress="return key_press_nokey(event);" runat="server"></asp:TextBox>
                                    <asp:TextBox ID="txtTimeToSendEmp" CssClass="form-control man-dat" onkeydown="return key_press_nokey(event)"
                                        onkeypress="return key_press_nokey(event);" Style="display: none" runat="server"></asp:TextBox>
                                </div>
                            </div>
                            <div id="Datailysample" runat="server" class="row form-group">
                                <div class="col-md-2">
                                    <asp:Label ID="lbldailysample" runat="server" Text="Sample :" Style="color: red"></asp:Label>
                                </div>
                                <div class="col-md-3">
                                    <asp:Label ID="lbldailysamplevalue" runat="server" Text="" Style="color: red"></asp:Label>
                                </div>
                            </div>
                            <div id="trFrequencyType" runat="server" style="display: none;">
                                <div id="trWeekly" runat="server" style="display: none;">
                                    <div class="row form-group">
                                        <div class="col-md-2">
                                            <asp:Label ID="lblDayToSend" runat="server" Text="Day To Send"></asp:Label>
                                        </div>
                                        <div class="col-md-3">
                                            <asp:DropDownList ID="ddlDayToSend" runat="server" CssClass="form-control select2">
                                                <asp:ListItem Text="Sunday" Value="1"></asp:ListItem>
                                                <asp:ListItem Text="Monday" Value="2"></asp:ListItem>
                                                <asp:ListItem Text="Tuesday" Value="3"></asp:ListItem>
                                                <asp:ListItem Text="Wednesday" Value="4"></asp:ListItem>
                                                <asp:ListItem Text="Thursday" Value="5"></asp:ListItem>
                                                <asp:ListItem Text="Friday" Value="6"></asp:ListItem>
                                                <asp:ListItem Text="Saturday" Value="7"></asp:ListItem>
                                            </asp:DropDownList>
                                        </div>
                                    </div>
                                    <div class="row form-group">
                                        <div class="col-md-2">
                                            <asp:Label ID="lblDayFrom" runat="server" Text="Previous Week - Data From"></asp:Label>
                                        </div>
                                        <div class="col-md-3">
                                            <asp:DropDownList ID="ddlDayFrom" runat="server" CssClass="form-control select2"
                                                onchange="ddlWeekStartDayOnChange(this.value);">
                                                <asp:ListItem Text="Sunday" Value="1"></asp:ListItem>
                                                <asp:ListItem Text="Monday" Value="2"></asp:ListItem>
                                                <asp:ListItem Text="Tuesday" Value="3"></asp:ListItem>
                                                <asp:ListItem Text="Wednesday" Value="4"></asp:ListItem>
                                                <asp:ListItem Text="Thursday" Value="5"></asp:ListItem>
                                                <asp:ListItem Text="Friday" Value="6"></asp:ListItem>
                                                <asp:ListItem Text="Saturday" Value="7"></asp:ListItem>
                                            </asp:DropDownList>
                                        </div>
                                        <div class="col-md-1">
                                        </div>
                                        <div class="col-md-2">
                                            <asp:Label ID="lblDayTo" runat="server" Text="To"></asp:Label>
                                        </div>
                                        <div class="col-md-3">
                                            <asp:DropDownList ID="ddlDayTo" runat="server" CssClass="form-control select2" onchange="ddlWeekToDayOnChange();">
                                                <asp:ListItem Text="Sunday" Value="1"></asp:ListItem>
                                                <asp:ListItem Text="Monday" Value="2"></asp:ListItem>
                                                <asp:ListItem Text="Tuesday" Value="3"></asp:ListItem>
                                                <asp:ListItem Text="Wednesday" Value="4"></asp:ListItem>
                                                <asp:ListItem Text="Thursday" Value="5"></asp:ListItem>
                                                <asp:ListItem Text="Friday" Value="6"></asp:ListItem>
                                                <asp:ListItem Text="Saturday" Value="7"></asp:ListItem>
                                            </asp:DropDownList>
                                        </div>
                                    </div>
                                </div>
                                <div id="WeekSample" runat="server" class="row form-group" style="display: none">
                                    <div class="col-md-2">
                                        <asp:Label ID="lblSample" runat="server" Text="Sample :" Style="color: red"></asp:Label>
                                    </div>
                                    <div class="col-md-3">
                                        <asp:Label ID="Label2" runat="server" Text="" Style="color: red"></asp:Label>
                                    </div>
                                </div>
                                <div id="trMonthly" runat="server" style="display: none;">
                                    <div class="row form-group">
                                        <div class="col-md-2">
                                            <asp:Label ID="lblDateToSend" runat="server" Text="Date To Send"></asp:Label>
                                        </div>
                                        <div class="col-md-3">
                                            <asp:DropDownList runat="server" ID="ddlDateToSend" CssClass="form-control select2">
                                                <asp:ListItem Text="1" Value="1"></asp:ListItem>
                                                <asp:ListItem Text="2" Value="2"></asp:ListItem>
                                                <asp:ListItem Text="3" Value="3"></asp:ListItem>
                                                <asp:ListItem Text="4" Value="4"></asp:ListItem>
                                                <asp:ListItem Text="5" Value="5"></asp:ListItem>
                                                <asp:ListItem Text="6" Value="6"></asp:ListItem>
                                                <asp:ListItem Text="7" Value="7"></asp:ListItem>
                                                <asp:ListItem Text="8" Value="8"></asp:ListItem>
                                                <asp:ListItem Text="9" Value="9"></asp:ListItem>
                                                <asp:ListItem Text="10" Value="10"></asp:ListItem>
                                                <asp:ListItem Text="11" Value="11"></asp:ListItem>
                                                <asp:ListItem Text="12" Value="12"></asp:ListItem>
                                                <asp:ListItem Text="13" Value="13"></asp:ListItem>
                                                <asp:ListItem Text="14" Value="14"></asp:ListItem>
                                                <asp:ListItem Text="15" Value="15"></asp:ListItem>
                                                <asp:ListItem Text="16" Value="16"></asp:ListItem>
                                                <asp:ListItem Text="17" Value="17"></asp:ListItem>
                                                <asp:ListItem Text="18" Value="18"></asp:ListItem>
                                                <asp:ListItem Text="19" Value="19"></asp:ListItem>
                                                <asp:ListItem Text="20" Value="20"></asp:ListItem>
                                                <asp:ListItem Text="21" Value="21"></asp:ListItem>
                                                <asp:ListItem Text="22" Value="22"></asp:ListItem>
                                                <asp:ListItem Text="23" Value="23"></asp:ListItem>
                                                <asp:ListItem Text="24" Value="24"></asp:ListItem>
                                                <asp:ListItem Text="25" Value="25"></asp:ListItem>
                                                <asp:ListItem Text="26" Value="26"></asp:ListItem>
                                                <asp:ListItem Text="27" Value="27"></asp:ListItem>
                                                <asp:ListItem Text="28" Value="28"></asp:ListItem>
                                                <asp:ListItem Text="29" Value="29"></asp:ListItem>
                                                <asp:ListItem Text="30" Value="30"></asp:ListItem>
                                                <asp:ListItem Text="31" Value="31"></asp:ListItem>
                                            </asp:DropDownList>
                                        </div>
                                    </div>
                                    <div class="row form-group">
                                        <div class="col-md-2">
                                            <asp:Label ID="lblDateFrom" runat="server" Text="Previous Month - Data From"></asp:Label>
                                        </div>
                                        <div class="col-md-3">
                                            <asp:DropDownList runat="server" ID="ddlDateFrom" onchange="ddlMonthStartDateOnChange(this.value);"
                                                CssClass="form-control select2">
                                                <asp:ListItem Text="1" Value="1"></asp:ListItem>
                                                <asp:ListItem Text="2" Value="2"></asp:ListItem>
                                                <asp:ListItem Text="3" Value="3"></asp:ListItem>
                                                <asp:ListItem Text="4" Value="4"></asp:ListItem>
                                                <asp:ListItem Text="5" Value="5"></asp:ListItem>
                                                <asp:ListItem Text="6" Value="6"></asp:ListItem>
                                                <asp:ListItem Text="7" Value="7"></asp:ListItem>
                                                <asp:ListItem Text="8" Value="8"></asp:ListItem>
                                                <asp:ListItem Text="9" Value="9"></asp:ListItem>
                                                <asp:ListItem Text="10" Value="10"></asp:ListItem>
                                                <asp:ListItem Text="11" Value="11"></asp:ListItem>
                                                <asp:ListItem Text="12" Value="12"></asp:ListItem>
                                                <asp:ListItem Text="13" Value="13"></asp:ListItem>
                                                <asp:ListItem Text="14" Value="14"></asp:ListItem>
                                                <asp:ListItem Text="15" Value="15"></asp:ListItem>
                                                <asp:ListItem Text="16" Value="16"></asp:ListItem>
                                                <asp:ListItem Text="17" Value="17"></asp:ListItem>
                                                <asp:ListItem Text="18" Value="18"></asp:ListItem>
                                                <asp:ListItem Text="19" Value="19"></asp:ListItem>
                                                <asp:ListItem Text="20" Value="20"></asp:ListItem>
                                                <asp:ListItem Text="21" Value="21"></asp:ListItem>
                                                <asp:ListItem Text="22" Value="22"></asp:ListItem>
                                                <asp:ListItem Text="23" Value="23"></asp:ListItem>
                                                <asp:ListItem Text="24" Value="24"></asp:ListItem>
                                                <asp:ListItem Text="25" Value="25"></asp:ListItem>
                                                <asp:ListItem Text="26" Value="26"></asp:ListItem>
                                                <asp:ListItem Text="27" Value="27"></asp:ListItem>
                                                <asp:ListItem Text="28" Value="28"></asp:ListItem>
                                                <asp:ListItem Text="29" Value="29"></asp:ListItem>
                                                <asp:ListItem Text="30" Value="30"></asp:ListItem>
                                                <asp:ListItem Text="31" Value="31"></asp:ListItem>
                                            </asp:DropDownList>
                                        </div>
                                        <div class="col-md-1">
                                        </div>
                                        <div class="col-md-2">
                                            <asp:Label ID="lblDateTo" runat="server" Text="To"></asp:Label>
                                        </div>
                                        <div class="col-md-3">
                                            <asp:DropDownList runat="server" ID="ddlDateTo" CssClass="form-control select2" onchange="ddlMonthToDateOnChange();">
                                                <asp:ListItem Text="1" Value="1"></asp:ListItem>
                                                <asp:ListItem Text="2" Value="2"></asp:ListItem>
                                                <asp:ListItem Text="3" Value="3"></asp:ListItem>
                                                <asp:ListItem Text="4" Value="4"></asp:ListItem>
                                                <asp:ListItem Text="5" Value="5"></asp:ListItem>
                                                <asp:ListItem Text="6" Value="6"></asp:ListItem>
                                                <asp:ListItem Text="7" Value="7"></asp:ListItem>
                                                <asp:ListItem Text="8" Value="8"></asp:ListItem>
                                                <asp:ListItem Text="9" Value="9"></asp:ListItem>
                                                <asp:ListItem Text="10" Value="10"></asp:ListItem>
                                                <asp:ListItem Text="11" Value="11"></asp:ListItem>
                                                <asp:ListItem Text="12" Value="12"></asp:ListItem>
                                                <asp:ListItem Text="13" Value="13"></asp:ListItem>
                                                <asp:ListItem Text="14" Value="14"></asp:ListItem>
                                                <asp:ListItem Text="15" Value="15"></asp:ListItem>
                                                <asp:ListItem Text="16" Value="16"></asp:ListItem>
                                                <asp:ListItem Text="17" Value="17"></asp:ListItem>
                                                <asp:ListItem Text="18" Value="18"></asp:ListItem>
                                                <asp:ListItem Text="19" Value="19"></asp:ListItem>
                                                <asp:ListItem Text="20" Value="20"></asp:ListItem>
                                                <asp:ListItem Text="21" Value="21"></asp:ListItem>
                                                <asp:ListItem Text="22" Value="22"></asp:ListItem>
                                                <asp:ListItem Text="23" Value="23"></asp:ListItem>
                                                <asp:ListItem Text="24" Value="24"></asp:ListItem>
                                                <asp:ListItem Text="25" Value="25"></asp:ListItem>
                                                <asp:ListItem Text="26" Value="26"></asp:ListItem>
                                                <asp:ListItem Text="27" Value="27"></asp:ListItem>
                                                <asp:ListItem Text="28" Value="28"></asp:ListItem>
                                                <asp:ListItem Text="29" Value="29"></asp:ListItem>
                                                <asp:ListItem Text="30" Value="30"></asp:ListItem>
                                                <asp:ListItem Text="31" Value="31"></asp:ListItem>
                                            </asp:DropDownList>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div id="MonthData" runat="server" class="row form-group" style="display: none">
                                <div class="col-md-2">
                                    <asp:Label ID="Label3" runat="server" Text="Sample :" Style="color: red"></asp:Label>
                                </div>
                                <div class="col-md-3">
                                    <asp:Label ID="Label4" runat="server" Style="color: red"></asp:Label>
                                </div>
                            </div>
                            <div class="row form-group">
                                <div class="col-md-2">
                                    <asp:Label runat="server" ID="lblEmailSendType" Text="Email Send type"></asp:Label>
                                </div>
                                <div class="col-md-2">
                                    <asp:RadioButton ID="rbAttachment" Checked="true" runat="server" Text="Attachment"
                                        GroupName="EmailSendType" onclick="SetAuthentication();" CssClass="radio radio-primary" />
                                </div>
                                <div class="col-md-1">
                                    <asp:RadioButton ID="rbLink" runat="server" Text="Link" GroupName="EmailSendType"
                                        CssClass="radio radio-primary" onclick="SetAuthentication();" />
                                </div>
                                <div class="col-md-1">
                                </div>
                                <div class="col-md-2">
                                    <asp:Label runat="server" ID="lblLoginRequired" Text="Login Required"></asp:Label>
                                </div>
                                <div runat="server" id="tdLoginRequired">
                                    <div class="col-md-1">
                                        <asp:RadioButton ID="rbYes" runat="server" Text="Yes" GroupName="LoginRequired" CssClass="radio radio-primary" />
                                    </div>
                                    <div class="col-md-1">
                                        <asp:RadioButton ID="rbNo" Checked="true" runat="server" Text="No" GroupName="LoginRequired"
                                            CssClass="radio radio-primary" />
                                    </div>
                                </div>
                            </div>
                            <div class="row" id="trFiletype" runat="server" style="display: none">
                                <div class="col-md-12">
                                    <asp:Label runat="server" ID="lblFileType" Text="File Type"></asp:Label>
                                </div>
                                <div class="col-md-12">
                                    <asp:DropDownList runat="server" ID="ddlFileType" Enabled="false" CssClass="radio radio-primary">
                                        <asp:ListItem Text="PDF" Value="PDF"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                            </div>
                            <div class="row form-group" id="divToEmailID" runat="server">
                                <div class="col-md-2">
                                    <asp:Label ID="lblApprovalTO" runat="server" Text="To Mail Ids"></asp:Label>
                                </div>
                                <div class="col-md-9">
                                    <div class="input-group input-group-sm">
                                        <asp:TextBox ID="txtToemailID" runat="server" CssClass="form-control man-dat" TextMode="MultiLine"
                                            placeholder="Enter email id here.." Style="resize: none" Height="70px"></asp:TextBox>
                                        <span class="input-group-btn">
                                            <asp:Button ID="btnApprovalTO" runat="server" CssClass="btn save-btn" Text="To..."
                                                Style="min-width: 45px" Height="70px" OnClientClick="javascript:return openPopupMailTo();"
                                                data-toggle="modal" data-target="#myModal" />
                                        </span>
                                    </div>
                                    Use Semicolon <b>(;)</b> to separate Email Ids
                                </div>
                            </div>
                            <div class="row form-group" id="divCCEmailID" runat="server">
                                <div class="col-md-2">
                                    <asp:Label ID="lblApprovalCC" runat="server" Text="Cc Mail Ids"></asp:Label>
                                </div>
                                <div class="col-md-9">
                                    <div class="input-group input-group-sm">
                                        <asp:TextBox ID="txtCCemailID" runat="server" CssClass="form-control" TextMode="MultiLine"
                                            placeholder="Enter email id here.." Style="resize: none" Height="70px"></asp:TextBox>
                                        <span class="input-group-btn">
                                            <asp:Button ID="btnApprovalCC" runat="server" CssClass="btn save-btn" Text="Cc..."
                                                Style="min-width: 45px" OnClientClick="javascript:return openPopupMailCc();"
                                                data-toggle="modal" data-target="#myModal" Height="70px" />
                                        </span>
                                    </div>
                                    Use Semicolon <b>(;)</b> to separate Email Ids
                                </div>
                            </div>
                            <div class="row form-group">
                                <div class="col-md-12" style="color: red">
                                    Note: It will trigger the previous day / Week / Month log details to Users.
                                </div>
                            </div>
                            <div class="row">
                                <div class="config-hdr con-spc" style="margin: 0 -5px !important">
                                    <h3>
                                        <asp:Label ID="lblEmailTemplate" runat="server" Text="Email Template : "></asp:Label>
                                    </h3>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-12 config-table" style="padding: 20px 0 0px 0px !important; margin: 0px !important">
                                    <div class="col-md-12">
                                        <div class="row form-group">
                                            <div class="col-md-2">
                                                <asp:Label ID="lblSubject" runat="server" Text="Subject"></asp:Label>
                                            </div>
                                            <div class="col-md-9">
                                                <div class="input-group input-group-sm">
                                                    <asp:TextBox ID="txtSubject" runat="server" onkeyup="return chkMaxLen(event,this,300,MaxLength);"
                                                        MaxLength="300" CssClass="form-control man-dat"></asp:TextBox>
                                                    <span class="input-group-btn">
                                                        <asp:DropDownList ID="ddlInsertFields" onchange="insertAtCursor('texttest');" runat="server"
                                                            CssClass="btn save-btn" Width="120px" Style="text-align: left">
                                                            <asp:ListItem Text="Insert Fields" Value="0"></asp:ListItem>
                                                            <asp:ListItem Text="Report Name" Value="{Report Name}"></asp:ListItem>
                                                            <asp:ListItem Text="Schedule Name" Value="{Schedule Name}"></asp:ListItem>
                                                            <asp:ListItem Text="Duration" Value="{Duration}"></asp:ListItem>
                                                            <asp:ListItem Text="Created By" Value="{Created By}"></asp:ListItem>
                                                        </asp:DropDownList>
                                                    </span>
                                                </div>
                                            </div>
                                            <div class="col-md-2">
                                            </div>
                                        </div>
                                        <div class="row form-group">
                                            <div class="col-md-12" style="overflow: auto;">
                                                <asp:HiddenField ID="hfemail" runat="server" Value="^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$" />
                                                <FTB:FreeTextBox ID="editor" ToolbarLayout="Bold,Italic,Underline,Strikethrough,Superscript,Subscript,RemoveFormat;FontFacesMenu,FontSizesMenu,SymbolsMenu;FontForeColorsMenu,FontForeColorPicker,FontBackColorsMenu,FontBackColorPicker|JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;BulletedList,NumberedList,Indent,Outdent;Cut,Copy,Paste,Delete;CreateLink,Unlink,InsertDate,InsertTime,InsertTable,InsertDiv,EditStyle,Preview,SelectAll,WordClean"
                                                    runat="Server" Width="100%" UpdateToolbar="True" UseToolbarBackGroundImage="True">
                                                </FTB:FreeTextBox>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-12">
                                    <div class="pull-right-button">
                                        <asp:LinkButton runat="server" ID="btnSave" Text=" Save" CssClass="btn save-btn  fa-floppy-o"
                                            OnClick="btnSave_Click" OnClientClick="return VaildateMandatory();" />
                                        <asp:LinkButton ID="btn_Delete" Visible="false" CssClass="btn btn-primary  fa-trash-o"
                                            runat="server" CausesValidation="False" OnClientClick="return confirmdelete(this.form);" />
                                        <asp:LinkButton runat="server" ID="btnBack" CssClass="btn save-btn fa-angle-left"
                                            Text="Back" OnClick="btnBack_Click" />
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript" language="javascript">
        document.getElementById("ctl00_BodyContentPH_editor_TabRow").style.display = "none";
        //document.getElementById("ctl00_BodyContentPH_editor").style.overflow = "hidden";
        //style="overflow:hidden"
        var Selectreportname="Select report name";
        var EnterScheduleName="Enter Schedule Name";
        var SelectChooseFilters="Select Choose Filters";
        var EnterTimeToSend="Enter Time To Send";
        var EnterToMailIds="Enter To Mail Ids";
        var EnterSubject="Enter Subject";
        var SelectDayTo="Select Day To";
        var Areyousuretosave="Are you sure to save ? ";
        function SetAlertMessages(selectreportname, enterScheduleName, selectChooseFilters,enterTimeToSend,enterToMailIds,enterSubject,selectDayTo,areyousuretosave) {
            Selectreportname = selectreportname;
            EnterScheduleName = enterScheduleName;
            SelectChooseFilters = selectChooseFilters;
            EnterTimeToSend = enterTimeToSend;
            EnterToMailIds = enterToMailIds;
            EnterSubject = enterSubject;
            SelectDayTo = selectDayTo;
            Areyousuretosave = areyousuretosave;
        }
        var MaxLength = "Maximum length is ";
        function MaxLengthh(maxLength) {
            MaxLength = maxLength;
        }
        function VaildateFilter() {
            var ReportName = document.getElementById('<%= ddlReportName.ClientID %>');
            if (ReportName.value == 0) {
                alert(Selectreportname);
                return false;
            }
            return true;
        }
        function VaildateMandatory() 
        {
            debugger;
            if (document.getElementById('ctl00_BodyContentPH_txtScheduleName').value.trim() == '') 
            {
                alert(EnterScheduleName);
                document.getElementById('ctl00_BodyContentPH_txtScheduleName').focus();
                return false;
            }
            var e = document.getElementById('<%= ddlReportName.ClientID %>');
            var myValue = e.options[e.selectedIndex].value;        
            if (myValue == '0') 
            {
                alert(Selectreportname);
                document.getElementById('<%= ddlReportName.ClientID %>').focus();
                return false;
            }
            if (myValue != '248' && myValue != '249') 
            {
                if (document.getElementById('ctl00_BodyContentPH_hdnFilters').value.trim() == '') 
                {
                    alert(SelectChooseFilters);
                    document.getElementById('ctl00_BodyContentPH_hdnFilters').focus();
                    return false;
                }
            }
            if(document.getElementById('ctl00_BodyContentPH_rbtnOthers').checked!=true && document.getElementById('ctl00_BodyContentPH_rbtnEmployee').checked!=true && document.getElementById('ctl00_BodyContentPH_rbtnReportingTo').checked!=true)
            {
                alert("Select Any one option in To Whom");
                return false;
            }
            if (document.getElementById('ctl00_BodyContentPH_rbtnOthers').checked!=true) 
            {
                var timeToSend=document.getElementById('<%= ddlTimeOption.ClientID %>');
                    var timeToSendoption=timeToSend.options[timeToSend.selectedIndex].value;
                    if (timeToSendoption == '0')
                    {
                        alert('Select Time To Send Option');
                        document.getElementById('<%= ddlTimeOption.ClientID %>').focus();
                    return false;
                }
            }    
            if (document.getElementById('ctl00_BodyContentPH_rbtnOthers').checked!=true) 
            {
                if (document.getElementById('ctl00_BodyContentPH_txtTimeToSendEmp').value.trim() == '') 
                {
                    alert(EnterTimeToSend);
                    document.getElementById('ctl00_BodyContentPH_txtTimeToSendEmp').focus();
                    return false;
                }
            }
            else
            {
                if (document.getElementById('ctl00_BodyContentPH_txtTimeToSend').value.trim() == '') 
                {
                    alert(EnterTimeToSend);
                    document.getElementById('ctl00_BodyContentPH_txtTimeToSend').focus();
                    return false;
                }
            }
            //if(myValue=='34')
            //{
            if(document.getElementById('ctl00_BodyContentPH_rbtnOthers').checked==true)
            {
                if (document.getElementById('ctl00_BodyContentPH_txtToemailID').value.trim() == '') 
                {            
                    alert(EnterToMailIds);
                    document.getElementById('ctl00_BodyContentPH_txtToemailID').focus();
                    return false;
                }
            }
            //}
            //else
            //{
            //    if (document.getElementById('ctl00_BodyContentPH_txtToemailID').value.trim() == '') 
            //    {            
            //        alert(EnterToMailIds);
            //        document.getElementById('ctl00_BodyContentPH_txtToemailID').focus();
            //        return false;
            //    }
            //}
            var DayFrom = document.getElementById('<%=ddlDayFrom.ClientID %>');
        var DayTo = document.getElementById('<%=ddlDayTo.ClientID %>');
            var Weekly = document.getElementById('<%=rbWeekly.ClientID %>');
            var Monthly = document.getElementById('<%=rbMonthly.ClientID %>');
            var DateFrom = document.getElementById('<%=ddlDateFrom.ClientID %>');
            var DateTo = document.getElementById('<%=ddlDateTo.ClientID %>');
            if (document.getElementById('ctl00_BodyContentPH_txtSubject').value.trim() == '') 
            {
                alert(EnterSubject);
                document.getElementById('ctl00_BodyContentPH_txtSubject').focus();
                return false;
            }
            return confirm(Areyousuretosave);
        }
        function ReportingToControls()
        {
            if (document.getElementById('ctl00_BodyContentPH_chkboxReporting').checked == true) 
            {
                document.getElementById('ctl00_BodyContentPH_txtAfter').disabled =false;
                document.getElementById('ctl00_BodyContentPH_txtAfter').focus();
            }
            else{
                document.getElementById('ctl00_BodyContentPH_txtAfter').disabled =true;
            }
        }
        function numbers_dot(e,ctrl)
        {           
            dec_limit = arguments[1];
            var keycode;
            if (window.event) keycode = window.event.keyCode;
            else if (e) keycode = e.which;
            else return true;		
            if((keycode==8) || (keycode==0)){
                return true;
            } 		
            val = ctrl.value;
            dot_index = val.indexOf('.');
            if(dot_index != -1)
            {
                dec_pts = (val.length - dot_index);
                if(!dec_limit) dec_limit = 3; else dec_limit = dec_limit + 1;
            }
            if(document.selection)
            {
                var selection=document.selection.createRange();
                var selected_text = selection.text;
            }
            else if(document.getSelection)
            { 
                var start = ctrl.selectionStart;
                var end = ctrl.selectionEnd;
                var selected_text = ctrl.value.substring(start, end);
            }		
            if(	(val.length==0 || selected_text != "") && (keycode == 46) )	// || keycode==48
            {
                return false;
            }
            else if(dot_index != -1 && keycode == 46 )
            {
                return false;
            }
            else if(!(keycode>=48 && keycode <=57) && (keycode!=13) && (keycode!=46) && (keycode=36) && (keycode!=8) && (keycode!=0))
            {
                return false;
            }
            else return true;
        }
    </script>
</asp:Content>
