<div class="syllabus_box" id="course-list">
  <h2 class="syllabus_h2_top"><span class="icon_course fl mt7 mr5"></span>课程列表</h2>

  <%= render :partial => 'users/user_syllabus_list'%>
  <div class="" style="height:20px; background:#eaebec;"></div>
  <%= render :partial => 'users/user_join_syllabus_list'%>
</div>


<script type="text/javascript">
    //如果右边的列表比左边的高度低则将右边的高度设为与左边对齐
    $(function() {
        var leftHeight = $("#LSide").height() - $(".fontGrey5").height() - 20;
        var rightHeight = $(".homepageRight").height();
        if (rightHeight < leftHeight) {
            var diffHeight = leftHeight - rightHeight;
            var tmpHeight = $(".syllabus_box").height() + diffHeight;
            $(".syllabus_box").css("minHeight", tmpHeight);
        }
    });
    function expand_courses(id, count){
        var div = $("#syllabus_courses_list_"+id);
        var classNum = div.next().children().children("li").size();
        if(classNum>0){
            div.next().toggle();
            div.children(":first-child").children(":first-child").toggleClass("icons_sy_close").toggleClass("icons_sy_open");
        } else if(count > 0) {
            var str = div.next().children().eq(0).attr('id');
            var id = str.substring(19);
            var user_id = <%= @user.id%>;
            $.get(
                            '/users/'+user_id+'/expand_courses?syllabus_id=' + id
            );
        }
    }
</script>