//test.htm
var mySuperData = ''; //产生的大量数据
var optiondata = new Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "A1", "B1", "C1", "D1"); //索引对应英文字母数组
var questNum = 0; //题序号
var b_lt, b_t, b_rt, b_l, b_r, b_lb, b_b, b_rb;
b_lt = "box_lt";
b_t = "box_t";
b_rt = "box_rt";
b_l = "box_l";
b_r = "box_r";
b_lb = "box_lb";
b_b = "box_b";
b_rb = "box_rb";
var n_lt, n_t, n_rt, n_l, n_r, n_lb, n_b, n_rb;
n_lt = "box_lt_none";
n_t = "box_t_none";
n_rt = "box_rt_none";
n_l = "box_l_none";
n_r = "box_r_none";
n_lb = "box_lb_none";
n_b = "box_b_none";
n_rb = "box_rb_none";

function onOver(obj) {
    $("td[bid=" + b_lt + "]", obj).attr("class", b_lt);
    $("td[bid=" + b_t + "]", obj).attr("class", b_t);
    $("td[bid=" + b_rt + "]", obj).attr("class", b_rt);
    $("td[bid=" + b_l + "]", obj).attr("class", b_l);
    $("td[bid=" + b_r + "]", obj).attr("class", b_r);
    $("td[bid=" + b_lb + "]", obj).attr("class", b_lb);
    $("td[bid=" + b_b + "]", obj).attr("class", b_b);
    $("td[bid=" + b_rb + "]", obj).attr("class", b_rb);
    $(".toolbar", obj).show();
}
function onOut(obj) {
    $("td[bid=" + b_lt + "]", obj).attr("class", n_lt);
    $("td[bid=" + b_t + "]", obj).attr("class", n_t);
    $("td[bid=" + b_rt + "]", obj).attr("class", n_rt);
    $("td[bid=" + b_l + "]", obj).attr("class", n_l);
    $("td[bid=" + b_r + "]", obj).attr("class", n_r);
    $("td[bid=" + b_lb + "]", obj).attr("class", n_l);
    $("td[bid=" + b_b + "]", obj).attr("class", n_b);
    $("td[bid=" + b_rb + "]", obj).attr("class", n_rb);
    $(".toolbar", obj).hide();

}


//设置字号
function setfontSize(size) {
    $(".TestBody,td,th").css("font-size", size);
}

//设置字体
function SetFontFamily(fontname) {
    $(".TestBody,td,th").css("font-family", fontname);
}

//设置背景色
function SetBackGroundColor(color) {
    $("body").css("background-color", color);
}
//显示/隐藏答案
function ShowAnswer(ID) {
    if ($("#ID_" + ID + "_Answer").css("display") == "none") {
        $("#ID_" + ID + "_Answer").css("display", "block");
        $("#Knowid_" + ID).html("隐藏答案");
    } else {
        $("#ID_" + ID + "_Answer").css("display", "none");
        $("#Knowid_" + ID).html("显示答案");
    }
}

//收藏/取消收藏
function ShouCang(ID) {
    var typetemp = 1; //1收藏本题,0取消收藏
    if ($("#itembox_" + ID).hasClass("testborder3")) {
        $("#itembox_" + ID).attr("class", "testbox");
        $("#ID_" + ID + "_NoChildTable_FavButton").html("收藏本题");
        typetemp = 0;
    } else {
        $("#itembox_" + ID).attr("class", "testbox testborder3");
        $("#ID_" + ID + "_NoChildTable_FavButton").html("取消收藏");
        typetemp = 1;
    }
    location = '#triggerExEvent:*ID=' + ID + "#Type=shoucang#isHave=" + typetemp;
}


//笔记事件处理
function BijiEvent(ID, record) {
    var islook = 1; //1添加，0查看
    if ($("#UserNote_" + ID).text() == "查看笔记") {
        islook = 0;
    }
    location = '#triggerExEvent:*ID=' + ID + "#Type=biji#isLook=" + islook;
}

//27开始答题
function ActionStart(ID) {
    location = '#triggerExEvent:*ID=' + ID + "#Type=ActionStart#isFanKui=0";
}

//从客户端传值过来表示是否笔记框为空，然后改变button的文字
function IsBiJiNull(ID, result) {
    if (result == 0) {
        $("#UserNote_" + ID).text("添加笔记");
    } else {
        $("#UserNote_" + ID).text("查看笔记");
    }
}

//错题反馈事件处理
function CuoTiEven(ID) {
    location = '#triggerExEvent:*ID=' + ID + "#Type=CuoTiFanKui#isFanKui=0";
}

//重新答题
function ReRead() {
    //select下拉框
    $(".ATest input,.TestContent textarea,select").each(function (k, v) {
        $(v).attr("disabled", false);
    });

    //把答案去掉
    $(".ATest input:checkbox,.ATest input:radio").removeAttr("checked");
    $(".TestContent textarea").val("");
    $("select option:first").prop("selected", "selected"); //默认选中第一个


    AllDisplay("none");

    $(".questionItem").each(function (k, v) {
        var ID = $(v).attr("questionID");
        var questtype = $(v).attr("questtype");
        if (questtype == '1' || questtype == '2' || questtype == '3') {
            $("#ID_" + ID + "_NoChildTable_0_1_Color").css("color", "black");
        } else if (questtype == '12') {
            $("#ID_" + ID + "_NoChildTable_0_1_Color").css("color", "black");
        } else if (questtype == "11") {
            $(v).find("select").each(function (w, q) {
                var sonIDtemp = $(q).parent().attr("sonQuestionID");
                $("#itemBodyTD" + sonIDtemp).css("color", "black");
            });
        } else if (questtype == "9") {
            $(v).find(".TestContent").each(function (w, q) {
                var sonIDtemp = $(q).attr("questid");
                $("#itemBodyTD" + sonIDtemp).css("color", "black");
            });
        }
    });



}

//批阅（比较是用abcd，不是用option的ID）
function PiYue(isWX) {
    //所有的控件失效
    $(".ATest input,.TestContent textarea,select").each(function (k, v) {
        $(v).attr("disabled", "disabled");
    });

    //获取作答情况（为做答的也要记录，考试的时候用到）
    var strjson = "["; //IsDo 1已作答 0否   AnsROrW 1答对，0否  Answer用户作答答案
    var strjsonTemp = ""; //中间的字符串
    $(".questionItem").each(function (k, v) {
        var ID = $(v).attr("questionID");
        var questtype = $(v).attr("questtype");
        var tempAnswer = "";
        if (questtype == '1' || questtype == '2' || questtype == '3') {
            $(v).find("input").each(function (w, q) {
                if ($(q).attr("checked")) {
                    tempAnswer += $(q).val();
                }
            });
            if (tempAnswer != "") {
                AnswerTemp = $("#AnswerSpanABC" + ID).html(); //如ABC
                var tempI = 0;
                var AnswerStr = "";
                var dataArray = tempAnswer.toString().split(''); //用户选择项
                for (var i = 0; i < dataArray.length; i++) {
                    if (AnswerTemp.indexOf(dataArray[i]) != -1) {
                        tempI++;
                    }
                }

                var AnswerTempData = AnswerTemp.toString().split('');
                if (tempI == AnswerTempData.length && dataArray.length == AnswerTempData.length) {
                    AnswerStr = "1"; //答对了
                    $("#ID_" + ID + "_NoChildTable_0_1_Color").css("color", "green");
                } else {
                    AnswerStr = "2"; //答错了
                    $("#ID_" + ID + "_NoChildTable_0_1_Color").css("color", "red");
                }
                strjsonTemp += "{'type':'" + questtype + "','ID':'" + ID + "','IsDo':'1','AnsROrW':'" + AnswerStr + "','Answer':'" + tempAnswer + "'},";
            } else {
                strjsonTemp += "{'type':'" + questtype + "','ID':'" + ID + "','IsDo':'0','AnsROrW':'2','Answer':''},";
            }
        } else if (questtype == '12') {
            $(v).find("textarea").each(function (w, q) {
                if ($(q).val() != "") {
                    tempAnswer = $(q).val();
                    tempAnswer = ReplaceToCode(tempAnswer);
                    $("#ID_" + ID + "_NoChildTable_0_1_Color").css("color", "red");
                    strjsonTemp += "{'type':'" + questtype + "','ID':'" + ID + "','IsDo':'1','AnsROrW':'2','Answer':'" + tempAnswer + "'},";
                } else {
                    strjsonTemp += "{'type':'" + questtype + "','ID':'" + ID + "','IsDo':'0','AnsROrW':'2','Answer':''},";
                }
            });
        } else if (questtype == "11") {
            $(v).find("select").each(function (w, q) {
                if ($(q).val() != "0") {
                    tempAnswer = $(q).val();
                    var sonanswer = "";
                    var sonIDtemp = $(q).parent().attr("sonQuestionID");
                    if ($(q).parent().attr("OKAnswer") == tempAnswer) {
                        sonanswer = "1";
                        $("#itemBodyTD" + sonIDtemp).css("color", "green");
                    } else {
                        sonanswer = "2";
                        $("#itemBodyTD" + sonIDtemp).css("color", "red");
                    }
                    strjsonTemp += "{'type':'" + questtype + "','ID':'" + sonIDtemp + "','IsDo':'1','AnsROrW':'" + sonanswer + "','Answer':'" + tempAnswer + "'},";
                } else {
                    strjsonTemp += "{'type':'" + questtype + "','ID':'" + sonIDtemp + "','IsDo':'0','AnsROrW':'2','Answer':''},";
                }

            });
        } else if (questtype == "27") {
            $(v).find(".TestContent").each(function (w, q) {
                tempAnswer = "";
                $(q).find("input").each(function (z, x) {
                    if ($(x).attr("checked")) {
                        tempAnswer += $(x).val();
                    }
                });

                var sonquesttype = $(q).attr("sonquesttype");
                var sonIDtemp = $(q).attr("questid");
                if (tempAnswer != "") {
                    var tempI = 0;
                    var sonOkAnswer = $(q).attr("okanswer"); //正确答案
                    var dataArray = tempAnswer.toString().split(''); //用户选择项
                    var yesorNo = "no";
                    for (var i = 0; i < dataArray.length; i++) {
                        if (sonOkAnswer.indexOf(dataArray[i]) >= 0) {
                            tempI++;
                        }
                    }
                    var sonOkAnswerData = sonOkAnswer.toString().split('');
                    if (sonOkAnswerData.length == tempI && sonOkAnswerData.length == dataArray.length) {
                        yesorNo = "yes";
                    }

                    var AnswerStr = ""; //记录是否答对
                    if (yesorNo == "yes") {
                        AnswerStr = "1"; //答对了
                        $("#itemBodyTD" + sonIDtemp).css("color", "green");
                    } else {
                        AnswerStr = "2"; //答错了
                        $("#itemBodyTD" + sonIDtemp).css("color", "red");
                    }
                    strjsonTemp += "{'type':'" + sonquesttype + "','ID':'" + sonIDtemp + "','IsDo':'1','AnsROrW':'" + AnswerStr + "','Answer':'" + tempAnswer + "'},";
                } else {
                    strjsonTemp += "{'type':'" + sonquesttype + "','ID':'" + sonIDtemp + "','IsDo':'0','AnsROrW':'2','Answer':''},";
                }
            });
        } else if (questtype == "9" || questtype == "28") {
            $(v).find(".TestContent").each(function (w, q) {
                tempAnswer = ""; //清空用户的作答答案

                var sonquesttype = $(q).attr("sonquesttype");
                var sonIDtemp = $(q).attr("questid");
                var sonOkAnswer = $(q).attr("okanswer"); //正确答案
                var AnswerStr = "2"; //记录是否答对 1对 2错
                if (sonquesttype == "29" || sonquesttype == "30") {
                    var AnswerMode = $(q).attr("mode"); //答案判断模式
                    if (sonquesttype == "29") {
                        tempAnswer = $(q).find(".AccountOneValue").val();
                        if (tempAnswer != "") {
                            if (sonOkAnswer == tempAnswer) {
                                AnswerStr = "1";
                                $("#itemBodyTD2" + sonIDtemp).css("color", "green");
                            } else {
                                AnswerStr = "2";
                                $("#itemBodyTD2" + sonIDtemp).css("color", "red");
                            }
                        }
                    } else if (sonquesttype == "30") {
                        var sonAnswerData = sonOkAnswer.split('*'); //正确答案

                        $(q).find(".account_item_9").each(function (a, b) {
                            if ($(b).find(".ddlOne").val() != "" || $(b).find(".ddlTwo").val() != "" || $(b).find(".AccountValue").val() != "") {
                                tempAnswer += $(b).find(".ddlOne").val() + "," + $(b).find(".ddlTwo").val() + "," + $(b).find(".AccountValue").val() + "*";
                            }
                        });

                        //已答
                        if (tempAnswer != "") {
                            tempAnswer = tempAnswer.substring(0, tempAnswer.length - 1);//去掉最后的*


                            var myAnswerData = tempAnswer.split("*"); //我的答案

                            if (AnswerMode == 1) {
                                //答案数量一致
                                if (myAnswerData.length == sonAnswerData.length) {
                                    var valueIsTureLen = 0; //判断值一致
                                    for (var j = 0; j < myAnswerData.length; j++) {
                                        var mySonAnswerData = myAnswerData[j].split(',');
                                        for (var a = 0; a < sonAnswerData.length; a++) {
                                            var sonAnswerDataSplit = sonAnswerData[a].split(',');
                                            if (sonAnswerDataSplit[0] == mySonAnswerData[0] && sonAnswerDataSplit[1] == mySonAnswerData[1] && sonAnswerDataSplit[2] == mySonAnswerData[2]) {
                                                valueIsTureLen++;
                                                break;
                                            }
                                        }
                                    }



                                    //方向
                                    var towrdLen = 0;
                                    var towardIndex = ""; //借的索引确定了也就可以确定了答案
                                    for (var a = 0; a < sonAnswerData.length; a++) {
                                        var sonAnswerDataSplit = sonAnswerData[a].split(',');
                                        if (sonAnswerData[0] == "借") {
                                            towardIndex = a + ",";
                                        }
                                    }


                                    var indexdata = towardIndex.split(',');
                                    if (towardIndex != "") {
                                        towardIndex = towardIndex.substring(0, towardIndex.length - 1);
                                    }

                                    for (var v = 0; v < indexdata.length; v++) {
                                        for (var j = 0; j < myAnswerData.length; j++) {
                                            if (indexdata[v] == j) {
                                                var mySonAnswerData = myAnswerData[j].split(',');
                                                if (mySonAnswerData[0] == "借") {
                                                    towrdLen++;
                                                    break;
                                                }
                                            }
                                        }
                                    }


                                    //值&方向一致
                                    if (valueIsTureLen == sonAnswerData.length && towrdLen == indexdata.length) {
                                        AnswerStr = "1";
                                        $("#itemBodyTD2" + sonIDtemp).css("color", "green");
                                    } else {
                                        AnswerStr = "2";
                                        $("#itemBodyTD2" + sonIDtemp).css("color", "red");
                                    }
                                } else if (myAnswerData.length > 0 && myAnswerData.length < sonAnswerData.length) {
                                    //答了至少一个
                                    AnswerStr = "2";
                                    $("#itemBodyTD2" + sonIDtemp).css("color", "red");
                                }
                            } else {
                                if (myAnswerData.length == sonAnswerData.length) {
                                    var isOKTemp = 0; //匹配正确的选项数量(all true is true)
                                    for (var a = 0; a < sonAnswerData.length; a++) {
                                        var sonAnswerData = sonAnswerData[a].split(',');
                                        var mySonAnswerData = myAnswerData[a].split(',');
                                        if (sonAnswerData[0] == mySonAnswerData[0] && sonAnswerData[1] == mySonAnswerData[1] && sonAnswerData[2] == mySonAnswerData[2]) {
                                            isOKTemp++;
                                        }
                                    }
                                    if (isOKTemp == sonAnswerData.length) {
                                        AnswerStr = "1";
                                    }
                                }
                            }
                        }
                    }
                    if (tempAnswer != "") {
                        strjsonTemp += "{'type':'" + sonquesttype + "','ID':'" + sonIDtemp + "','IsDo':'1','AnsROrW':'" + AnswerStr + "','Answer':'" + tempAnswer + "'},";
                    } else {
                        strjsonTemp += "{'type':'" + sonquesttype + "','ID':'" + sonIDtemp + "','IsDo':'0','AnsROrW':'2','Answer':''},";
                    }
                } else if (sonquesttype == '1' || sonquesttype == '2' || sonquesttype == '3') {
                    $(q).find("input").each(function (o, p) {
                        if ($(p).attr("checked")) {
                            tempAnswer += $(p).val();
                        }
                    });

                    if (tempAnswer != "") {
                        var tempI = 0;
                        var AnswerStr = "";
                        var dataArray = tempAnswer.toString().split(''); //用户选择项
                        for (var i = 0; i < dataArray.length; i++) {
                            if (sonOkAnswer.indexOf(dataArray[i]) != -1) {
                                tempI++;
                            }
                        }

                        var AnswerTempData = sonOkAnswer.toString().split(''); //正确答案
                        if (tempI == AnswerTempData.length && dataArray.length == AnswerTempData.length) {
                            AnswerStr = "1"; //答对了
                            $("#itemBodyTD" + sonIDtemp).css("color", "green");
                        } else {
                            AnswerStr = "2"; //答错了
                            $("#itemBodyTD" + sonIDtemp).css("color", "red");
                        }
                        strjsonTemp += "{'type':'" + sonquesttype + "','ID':'" + sonIDtemp + "','IsDo':'1','AnsROrW':'" + AnswerStr + "','Answer':'" + tempAnswer + "'},";
                    } else {
                        strjsonTemp += "{'type':'" + sonquesttype + "','ID':'" + sonIDtemp + "','IsDo':'0','AnsROrW':'2','Answer':''},";
                    }
                }
            });
        }
    });

    if (strjsonTemp != "") {
        strjsonTemp = strjsonTemp.substr(0, strjsonTemp.length - 1);
        strjson += strjsonTemp;
    }
    strjson += "]";
    AllDisplay("block");

    if (isWX != '1') {
        mySuperData = strjson;
        location = '#triggerExEvent:*ID=a#Type=piyue#json='; //已答的题
    }
}



//全部显示和隐藏处理
function AllDisplay(type) {
    if (type == "block") {
        $(".ATest").each(function (k, v) {
            $(v).find(".KnowTest").find("span").html("隐藏答案");
            $(v).find(".InfoArea").show();
        });
    } else {
        $(".ATest").each(function (k, v) {
            $(v).find(".KnowTest").find("span").html("显示答案");
            $(v).find(".InfoArea").hide();
        });
    }
}


//跳转到题目
function locationGo(ID) {
    location.hash = 'itemBody' + ID;
}
//跳转到题干
function locationBIDGo(BID) {
    location.hash = 'bigQuestion' + BID;
}


function Load(dataParent, isWX) {
    questNum = 0; //题号，子题和复合题的步长不一样。
    var htmlItemBoxStr = "";
    $("body").append("<div style='display:none'>" + AccountingConf + "</div>"); //插入select控件用来绑定名称
    //var NameItems="";
    for (var w = 0; w < dataParent.length; w++) {
        //大题 Start
        var bidDescription = ""; //题干描述
        if (dataParent[w].Desc != "") {
            bidDescription = "：" + dataParent[w].Desc;
        }
        htmlItemBoxStr += "<div class='ATest' ><center><div class='bigQuetion' id='bigQuestion" + dataParent[w].BID + "'>" + dataParent[w].TypeName + bidDescription + "</div>";
        for (var i = 0; i < dataParent[w].List.length; i++) {
            questNum++;
            if (dataParent[w].List[i].TypeNo == "1" || dataParent[w].List[i].TypeNo == "2" || dataParent[w].List[i].TypeNo == "3" || dataParent[w].List[i].TypeNo == "12") {
                //单题
                htmlItemBoxStr += loadType12312(dataParent[w].List[i], questNum);
            } else if (dataParent[w].List[i].TypeNo == "9" || dataParent[w].List[i].TypeNo == "28") {
                //公用题干以及计算分析题
                htmlItemBoxStr += loadType9(dataParent[w].List[i], questNum);
            } else if (dataParent[w].List[i].TypeNo == "11") {
                //公用选项
                htmlItemBoxStr += loadType11(dataParent[w].List[i], questNum);
            } else if (dataParent[w].List[i].TypeNo == "27") {
                htmlItemBoxStr += loadType27(dataParent[w].List[i], questNum);
            }
        }
        htmlItemBoxStr += "</div></center>";
        //大题 End
    }

    $("#zoom").html(htmlItemBoxStr);
    $("img").removeAttr("title"); //去掉图片的title

    if (isWX == '1') {
        PiYue(isWX);
    }

    //计算分析题-会计分录<添加、删除>
    $(".AcountAdd").live("click", function () {
        var temp_obj = $(this).parent().parent().parent();
        $(temp_obj).append("<div class='account_item_9' style='margin-bottom:5px;'>" + AccountingConf + "</div>");
    });

    $(".AcountDelete").live("click", function () {
        var temp_obj = $(this).parent().parent().parent();
        var totalTemp = $(temp_obj).find(".account_item_9").length;
        var parentObj = $(this).parent().parent();
        if (totalTemp > 1) {
            $(parentObj).remove();
        }

        //重新判断答案是否已选
        AccountFun($(temp_obj).find(".account_item_9").eq(0).parent()); //不知道是不是因为remove了，直接用parentObj不行
    });

    //现在在答的题Start
    $(".TestContent input[type='checkbox'],.TestContent input[type='radio']").click(function () {
        var ID = $(this).parent().parent().attr("questID");
        var isAnswer = "1"; //radio 的时候点击即为选中
        if ($(this).attr("type") == "checkbox") {
            var checkNumber = 0;
            //独立题复选框
            $("#itemBody" + ID + " input").each(function (k, v) {
                if ($(v).attr("checked")) {
                    checkNumber++;
                    return false;
                }
            });

            //子题checkbox
            $("#sonquestItem" + ID + " input").each(function (k, v) {
                if ($(v).attr("checked")) {
                    checkNumber++;
                    return false;
                }
            });

            if (checkNumber == 0) {
                isAnswer = "0";
            }
        }
        location = '#triggerExEvent:*ID=' + ID + "#Type=NowAnswer#isAnswer=" + isAnswer;
    });

    //下拉框
    $(".selectQues select").change(function () {
        var ID = $(this).parent().parent().attr("questID");
        var isAnswer = "1";
        if ($(this).val() == "0") {
            isAnswer = "0";
        }
        location = '#triggerExEvent:*ID=' + ID + "#Type=NowAnswer#isAnswer=" + isAnswer;
    });

    $(".TestContent textarea").keyup(function () {
        var ID = $(this).parent().parent().attr("questID");
        var isAnswer = "1";
        var wordlength = $(this).val().toString().length;
        if (wordlength == 0) {
            isAnswer = "0";
        } else {
            wordlength = "1";
        }

        if (wordlength <= 1) {
            location = '#triggerExEvent:*ID=' + ID + "#Type=NowAnswer#isAnswer=" + isAnswer;
        }
    });

    //计算分析题-填空题
    $(".sonquestionItem .AccountOneValue").keyup(function () {
        var ID = $(this).parent().parent().parent().attr("questID");
        var isAnswer = "1";
        var wordlength = $(this).val().toString().length;
        if (wordlength == 0) {
            isAnswer = "0";
        } else {
            wordlength = "1";
        }

        if (wordlength <= 1) {
            location = '#triggerExEvent:*ID=' + ID + "#Type=NowAnswer#isAnswer=" + isAnswer;
        }
    });

    //计算分析题-会计分录-填空题
    $(".sonquestionItem .AccountValue").live("keyup", function () {
        var parentObj = $(this).parent().parent();
        AccountFun(parentObj);
    });

    //计算分析题-会计分录-选项
    $(".sonquestionItem .ddlOne,.sonquestionItem .ddlTwo").live("change", function () {
        var parentObj = $(this).parent().parent();
        AccountFun(parentObj);
    });
    //现在在答的题End
}

//计算分析题填空题和会计分录是否已做处理
function AccountFun(parentObj) {
    var ID = $(parentObj).parent().attr("questID");
    var isAnswer = "0";
    var wordlength = 1; //长度用来判断当输入多个的时候不重复发送
    $(parentObj).find(".ddlOne").each(function (k, v) {
        if ($(v).val() != "") {
            isAnswer = "1";
            return false;
        }
    });

    if (isAnswer != "1") {
        $(parentObj).find(".ddlTwo").each(function (k, v) {
            if ($(v).val() != "") {
                isAnswer = "1";
                return false;
            }
        });
    }

    if (isAnswer != "1") {
        $(parentObj).find(".AccountValue").each(function (k, v) {
            wordlength = $(v).val().toString().length;
            if (wordlength > 0) {
                isAnswer = "1";
                return false;
            }
        });
    }

    if (wordlength <= 1) {
        location = '#triggerExEvent:*ID=' + ID + "#Type=NowAnswer#isAnswer=" + isAnswer;
    }
}

//替换特殊符号
function ReplaceCode(code) {
    if (code != null || code != undefined) {
        return code.toString().replace(new RegExp("\\(qiuzhikejiA\\)", "gm"), "\'").replace(new RegExp("\\(qiuzhikejiB\\)", "gm"), "\"").replace(new RegExp("src=\"/", "gm"), "src=\"").replace(new RegExp("qiuzhi0001", "gm"), "\r").replace(new RegExp("qiuzhi002", "gm"), "\n");
    }
}

function ReplaceToCode(code) {
    if (code != null || code != undefined) {
        return code.toString().replace(new RegExp("\'", "gm"), "(qiuzhikejiA)").replace(new RegExp("\"", "gm"), "(qiuzhikejiB)");
    }
}



