var TEST_LINK_NONE = 0;
var TEST_LINK_1 = 1;
var TEST_LINK_2 = 2;
var TEST_LINK_3 = 4;
var TEST_LINK_4 = 8;
var TEST_LINK_ALL = 15;

function Test_Link(params)
{
	Test_Link.superclass.constructor.call(this, params);
}

Rup.extend(Test_Link, Link);

Test_Link.prototype._generateTargetParams = function()
{
    this._targetParams = {
        testId: this._params.testId || 0,
        kursname: this._params.text || ""
    };
}

Test_Link.prototype._generateModes = function()
{
    if( this._params.menuTitle == undefined)
    {
        this._params.menuTitle = 'Режим тестирования:';
    }

    if( this._params.allowModes == undefined)
    {
        this._params.allowModes = TEST_LINK_ALL;
    }

    if( this._params.allowModes & TEST_LINK_1 )
    {
        this._modeTitles.push('Контрольный');
        this._modeVals.push(TEST_LINK_1);
    }
    if( this._params.allowModes & TEST_LINK_2 )
    {
        this._modeTitles.push('Контрольный с подтверждением');
        this._modeVals.push(TEST_LINK_2);
    }
    if( this._params.allowModes & TEST_LINK_3)
    {
        this._modeTitles.push('Тренировочный');
        this._modeVals.push(TEST_LINK_3);
    }
    if( this._params.allowModes & TEST_LINK_4)
    {
        this._modeTitles.push('Учебный');
        this._modeVals.push(TEST_LINK_4);
    }
}

Test_Link.prototype.go = function(mode)
{
	mode = mode || TEST_LINK_NONE;
	
	var iMode = currentTestMode;
	if( mode & TEST_LINK_1 )
	{
		iMode = 0;
	}
	else if( mode & TEST_LINK_2 )
	{
		iMode = 1;
	}
	else if( mode & TEST_LINK_3 )
	{
		iMode = 2;
	}
	else if( mode & TEST_LINK_4 )
	{
		iMode = 3;
	}
	currentTestMode = iMode;
	Rup.app.task.getPredefinedList(this._targetParams.testId, iMode, this._targetParams.kursname );
}