/*
对于多选题，当提交答案时，需要调用改函数来吧所做的选择组成一个字符串，用逗号格开
*/
function Checkbox()
{
	var strchoice="";
	var iCount = 0;
	for(var i=0;i<document.AnswerForm.Answers.length;i++){
		if (document.AnswerForm.Answers[i].checked){
			if(iCount==0)
				strchoice = document.AnswerForm.Answers[i].value;
			else
				strchoice = strchoice + "," + document.AnswerForm.Answers[i].value;
			iCount++;
		}
	}
	document.AnswerForm.Answer.value = strchoice;
}

/*
对于简答题，当提交答案时，需要调用该函数来把答案中的"换成＂
*/
function TextArea()
{
	var re;
	var str = document.AnswerForm.Answer.value;
	re = /"/g;
	str = str.replace(re,"＂");
	re = /'/g;
	str = str.replace(re,"＇");
	document.AnswerForm.Answer.value = str;
	if(document.AnswerForm.Answer.value.length>500){		
		alert("对不起，在线答题答案不能超过500个字(回车算两个字)!");
		document.AnswerForm.Answer.focus();
		return false;
	}
	return true;
}
/*确认是否放弃考试*/
function ConfirmCancel()
{
	if(confirm("你确定要放弃本次考试吗?")){
		window.location.href="../../cancel.php";
	}
}

//整数除
function Div(first,second)
{
	result = first / second;
	result = result + ".";
	result = result.substr(0,result.indexOf(".",0));
	return result;
}

//答题时间结束，自动交卷
function TimeOut()
{
	alert("交卷时间到，不能继续答题!");
	AnswerForm.action = "result.php";
	AnswerForm.submit();
}

