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

Rup.extend(Task_Module_4, Task_Module_Abstract);

Task_Module_4.prototype._createVariants = function( data )
{
    var oAnswersDiv = this._variantElement;
    
    var sContentHtml = data.getAttribute('content');
    sContentHtml = sContentHtml.replace(/<w>(.*?)<\/w>/ig, '<span class="WordSpan">$1</span>');
    
    oAnswersDiv.innerHTML = sContentHtml;
    
    var aSpans = oAnswersDiv.getElementsByTagName('span');
    var aWords = new Array();
    for( var i = 0; i < aSpans.length; i++ )
    {
        if( aSpans[i].className == 'WordSpan' )
        {
            aWords.push( aSpans[i] );
        }
    }
    
    for( var i = aWords.length - 1; 0 <= i; i--)
    {
    	var oVariant = new Task_Variant_4({
    		text: aWords[i].innerHTML
    	});
    	this._variants.unshift(oVariant);
    	/*oAnswersDiv*/aWords[i].parentElement.replaceChild(oVariant.dom(), aWords[i]);
    }
}

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

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