function Task_Module_3( taskXml, panel, link )
{
	Task_Module_3.superclass.constructor.call(this, taskXml, panel, link);
	this._taskType = 3;
}

Rup.extend(Task_Module_3, Task_Module_Abstract);

Task_Module_3.prototype._createVariants = function( data )
{   

	this._params.delimit = data.getAttribute('delimit');
	if (!this._params.delimit) this._params.delimit = '|';
	var oAnswersDiv = this._variantElement;
	oAnswersDiv.id = 'EduVariantDiv';
	
	sContStr = data.getAttribute('content');
	sContStr = sContStr.replace(/(<l)(.*?)\/>/gi,"<span class=\"variant_type_3\" $2></span>");
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	var sout = '';
	var p0 = 0;
	var l = sContStr.length;
	var level = 0;
	for (var i = 0; i <= l; i++)
	{
		var c = sContStr.substr(i, 1);
		if (c == '<') level++;
		else if (c == '>') level--;
		else if ((c == ' ' || c == '' || (i < l-5 && sContStr.substr(i, 6) == '&#160;') || (i < l-6 && sContStr.substr(i, 7) == '&#0160;') ) && !level) {
			sout += '<nobr>' + sContStr.substring(p0, i) + '</nobr>';
			p0 = i;
		}
	}
	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	oAnswersDiv.innerHTML = sout;
	
	var aSpans = oAnswersDiv.getElementsByTagName("span");
	
	for( var i = aSpans.length - 1; 0 <= i ; i-- )
	{
		var oCurSpan = aSpans[i];
		if( oCurSpan.className == "variant_type_3" )
		{
			var oVariant = new Task_Variant_3({
				size: parseInt(oCurSpan.getAttribute('size')||'1')
			});
			
			this._variants.unshift(oVariant);
			
			Rup.replace(oVariant.dom(), oCurSpan, /*oAnswersDiv*/ oCurSpan.parentNode);
		}
	}
}

Task_Module_3.prototype.setAnswer = function(answerXml)
{
	var aAnswer = answerXml.getAttribute("rightanswer").split(this._params.delimit);
	
	for( var i = 0; i < this._variants.length; i++ )
	{
		this._variants[i].setValue(aAnswer[i]);
	}
}

Task_Module_3.prototype._getAnswerString = function()
{
	var aAnswer = [];
	for( var i = 0; i < this._variants.length; i++ )
	{
		aAnswer.push(encodeURIComponent(this._variants[i].getValue()));
	}
	return aAnswer.join("|");
}

Task_Module_3.prototype.compareAnswers = function()
{
	//delimiter = '|';
	/*if (params)
	{
		params = params.split(';');
		for (var j = 0; j < params.length; j++)
		{
			var k = params[j].toLowerCase().indexOf('answerdelimeter=');
			if (k != -1)
			{
				delimiter = params[j].charAt(k+16); break;
			}
		}
	}*/
	var rightCnt = 0;
	var rightanswer = this._params.ranswer.split(this._params.delimit);
	for( var i = 0; i < this._variants.length; i++ )
	{
		var correct = this._variants[i].compareAnswer( (i < rightanswer.length) ? rightanswer[i] : '#' );
		if (correct) rightCnt++;
	}
	var res = new Number(100*rightCnt/this._variants.length);
	return Math.round(res);
}