<%@ Page Language="C#" ValidateRequest="false" AutoEventWireup="true" MasterPageFile="~/MasterFile/TimeCheck.master"
    CodeFile="Organization_News.aspx.cs" Inherits="Organization_Settings_Organization_News" %>

<asp:Content 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 language="javascript" src="../js/DateTimeValidation.js" type="text/javascript"></script>

    <script>

        $(function () {
            $('#ctl00_BodyContentPH_txtDate').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value }
            );
        });
        $(function () {
            $('#ctl00_BodyContentPH_txtToDate').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value }
            );
        });
    </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.';
        //Adding this line var Datefourdigit='Please enter valid date with correct format dd/MM/yyyy'; as newly
        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() {
            if (document.aspnetForm.ctl00_BodyContentPH_rbtnNews.checked == true) {
                document.getElementById("divNews").style.display = "block";
                document.getElementById("divBanner").style.display = "none";
            }
            if (document.aspnetForm.ctl00_BodyContentPH_rbtnBanner.checked == true) {
                document.getElementById("divNews").style.display = "none";
                document.getElementById("divBanner").style.display = "block";
            }
            return true;
        }
        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 {
                        weekDay.focus();
                        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 {
                        weekDay.focus();
                        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_BodyContentPH_fp_Banner").value == '') {
                    alert(SelectanImageFile);
                    return false;
                }
            }
        }
    </script>

    <div 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>
    </div>
    <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; visibility: hidden;">
                            <div class="col-md-12">
                                <asp:Label ID="lbl_NewsBanner" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-12">
                                <div class="row">
                                    <div class="col-md-12">
                                        <asp:RadioButton ID="rbtnNews" runat="server" GroupName="News" Checked="true" onclick="ShowMe();" />
                                    </div>
                                    <div class="col-md-12">
                                        <asp:RadioButton ID="rbtnBanner" runat="server" Visible="false" GroupName="News"
                                            onclick="ShowMe();" 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-8">--%>
                                    <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"
                                            Visible="false" />
                                    </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" MaxLength="11">
                                </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">
                            <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" MaxLength="11">
                                </asp:TextBox>

                                <script type="text/javascript">

                                    var rangeDemoFormat = document.getElementById('ctl00_BodyContentPH_Hidden1').value;

                                </script>

                                <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 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>
                        <div>
                            <div class="panel-heading" style="display: none;">
                                <div class="row form-group">
                                    <div class="col-md-12" style="padding-left: 10px;">
                                        <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>
                                        </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>
                                        </div>
                                    </div>
                                    <div class="row">
                                    </div>
                                </div>
                                <div id="divBanner" 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" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="panel-footer">
                            </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>
