<script type="text/javascript">
    $(function(){
        $("#RSide").removeAttr("id");
        $("#homework_page_right").css("min-height",$("#LSide").height()-30);
        $("#Container").css("width","1000px");
    });

    function show_or_hide_info(){
        $("#homeworkInformation").toggle();
        $("#homework_info_hidden").toggle();
        $("#homework_info_show").toggle();
    }

    $(function(){
        /*$("#homework_info_hidden").click(function(){
            $("#homeworkInformation").hide();
            $("#homework_info_hidden").hide();
            $("#homework_info_show").show();
        });
        $("#homework_info_show").click(function(){
            $("#homework_info_show").hide();
            $("#homeworkInformation").show();
            $("#homework_info_hidden").show();
        });*/

        if($("#homework_description").height() > 54) {
            $("#homeworkDetailShow").show();
        }
        $("#homeworkDetailShow").click(function(){
            $("#homeworkDetail").toggleClass("max_h54");
            $("#homeworkDetailShow").hide();
            $("#homeworkDetailHide").show();
        });
        $("#homeworkDetailHide").click(function(){
            $("#homeworkDetail").toggleClass("max_h54");
            $("#homeworkDetailHide").hide();
            $("#homeworkDetailShow").show();
        });
    });

</script>

<div class="homepageRight mt0 ml10">
  <div class="resources" id="homework_page_right">
    <div class="hworkListBanner">
      <div id="menu_r" class="fl">
        <ul class="menu_r">
          <li>
            <a href="javascript:void(0);" class="parent">
              <% @all_exercises.each_with_index do |exercise,index |%>
                  <% if exercise.id == @exercise.id %>
                      <%="测验 #{@all_exercises.count - index}"  %>
                  <% end %>
              <% end%>
            </a>
            <ul>
              <% @all_exercises.each_with_index do |exercise,index |%>
                  <li class="pr10">
                    <%= link_to "测验#{@all_exercises.count - index}：#{exercise.exercise_name}",student_exercise_list_exercise_path(exercise.id,:course_id => @course.id)%>
                    <%#= link_to "第#{@homework_commons.count - index}次作业",student_work_index_path(:homework => homework_common.id)%>
                  </li>
              <% end%>
            </ul>
          </li>
          <!---level1 end--->
        </ul>
        <!---menu_r end--->
      </div>
      <!--div class="hworkInfor"><a href="javascript:void(0);" class="linkBlue">作业信息</a></div-->
      <% if @is_teacher%>
          <div class="fr mt5">
            <ul class="resourcesSelect">
              <li class="resourcesSelected">
                <a href="javascript:void(0);" class="resourcesIcon"></a>
                <ul class="hworkMenu">
                  <li>
                    <%= link_to "导出测验成绩", student_exercise_list_exercise_path(@exercise.id,:course_id => @course.id, :format => 'xls'),:class=>'hworkExport postTypeGrey', :id => "export_student_work"%>
                  </li>
                </ul>
              </li>
            </ul>
          </div>
      <% end%>
      <div class="cl"></div>
    </div>

    <div class="homeworkInfo" id="homeworkInformation">
      <div class="">
        <div class="homepagePostTitle fl hidden m_w460" title="<%= @exercise.exercise_name %>"><%= @exercise.exercise_name %></div>
            <% if @exercise.exercise_status == 1 %>
                <span class="grey_homework_btn_cir ml5">未发布</span>
            <% elsif @exercise.exercise_status == 2 %>
                <span class="green_homework_btn_cir ml5">已发布</span>
            <% elsif @exercise.exercise_status == 3 %>
                <span class="grey_homework_btn_cir ml5">已截止</span>
            <% end%>
        <span class="fr c_grey"> <a href="javascript:void(0);" class="linkGrey2" onclick="show_or_hide_info();" id="homework_info_hidden">[ 隐藏测验信息 ]</a> </span>
        <div class="cl"></div>
        <div class="fontGrey2 db mb5">发布者：<%= @exercise.user.show_name %></div>
        <div class="homeworkDetail upload_img break_word list_style max_h54" id="homeworkDetail">
          <div id="homework_description"><%= @exercise.exercise_description.html_safe %></div>
        </div>
        <div id="homeworkDetailShow" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
        <div id="homeworkDetailHide" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
        <div class="cl"></div>
        <div class="mt5">
          <div class="fontGrey2 db fl">截止时间：<%= format_time @exercise.end_time %></div>
          <% if @exercise.exercise_status == 1 %>
              <div class="fontGrey2 db fl ml10">发布时间：<%= format_time @exercise.publish_time %></div>
          <% end %>
              <% end_time = @exercise.end_time.to_time.to_i %>
              <% if end_time > Time.now.to_i %>
                  <div class="fontGrey2 db fr">提交剩余时间： <span class="c_red"><%= (end_time - Time.now.to_i) / (24*60*60) %></span> 天
                    <span class="c_red"><%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%></span> 小时
                    <span class="c_red"><%= (((end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%></span> 分</div>
              <% else %>
                  <div class="fontGrey2 db fr c_red">提交已截止</div>
              <% end %>
          <div class="cl"></div>
        </div>
      </div>
    </div>

    <div class="hworkListContainer">
      <div class="ctt2">
        <div class="dis" id="homework_student_work_list">
          <%= render :partial => "exercise/student_exercise"%>
        </div>
      </div>
    </div>

    <div class="cl"></div>
  </div>
</div>
<div class="cl"></div>