<ul class="tabs_list">
  <li class="tab_item02 mr118"> <a title="单选题" class="tab_icon icon_radio" onclick="add_MC();"> 新建单选题 </a> </li>
  <li class="tab_item02 mr118"> <a title="多选题" class=" tab_icon icon_checkbox" onclick="add_MCQ();"> 新建多选题 </a> </li>
  <li class="tab_item02 "> <a title="单行主观" class="tab_icon icon_text" onclick="add_single();"> 新建填空题 </a> </li>
</ul>
<div class="cl"></div>

<script type="text/javascript">
    function add_MC(){
        var forms = $("form.new_exercise_question");
        if($("#polls_head_edit").is(":visible")){
            alert("请先保存测验标题及测验基本信息。");
        }else if(forms.length > 0){
            alert("请先保存正在编辑的题目再新建。");
        } else{
            $("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC', :locals => {:exercise=>exercise}) %>");
            $("#poll_questions_title").focus();
        }
    }

    function add_MCQ(){
        var forms = $("form.new_exercise_question");
        if($("#polls_head_edit").is(":visible")){
            alert("请先保存测验标题及测验基本信息。");
        }else if(forms.length > 0){
            alert("请先保存正在编辑的题目再新建。");
        } else{
            $("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ', :locals => {:exercise=>exercise}) %>");
            $("#poll_questions_title").focus();
        }
    }

    function add_single(){
        var forms = $("form.new_exercise_question");
        if($("#polls_head_edit").is(":visible")){
            alert("请先保存测验标题及测验基本信息。");
        }else if(forms.length > 0){
            alert("请先保存正在编辑的题目再新建。");
        } else{
            $("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single', :locals => {:exercise=>exercise}) %>");
            $("#poll_questions_title").focus();
        }
    }

</script>