<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <%--Needed for JavaScript IntelliSense in VS2010--%>
            <%--For VS2008 replace RadScriptManager with ScriptManager--%>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
    </telerik:RadScriptManager>
    <script type="text/javascript">
        //Put your JavaScript code here.
    </script>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <div>
        <telerik:RadDatePicker ID="dateActivation" runat="server" Calendar-DateRangeSeparator=" /"
            Calendar-Height="40px" DateInput-ReadOnly="True" Width="200px">
            <Calendar ID="CalendarStart" runat="server" DayStyle-ForeColor="Black" FocusedDate="1/1/1980 00:00:01 AM"
                OutOfRangeDayStyle-BackColor="#CCCCCC" OutOfRangeDayStyle-ForeColor="#CCCCCC"
                WeekendDayStyle-BackColor="#FF5050" WeekendDayStyle-ForeColor="#CC0000">
            </Calendar>
            <DateInput ID="DateInputStart" runat="server" DateFormat="dd/MM/yyyy">
            </DateInput>
            <ClientEvents OnPopupClosing="PopupClosing" />
        </telerik:RadDatePicker>
        <telerik:RadCodeBlock runat="server">
            <script type="text/javascript">
                function PopupClosing(sender, args)
                {
                    var datePicker = $find("<%= dateActivation.ClientID %>");
                    var SelectedDate = datePicker.get_calendar().get_selectedDates()[0];
                    var SDate = new Date();
                    var selectedDateFromUser = new Date(SelectedDate[0], SelectedDate[1] - 1, SelectedDate[2])
                    if (selectedDateFromUser > SDate)
                    {
                        var chkActive = $get("<%= chkIsActive.ClientID %>");
                        chkActive.checked = false;
                    }
                    else
                    {
                        var chkActive = $get("<%= chkIsActive.ClientID %>");
                        chkActive.checked = true;
                    }
                }
  
            </script>
        </telerik:RadCodeBlock>
        <asp:CheckBox runat="server" ID="chkIsActive" Checked="true" />
    </div>
    </form>
</body>
</html>
