context: function checkAnswers(interrupted){	var tmpScore = 0;	var status = 'not attempted';	for(var i=0; i<questions.length;i++)	{		if(questions[i]){			var idQuestion = questions[i];			var type = questions_types[idQuestion];			var interactionScore = 0;			var interactionAnswers = '';			var interactionCorrectResponses = '';			if (type == 'mcma')			{				var myScore = 0;				for(var j=0; j<questions_answers[idQuestion].length;j++)				{					var idAnswer = questions_answers[idQuestion][j];					var answer = document.getElementById('question_'+(idQuestion)+'_multiple_'+(idAnswer));					if(answer.checked == true)					{						interactionAnswers += idAnswer+',';						for(k=0;k<questions_answers_correct[idQuestion].length;k++)						{							if(questions_answers_correct[idQuestion][k] == idAnswer)							{								myScore ++;							}						}					}				}				interactionScore = myScore;				//correct responses work by pattern, see SCORM Runtime Env Doc				//for(k=0;k<questions_answers_correct[idQuestion].length;k++)				//{				//	interactionCorrectResponses += questions_answers_correct[idQuestion][k].toString()+',';				//}			}			else if(type == 'mcua')			{				var myScore = 0;				for(var j=0; j<questions_answers[idQuestion].length;j++)				{					var idAnswer = questions_answers[idQuestion][j];					var answer = document.getElementById('question_'+(idQuestion)+'_unique_'+(idAnswer));					if(answer.checked == true)					{						interactionAnswers += idAnswer;						if(questions_answers_correct[idQuestion] == idAnswer)						{							myScore ++;						}					}				}				interactionScore = myScore;				//correct responses work by pattern, see SCORM Runtime Env Doc				//interactionCorrectResponses += questions_answers_correct[idQuestion].toString();			}			else if(type == 'tf')			{				var myScore = 0;				for(var j=0; j<questions_answers[idQuestion].length;j++)				{					var idAnswer = questions_answers[idQuestion][j];					var answer = document.getElementById('question_'+(idQuestion)+'_tf_'+(idAnswer));					if(answer.checked.value == true)					{						interactionAnswers += idAnswer;						for(k=0;k<questions_answers_correct[idQuestion].length;k++)						{							if(questions_answers_correct[idQuestion][k] == idAnswer)							{								myScore ++;							}						}					}				}				interactionScore = myScore;				//correct responses work by pattern, see SCORM Runtime Env Doc				//interactionCorrectResponses += questions_answers_correct[idQuestion].toString();			}			else if(type == 'fib')			{				var myScore = 0;				for(var j=0; j<questions_answers[idQuestion].length;j++)				{					var idAnswer = questions_answers[idQuestion][j];					var answer = document.getElementById('question_'+(idQuestion)+'_fib_'+(idAnswer));					if(answer.value)					{						interactionAnswers += answer.value+',';						for(k=0;k<questions_answers_correct[idQuestion].length;k++)						{							if(questions_answers_correct[idQuestion][k] == answer.value)							{								myScore ++;							}						}					}				}				interactionScore = myScore;				//correct responses work by pattern, see SCORM Runtime Env Doc				//for(k=0;k<questions_answers_correct[idQuestion].length;k++)				//{				//	interactionCorrectResponses += questions_answers_correct[idQuestion][k].toString()+',';				//}			}			else if(type == 'matching')			{				var myScore = 0;				for(var j=0; j<questions_answers[idQuestion].length;j++)				{					var idAnswer = questions_answers[idQuestion][j];					var answer = document.getElementById('question_'+(idQuestion)+'_matching_'+(idAnswer));					if(answer && answer.value)					{						interactionAnswers += answer.value+',';						for(k=0;k<questions_answers_correct[idQuestion].length;k++)						{							var left = questions_answers_correct[idQuestion][k][0];							var right = questions_answers_correct[idQuestion][k][1];							if(left == idAnswer && right == answer.value)							{								myScore ++;							}						}					}				}				//correct responses work by pattern, see SCORM Runtime Env Doc				//for(k=0;k<questions_answers_correct[idQuestion].length;k++)				//{				//	interactionCorrectResponses += questions_answers_correct[idQuestion][k].toString()+',';				//}			}			else if(type == 'free')			{				interactionScore = 0;				interactionAnswers = document.getElementById('question_'+(idQuestion)+'_free').value;				//correct responses work by pattern, see SCORM Runtime Env Doc				//interactionCorrectResponses += questions_answers_correct[idQuestion].toString();			}			else if(type == 'hotspot')			{				//if(question_score && question_score[idQuestion]){				//	interactionScore = question_score[idQuestion];				//} //else, 0								//interactionAnswers = document.getElementById('question_'+(idQuestion)+'_free').innerHTML;				interactionAnswers = '';				//correct responses work by pattern, see SCORM Runtime Env Doc				//for(k=0;k<questions_answers_correct[idQuestion].length;k++)				//{				//	interactionCorrectResponses += questions_answers_correct[idQuestion][k].toString()+',';				//}			}			else			{				//			}			tmpScore += interactionScore;			doLMSSetValue('cmi.interactions.'+idQuestion+'.id','Q'+idQuestion);			doLMSSetValue('cmi.interactions.'+idQuestion+'.result',interactionScore);			doLMSSetValue('cmi.interactions.'+idQuestion+'.type',type);			doLMSSetValue('cmi.interactions.'+idQuestion+'.student_response',interactionAnswers);			//correct responses work by pattern, see SCORM Runtime Env Doc			//doLMSSetValue('cmi.interactions.'+idQuestion+'.correct_responses',questions_answers_correct[idQuestion]);					//doLMSSetValue('cmi.interactions.'+idQuestion+'.correct_responses',interactionCorrectResponses);				}	}	doLMSSetValue('cmi.core.score.raw',tmpScore);	//get status	var mastery_score = doLMSGetValue('cmi.student_data.mastery_score');	if(mastery_score <= 0)	{		mastery_score = 80;	}	if(tmpScore > mastery_score)	{		status = 'passed';	}	else	{		status = 'failed';	}	doLMSSetValue('cmi.core.lesson_status',status);	if((interrupted==true) && (status != 'completed') && (status != 'passed'))	{		doLMSSetValue('cmi.core.exit','suspended');	}	else	{	}	return false; //do not submit the form}
meta: 7863	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/7863/858db1daee169f25d7ece7a1ad7acb2749ac3198/api_wrapper.js/buggy/main/newscorm/js/api_wrapper.js