<script src="/javascripts/i18n/jquery.ui.datepicker-zh-CN.js" type="text/javascript"></script>
<span class="uploadText mb10" style="margin-top: -20px;">发布设置</span>
  <!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose"></a></div>-->
<%= form_tag(republish_file_course_file_path(@course,@file), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
<div class="mb10">
  <label class="fl c_dark f14" style="margin-top: 4px;">延迟发布：</label>
  <div class="calendar_div fl">
    <input  type="text" name="publish_time" id="attachment_publish_time" placeholder="发布日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%=@file.publish_time %>">
    <%#= calendar_for('attachment_publish_time')%>
  </div>
  <span class="fl c_red" style="margin-top: 4px;" id="publish_time_notice"></span>
  <div class="cl"></div>
</div>
  <!--<div class="mt15"> <span class="f14 fontGrey3 mr10">延迟发布：</span>
    <input type="text" name="" placeholder="请输入0-50数值" class="markInput" />
  </div>-->
  <div>
    <div class="courseSendSubmit"><a href="javascript:void(0);" onclick="submit_republish_file()" class="sendSourceText" id="submit_file">确定</a></div>
    <div class="courseSendCancel"><a href="javascript:void(0);" onclick="hideModal()" class="sendSourceText linkGrey6">取消</a></div>
  </div>
<% end %>
  <div class="cl"></div>
<script>
    function regex_publish_time()
    {
        var myDate = new Date();
        if($.trim($("#attachment_publish_time").val()) == "")
        {
            $("#publish_time_notice").text("发布日期不能为空");
            return false;
        } else{
            var publish_time = Date.parse($("#attachment_publish_time").val());
            if(Date.parse(formate_date(myDate)) > publish_time)
            {
                $("#publish_time_notice").text("发布日期不能小于当前日期");
                return false;
            }
            else
            {
                $("#publish_time_notice").text("");
                return true;
            }
        }
    }
    function submit_republish_file()
    {
        if(regex_publish_time()) {
            $('#submit_file').parent().parent().submit();
        }
    }
    $(function(){
        var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: 0, showOn: 'button', buttonImageOnly: true, buttonImage: '/images/public_icon.png', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true};
        $('#attachment_publish_time').datepicker(datepickerOptions);
    });
</script>