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

<asp:Content ContentPlaceHolderID="BodyContentPH" runat="server">

    <script language="javascript" src="../js/DateTimeValidation.js" type="text/javascript"></script>

    <script language="javascript" type="text/javascript">
        var EnterFromDate = "EnterFromDate";
        var EnterToDate = "Enter To Date";
        var EntertheTitle = "Enter the Title";
        var EntertheDescription = "Enter the Description";
        var AreyousuretoSave = "Are you sure, to Save";
        var SelectanImageFile = "Select an Image File";
        var MaxLength = "Maximum length is ";
        function MaxLengthh(maxLength) {
            MaxLength = maxLength;
        }
        function SetAlertMessages(enterFromDate, enterToDate, entertheTitle, entertheDescription, areyousuretoSave, selectanImageFile) {
            EnterFromDate = enterFromDate;
            EnterToDate = enterToDate;
            EntertheTitle = entertheTitle;
            EntertheDescription = entertheDescription;
            AreyousuretoSave = areyousuretoSave;
            SelectanImageFile = selectanImageFile;
        }

        //values for check date
        var Monthfourdigit = 'Please enter valid date as month, day, and four digit year : Format MM/dd/yyyy.';
        var Datefourdigit = 'Please enter valid date with correct format dd/MM/yyyy';
        var Invalidyearentry = 'Invalid year entry';
        var Invalidmonthentry = 'Invalid month entry';
        var Invaliddateentry = 'Invalid date entry';
        var DateformatDDMONYYYY = 'Incorrect date format. Enter as DD-MON-YYYY';
        var Entertime = 'Enter time';
        var Valueforhours = 'Invalid value for hours:';
        var Invalidvalueforminutes = 'Invalid value for minutes:';
        var Invalidtimeformat = 'Invalid time format:';
        var EntervalidDateandTime = 'Please enter valid Date and Time';
        var ValiddatemonthMMDDYYHHMM = 'Please enter valid Date and Time MM/dd/yyyy HH:mm';
        var ValiddatemonthMMDDYYHHMMTT = 'Please enter valid Date and Time MM/dd/yyyy hh:mm tt';
        var EntervalidDateandTime = 'Please enter valid Date and Time';
        var Invalidvalueforhours = 'Invalid value for hours:';
        var Invalidvalueforminites = 'Invalid value for minutes:';
        function SetAlertCheckDate(monthfourdigit, datefourdigit, invalidyearentry, invalidmonthentry, invaliddateentry, dateformatDDMONYYYY, entertime, valueforhours, invalidvalueforminutes, invalidtimeformat, entervalidDateandTime, validdatemonthMMDDYYHHMM, validdatemonthMMDDYYHHMMTT, entervalidDateandTime, invalidvalueforhours, invalidvalueforminites) {
            Monthfourdigit = monthfourdigit;
            Datefourdigit = datefourdigit;
            Invalidyearentry = invalidyearentry;
            Invalidmonthentry = invalidmonthentry;
            Invaliddateentry = invaliddateentry;
            DateformatDDMONYYYY = dateformatDDMONYYYY;
            Entertime = Entertime;
            Valueforhours = valueforhours;
            Invalidvalueforminutes = invalidvalueforminutes;
            Invalidtimeformat = invalidtimeformat;
            EntervalidDateandTime = entervalidDateandTime;
            ValiddatemonthMMDDYYHHMM = validdatemonthMMDDYYHHMM;
            ValiddatemonthMMDDYYHHMMTT = validdatemonthMMDDYYHHMMTT;
            EntervalidDateandTime = entervalidDateandTime;
            Invalidvalueforhours = invalidvalueforhours;
            Invalidvalueforminites = invalidvalueforminites;
        }
        function ShowMe(val) {

        }
        function ReqFieldValidate() {
            var rangeDemoFormat = document.getElementById('ctl00_BodyContentPH_Hidden1').value;

            if (document.aspnetForm.ctl00_BodyContentPH_rbtnNews.checked == true) {
                if (document.getElementById("ctl00_BodyContentPH_txtDate").value == '') {
                    alert(EnterFromDate);
                    document.getElementById("ctl00_BodyContentPH_txtDate").focus();
                    return false;
                }
                else {
                    var weekDay = document.getElementById("ctl00_BodyContentPH_txtDate");
                    var DateFormat = document.getElementById('ctl00_BodyContentPH_Hidden1').value;
                    if (checkDate(weekDay, DateFormat, Monthfourdigit, Datefourdigit, Invalidyearentry, Invalidmonthentry, Invaliddateentry, DateformatDDMONYYYY, Entertime, Valueforhours, Invalidvalueforminutes, Invalidtimeformat, EntervalidDateandTime, ValiddatemonthMMDDYYHHMM, ValiddatemonthMMDDYYHHMMTT, EntervalidDateandTime, Invalidvalueforhours, Invalidvalueforminites)) {
                    }
                    else {
                        return false;
                    }
                }
                if (document.getElementById("ctl00_BodyContentPH_txtToDate").value == '') {
                    alert(EnterToDate);
                    document.getElementById("ctl00_BodyContentPH_txtToDate").focus();
                    return false;
                }
                else {
                    var weekDay = document.getElementById("ctl00_BodyContentPH_txtToDate");
                    var DateFormat = document.getElementById('ctl00_BodyContentPH_Hidden1').value;
                    if (checkDate(weekDay, DateFormat, Monthfourdigit, Datefourdigit, Invalidyearentry, Invalidmonthentry, Invaliddateentry, DateformatDDMONYYYY, Entertime, Valueforhours, Invalidvalueforminutes, Invalidtimeformat, EntervalidDateandTime, ValiddatemonthMMDDYYHHMM, ValiddatemonthMMDDYYHHMMTT, EntervalidDateandTime, Invalidvalueforhours, Invalidvalueforminites)) {
                    }
                    else {
                        return false;
                    }
                }
                if (document.getElementById("ctl00_BodyContentPH_txtTitle").value == '') {
                    alert(EntertheTitle);
                    document.getElementById("ctl00_BodyContentPH_txtTitle").focus();
                    return false;
                }
                if (document.getElementById("ctl00_BodyContentPH_txtDescription").value == '') {
                    alert(EntertheDescription);
                    document.getElementById("ctl00_BodyContentPH_txtDescription").focus();
                    return false;
                }
                return confirm(AreyousuretoSave);
            }
            if (document.aspnetForm.ctl00_BodyContentPH_rbtnBanner.checked == true) {
                if (document.getElementById("ctl00_BodyContentPH_txtDate").value == '') {
                    alert(EnterFromDate);
                    document.getElementById("ctl00_BodyContentPH_txtDate").focus();
                    return false;
                }
                if (document.getElementById("ctl00_BodyContentPH_txtToDate").value == '') {
                    alert(EnterToDate);
                    document.getElementById("ctl00_BodyContentPH_txtToDate").focus();
                    return false;
                }
                if (document.getElementById("ctl00$ContentPlaceHolder1$fp_Banner").value == '') {
                    alert(SelectanImageFile);
                    return false;
                }
            }
        }
    </script>

    <section class="content-header">
        <h1>
            <asp:Label ID="lbl_Header" runat="server"></asp:Label>
            <asp:HiddenField ID="Hidden1" runat="server" />
        </h1>
        <asp:SiteMapPath ID="site" runat="server" CssClass="breadcrumb">
            <NodeStyle CssClass="active" />
        </asp:SiteMapPath>
    </section>
    <div class="content">
        <div class="inr-ftr">

            <div class="row">
                <div class="col-sm-2">
                </div>
                <div class="col-sm-2 col-sm-offset-8">
                    <div class="pull-right">
                        <h6>

                            <span style="color: Red">|</span><span style="padding-left: 10px; padding-right: 10px">Mandatory
                                    (4 No.)</span>
                            <asp:Label ID="lblError" runat="server"></asp:Label>
                        </h6>
                    </div>
                </div>
                <div class="clearfix">
                </div>
            </div>

        </div>
        <div class="emp-filter">
            <div class="form-horizontal">
                <div class="row">
                    <div class="col-md-12">
                        <div class="row form-group" style="display: none;">
                            <div class="col-md-12">
                                <asp:Label ID="lbl_NewsBanner" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-12">
                                <div class="row form-group">
                                    <div class="col-md-12">
                                        <asp:RadioButton ID="rbtnNews" runat="server" GroupName="News" Checked="true" onclick="ShowMe(1);" />
                                    </div>
                                    <div class="col-md-12">
                                        <asp:RadioButton ID="rbtnBanner" runat="server" Visible="false" GroupName="News"
                                            onclick="ShowMe(2);" Enabled="false" />
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row form-group" style="display:none">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_Position" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-9">
                                <div class="row">
                                    <%--  <div class="col-md-6">--%>
                                    <div class="col-md-4">
                                        <asp:RadioButton ID="rbleftNews" runat="server" Checked="true" GroupName="leftPos"
                                            CssClass="radio radio-primary" />
                                    </div>
                                    <div class="col-md-4">
                                        <asp:RadioButton ID="rbRightNews" runat="server" GroupName="leftPos" CssClass="radio radio-primary" />
                                    </div>
                                    <%--  </div>--%>
                                </div>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_Date" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txtDate" runat="server" CssClass="form-control man-dat"
                                    onCut="return false" onDrop="return false">
                                </asp:TextBox>
                                <asp:CustomValidator ID="CustomValidator1" runat="server" Display="none" EnableClientScript="False"
                                    OnServerValidate="CompareCurrentdate"></asp:CustomValidator>
                                <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True"
                                    ShowSummary="False" />
                            </div>
                        </div>
                        <div class="row  form-group" class="datepicker" style="display: none">
                            <div class="col-md-12">
                                <input runat="server" type="image" src="../Images/dateicon.gif" id="butDate" />
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-2">
                                <asp:Label ID="lblToDate" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txtToDate" runat="server" CssClass="form-control man-dat"
                                    onCut="return false" onDrop="return false">
                                </asp:TextBox>



                                <br />
                                <asp:CustomValidator ID="cus_ComDate" runat="server" Display="none" EnableClientScript="False"
                                    OnServerValidate="CompareDate"></asp:CustomValidator>
                                <asp:CustomValidator ID="CustomValidator2" runat="server" Display="none" EnableClientScript="False"
                                    OnServerValidate="CompareTodate"></asp:CustomValidator>
                            </div>
                        </div>
                        <%-- <div class="row  form-group">
                            
                        </div>--%>
                        <div class="row" class="datepicker" style="display: none">
                            <div class="col-md-12">
                                <input runat="server" type="image" src="../Images/dateicon.gif" id="butToDate" />
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_Active" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:CheckBox ID="cbActive" runat="server" Checked="True" />
                            </div>
                            <div class="col-md-1">
                            </div>
                        </div>
                        <div>
                            <div class="panel-heading">
                                <div class="row  form-group">
                                    <div class="col-md-12" style="display: none;">
                                        <asp:Label ID="lblDivNews" runat="server"></asp:Label>
                                    </div>
                                </div>
                            </div>
                            <div class="panel-body">
                                <div id="divNews" style="display: block">
                                    <div class="row  form-group">
                                        <div class="col-md-2">
                                            <asp:Label ID="lbl_Title" runat="server"></asp:Label>
                                        </div>
                                        <div class="col-md-6">
                                            <asp:TextBox ID="txtTitle" CssClass="form-control man-dat"
                                                runat="server" onkeypress="return chkMaxLen(event,this,100,MaxLength);" MaxLength="100"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtTitle"
                                                Display="None" ErrorMessage="Enter Title"></asp:RequiredFieldValidator>
                                        </div>
                                    </div>
                                    <%--<div class="row">
                                        
                                    </div>--%>
                                    <div class="row  form-group">
                                        <div class="col-md-2">
                                            <asp:Label ID="lbl_Des" runat="server"></asp:Label>
                                        </div>
                                        <div class="col-md-6">
                                            <asp:TextBox ID="txtDescription" CssClass="form-control man-dat"
                                                TextMode="MultiLine" Style="resize: none;" runat="server" onkeypress="return chkMaxLen(event,this,500,MaxLength);"
                                                MaxLength="500"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtDescription"
                                                Display="None" ErrorMessage=""></asp:RequiredFieldValidator>
                                        </div>
                                    </div>
                                </div>
                                <div id="divBanner" runat="server" style="display: none">
                                    <div class="row">
                                        <div class="col-md-12">
                                            <asp:Label ID="lblDivBanner" runat="server"></asp:Label>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12">
                                            <asp:Label ID="lblImage" runat="server"></asp:Label>
                                            <span style="color: #ff0000">*</span>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12">
                                            <asp:FileUpload ID="fp_Banner" runat="server" onkeypress="return key_press_nokey(event)"
                                                onkeydown="return key_press_nokey(event)" ondrop="return false" oncut="return false"
                                                onDelete="return false" />
                                            <%--<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage=""
                                                Display="None" ControlToValidate="fp_Banner"></asp:RequiredFieldValidator>--%>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12">
                                            <asp:Image ID="imgBanner" runat="server" Height="80px" Width="100px" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-8">
                                <div class="pull-right-button">
                                    <asp:LinkButton ID="btn_save" CssClass="btn save-btn fa-floppy-o" runat="server"
                                        OnClick="btn_save_Click" OnClientClick="return ReqFieldValidate();" />
                                    <asp:LinkButton ID="btn_Cancel" CssClass="btn save-btn fa-angle-left" runat="server"
                                        OnClick="btn_Cancel_Click" CausesValidation="False" />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
