<style>
    textarea:focus {
        border: #d5dee9 1px solid;
    }
</style>

<script type="text/javascript" language="javascript">
    function clearInfo(id, content) {
        var text = $('#' + id);
        if (text.val() == content) {
            $('#' + id).val('');
        }
    }

    function showInfo(id, content) {
        var text = $('#' + id);
        if (text.val() == '') {
            $('#' + id).val(content);
        }
    }

    function submit_jours(is_teacher)
    {
//        if(("#stars_value").val() == "0"){
//            if(confirm('是否确定评分为0分?')){}else{return;}
//        }
        if(!is_teacher&&$("#new_form_user_message").val() == ""){alert("您还没有填写评语");return;}
        $('#new_form_user_message').parent().submit();
    }
</script>

<%= form_for('new_form', :remote => true, :method => :post,
             :url => {:controller => 'homework_attach',
                      :action => 'addjours',
                      :homework_id => homework_attach.id,
                      :page => cur_page,
                      :cur_type => cur_type,
                      :is_anonymous_comments => @is_anonymous_comments,
                      :is_teacher => @is_teacher
             }) do |f|%>
    <!-- 打分 -->
    <div class="ping_star" id="star_score">
      <% if  @is_anonymous_comments || @is_teacher %>
          <!-- 学生匿评或者教师评价 -->
          <%= l(:label_work_rating) %>：
          <%= render :partial => 'show_star',:locals => {start_score:m_score} %>
      <% end %>
    </div>
    <div class="cl"></div>
    <!-- 打分js结束 -->

    <% if User.current.logged? %>
        <%= f.text_area 'user_message', :rows => 3, :cols => 65,
                     :style => "resize: none;", :class => 'noline', :placeholder => l(:text_caracters_maximum,:count=>250),
                     :maxlength => 250 %>
        <%= f.text_field :reference_user_id, :style=>"display:none"%>
        <div class="cl"></div>
        <% if  @is_anonymous_comments || @is_teacher %>
            <strong style="float: left;">
              文件：
            </strong>
            <div id="homework_attach_jour_attachment" style="padding-left: 40px;">
              <%= render :partial => 'attachments/form' %>
            </div>
            <div class="cl"></div>
        <% end %>
        <div style="float:right">
          <a href="javascript:" class="ping_sub1" id="jours_submit" onclick="submit_jours(<%= @is_teacher%>);">
            <%= l(:label_confirmation) %>
          </a>
        </div>
    <% else %>
        <div style="font-size: 14px;margin:10px;text-align: center">
          <%= l(:label_user_login_tips) %>
          <%= link_to l(:label_user_login_new), signin_path %>
        </div>
    <% end %>
<% end %>
