<%= stylesheet_link_tag  'polls', :media => 'all' %>
<script type="text/javascript">
    function republish_poll(poll_id)
    {
        $('#ajax-modal').html("<div id='popbox02'>" +
            "<div class='upload_con'>" +
                "<div class='upload_box'>" +
                    "<p class='polls_box_p'>取消发布后问卷统计结果将会被清空<br />是否确定取消发布该问卷？</p>" +
                    "<div class='polls_btn_box'>" +
                        "<a href='/poll/"+ poll_id +"/republish_poll' class='upload_btn' onclick='clickCanel();' data-remote='true'>确&nbsp;&nbsp;定</a>" +
                        "<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取&nbsp;&nbsp;消</a>" +
                    "</div>" +
                    "<div class='cl'></div>" +
                "</div>" +
            "</div>" +
        "</div>");
        showModal('ajax-modal', '310px');
        $('#ajax-modal').css('height','120px');
        $('#ajax-modal').siblings().remove();
        $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
            "<a onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
        $('#ajax-modal').parent().removeClass("alert_praise");
        $('#ajax-modal').parent().css("top","").css("left","");
        $('#ajax-modal').parent().addClass("popbox_polls");
    }

    function clickCanel(){hideModal("#popbox02");}

    function poll_submit(poll_id,poll_name)
    {
        if(poll_name == 0)
        {
            alert("问卷标题不能为空");
        }
        else
        {
            $('#ajax-modal').html("<div id='popbox02'>" +
                    "<div class='upload_con'>" +
                    "<div class='upload_box'>" +
                    "<p class='polls_box_p'>问卷发布后将不能对问卷进行修改，<br />是否确定发布该问卷？</p>" +
                    "<div class='polls_btn_box'>" +
                    "<a href='/poll/"+ poll_id +"/publish_poll' class='upload_btn' onclick='clickCanel();' data-remote='true'>确&nbsp;&nbsp;定</a>" +
                    "<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取&nbsp;&nbsp;消</a>" +
                    "</div>" +
                    "<div class='cl'></div>" +
                    "</div>" +
                    "</div>" +
                    "</div>");
            showModal('ajax-modal', '310px');
            $('#ajax-modal').css('height','120px');
            $('#ajax-modal').siblings().remove();
            $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
                    "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
            $('#ajax-modal').parent().removeClass("alert_praise");
            $('#ajax-modal').parent().css("top","").css("left","");
            $('#ajax-modal').parent().addClass("popbox_polls");
        }
    }

    function close_poll(poll_id)
    {
        $('#ajax-modal').html("<div id='popbox02'>" +
                "<div class='upload_con'>" +
                "<div class='upload_box'>" +
                "<p class='polls_box_p'>问卷关闭后学生将不能继续提交问卷，<br />是否确定关闭该问卷？</p>" +
                "<div class='polls_btn_box'>" +
                "<a href='/poll/"+ poll_id +"/close_poll' class='upload_btn' onclick='clickCanel();' data-remote='true'>确&nbsp;&nbsp;定</a>" +
                "<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取&nbsp;&nbsp;消</a>" +
                "</div>" +
                "<div class='cl'></div>" +
                "</div>" +
                "</div>" +
                "</div>");
        showModal('ajax-modal', '310px');
        $('#ajax-modal').css('height','120px');
        $('#ajax-modal').siblings().remove();
        $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
                "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
        $('#ajax-modal').parent().removeClass("alert_praise");
        $('#ajax-modal').parent().css("top","").css("left","");
        $('#ajax-modal').parent().addClass("popbox_polls");
    }

    function closeModal()
    {
        hideModal($("#popbox_upload"));
    }
</script>
<div class="polls_content02" id="polls">
  <%= render :partial => 'poll_list'%>
</div><!--问卷内容end-->