function Assessment105()
{
	this.numAnswers = 0;
	this.shuffled = false;
	this.chosenAnswers = null;
	this.correctAnswers = new Array();
	
	this.type = 105;
	
	return this;	
}

Assessment105.prototype = new BaseAssessmentContent();

// get answers from form and populate chosen answer array
Assessment105.prototype.collect = function( form )
{
	this.chosenAnswers = new Array();
		
	var numItems = eval("NumItems" + this.contentID );
	var numAnswers = eval("NumAnswers" + this.contentID );
    var theAnswer = '';
    var theMatch = '';
	var theMatches = '';
	var isChecked = false;
	
	//alert( "num Items = " + numItems );
	//alert( "num Answers = " + numAnswers );
	
	var shuffleArray = eval("Shuffle" + this.contentID + "Array" );
	
	for (var j=0; j<numItems; j++)
	{
	    for (var c=0; c<numAnswers; c++)
	    {
			isChecked = eval( "form.Answer" + j + this.contentID + "[" + c + "].checked" );
			//alert( "isChecked " + j + ", " + c + " = " + isChecked );
	        if ( isChecked )
	        {
				// this is the ans that they chose - need to get it's original placement
				theNum = eval( "form.Answer" + j + this.contentID + "[" + c + "].value;")
				if ( this.getShuffled() )
				{
					// if it's shuffled, grab it's original spot from the shuffle array
					theAnswer = eval("Shuffle" + this.contentID + "Array[" + (theNum-1) + "]");
					theMatch = (j+1) + "_" + theAnswer;
	            }
	            else
				{
					// if it's not shuffled, then it is in it's original spot
				 	theAnswer = theNum;
					theMatch = (j+1) + "_" + theAnswer;
	            }
	            
				//if (theMatches > '') { theMatches += '~'; }
				// add the Match to the string of matches
	            //theMatches += theMatch;
	            this.chosenAnswers.push( theMatch );
	
	        }
	    }
    }
    
	//alert( "chosen answer length = " + this.chosenAnswers.length );
	
	//for (var i=0; i<this.chosenAnswers.length; i++)
	//	alert( this.chosenAnswers[i] );
	
	return true;
}

Assessment105.prototype.collectPractice = function( form )
{
	return this.collect(form);
}

// compare chosen answers with correct answers and score
Assessment105.prototype.score = function()
{
	var form = this.getFormRef( this.questionNumber );
	this.collect( form );
	
	return this.calculateScore();
}

Assessment105.prototype.calculateScore = function()
{
	
	var tcaScore	= 0;
	var tiaScore	= 0;
	var tqv			= 0;
	
	var match 		= null;
	var theMatch 	= "";
	var matched 	= false;
	
	for ( var i=0; i<this.chosenAnswers.length; i++ )
	{

		//alert( "Checking on match: " + this.chosenAnswers[i] );
		matched = false;
		for ( var j=0; j<this.correctAnswers.length; j++ )
		{
			match = this.correctAnswers[j];
			theMatch = match.getItem() + "_" + match.getAnswer();

			//alert( "Does this match? " + this.chosenAnswers[i] + " - " + theMatch );

			if ( this.chosenAnswers[i] == theMatch )
			{
				matched = true;
				tcaScore += 1;
			}

		}

		if (!matched)
			tiaScore += 1;

	}

	tqv = this.correctAnswers.length;
	
	//alert( "tca score = " + tcaScore );
	//alert( "tia score = " + tiaScore );
	//alert( "tqv = " + tqv );
	
	var score = new AssessmentScore( tcaScore, tiaScore, tqv );
	this.setResult( score.getScore() );
	return score;
}

Assessment105.prototype.getShuffled = function()
{
	return this.shuffled;
}

Assessment105.prototype.setShuffled = function( val )
{
	this.shuffled = val;
}

Assessment105.prototype.getNumAnswers = function()
{
	return this.numAnswers;
}

Assessment105.prototype.setNumAnswers = function( val )
{
	this.numAnswers = val;
}






