/*
 * Copyright (c) 2006 Absolutely Training Limited
 * 
 * Created on 13-Dec-2006
 * 
 * @author roberto
 */

function QuestionSummary( props ) {
	this.questionText = null;
	this.explanation = null;
	this.type = null;
	this.answerChoices = null;
	this.answerSelected = null;
	this.answers = [];
	this.orderNum = 0;
	
	for ( var p in props ) {
		this[p] = props[p];
	}

};
QuestionSummary.prototype = new QuestionSummary();
QuestionSummary.prototype.constructor = QuestionSummary;


QuestionSummary.prototype.getQuestionText= function(){
	return variable = misc_replaceAll(this.questionText,"SC_27","'");
};

QuestionSummary.prototype.getQuestionTextWithoutNumber= function(){
	return variable = misc_replaceAll(this.questionText,"SC_27","'");
};


QuestionSummary.prototype.getExplanation= function(){
	return variable = misc_replaceAll(this.explanation,"SC_27","'");
};

QuestionSummary.prototype.getAnswers= function(){
	return this.answers;
}
QuestionSummary.prototype.getScormHtmlPath= function(){
	return " ";
}
QuestionSummary.prototype.getQuestion= function(){
	return this;
}
QuestionSummary.prototype.getAnswerChoices= function(){

	var letters = ["A", "B", "C", "D","E", "F", "G"];
	var numbers = ["1", "2", "3", "4","5", "6", "7"];


	if (this.type=="ROMAN_NUMERAL")
	{

		var possibleQuestions = new Array();
		var correctAnswerLetter = this.answerChoices.substring(0, 1);
		var answerChoicesString = this.answerChoices.substring(1, this.answerChoices.length-1);

		var choices = answerChoicesString.split("|");

		for (var i = 0; i < choices.length; i++){
			var selected = letters[i]==this.answerSelected;
			var correct = numbers[i]==correctAnswerLetter;
			possibleQuestions[i]= new AnswerSummary( { answerText: choices[i], explanation: null, correct:correct, selected: selected, letter:letters[i]});
		
			//possibleQuestions[i]= new AnswerSummary ({answerText:choices[i], explanation=null, correct=null,selected=selected});
		}

		return possibleQuestions;

	}else{

		return this.answers;
	}

}

QuestionSummary.prototype.getId= function(){
	return "1";
}

QuestionSummary.prototype.getPossibleAnswers= function(){
	return this.answers;
}

QuestionSummary.prototype.getOrderNum = function() {
    return this.orderNum;
};

QuestionSummary.prototype.setOrderNum = function(orderNum) {
    this.orderNum = orderNum;
};