function Task_Variant_7(config)
{
	Task_Variant_7.superclass.constructor.call(this);
	
	this._setBaseElement(Rup.create("span"));
	
	this._baseElement.innerHTML = config.text;
	Rup.css.add(this._baseElement, 'Active');
	
	this._module = config.module;
	
	this._shadowVariant = new Task_Variant_7_Shadow({
		text: config.text,
		variant: this,
		module: config.module
	});
	
	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	this._correctedShadowVariant = new Task_Variant_7_Shadow({
		text: '<span class="groupingCorrectedInner">' + config.text + '</span>',
		variant: this,
		module: config.module
	});
	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	var instance = this;
	
	this._baseElement.onmouseout = function(){
		instance._module.mouseOutVariant(instance);
	}
	
	this._baseElement.onmouseover = function(){
		instance._module.mouseOverVariant(instance);
	}
	
	this._baseElement.onclick = function(){
		instance._module.clickVariant(instance);
	}
	
	this.selected = false;
	this.active = true;
	
	
	this.linkedClass = undefined;
}

Rup.extend(Task_Variant_7, Task_Variant_Abstract);

Task_Variant_7.prototype.select = function()
{
	this.selected = true;
	Rup.css.add(this._baseElement, 'Selected');
}

Task_Variant_7.prototype.unSelect = function()
{
	this.selected = false;
	Rup.css.del(this._baseElement, 'Selected');
}

Task_Variant_7.prototype.activate = function()
{
	this.active = true;
	Rup.css.del(this._baseElement, 'InActive');
	Rup.css.add(this._baseElement, 'Active');
}

Task_Variant_7.prototype.deactivate = function()
{
	this.active = false;
	Rup.css.del(this._baseElement, 'Active');
	Rup.css.add(this._baseElement, 'InActive');
}

Task_Variant_7.prototype.indicate = function()
{
	this._baseElement.style.backgroundColor = '#B3F497';
	//this._baseElement.style.textDecoration = 'underline';
}

Task_Variant_7.prototype.unIndicate = function()
{
	this._baseElement.style.backgroundColor = '';
}

Task_Variant_7.prototype.markAsCorrected = function()
{
	Rup.css.add(this._correctedShadowVariant._baseElement, 'groupingCorrected');
}

Task_Variant_7.prototype.markAsCorrect = function()
{
	Rup.css.add(this._shadowVariant._baseElement, 'groupingCorrect');
}

Task_Variant_7.prototype.markAsMistake = function()
{
	Rup.css.add(this._shadowVariant._baseElement, 'groupingMistake');
}

Task_Variant_7.prototype.linkToClass = function(classElement)
{
	/**
	 * привязываем, если только еще не привязан ни к одному классу
	 * и не привязан к этому
	 */
	if( this.linkedClass == undefined || this.linkedClass != classElement )
	{
		this.unLinkClass();
		classElement.appendChild(this._shadowVariant);
		this.linkedClass = classElement;
	}
	this.deactivate();
	if( this._handler ) this._handler();
}

Task_Variant_7.prototype.linkCorrectedToClass = function(classElement)
{
	classElement.appendChild(this._correctedShadowVariant);
}

Task_Variant_7.prototype.unLinkClass = function()
{
	if( !this.linkedClass ) return;
	
	for( var i = 0; i < this._module.classes.length; i++ )
	{
		if( this.linkedClass == this._module.classes[i] )
		{
			this._module.classes[i].removeChild(this._shadowVariant);
		}
	}
	this.linkedClass = undefined;
	this.activate();
	this.unIndicate();
	if( this.right )
	{
		this.right = false;
		if( this._handler ) this._handler();
	}
}

Task_Variant_7.prototype.setValue = function(value)
{
	if( value == 0 )
	{
		this.unLinkClass();
	}
	else
	{
		this.linkToClass(this._module.classes[value-1]);
	}
}

Task_Variant_7.prototype.getValue = function()
{
	var value = 0;
	
	if( this.linkedClass )
	{
		for( var i = 0; i < this._module.classes.length; i++ )
		{
			if( this.linkedClass == this._module.classes[i] )
			{
				value = i + 1;
			}
		}
	}
	
	return value;
}

Task_Variant_7.prototype.setDisabled = function()
{
	this._module.setDisabled();
}

Task_Variant_7.prototype.setHandler = function(handler, scope, num)
{
	this._handler = function(){ handler.call(scope, num);};
}

function Task_Variant_7_Shadow(config)
{
	Task_Variant_7_Shadow.superclass.constructor.call(this);
	
	this._setBaseElement(Rup.create("span"));
	
	this._baseElement.innerHTML = config.text;
	Rup.css.add(this._baseElement, 'Active');
	
	this.variant = config.variant;
	this._module = config.module;
	
	var instance = this;
	
	this._baseElement.onmouseout = function(){
		instance._module.mouseOutShadow(instance);
	}
	
	this._baseElement.onmouseover = function(){
		instance._module.mouseOverShadow(instance);
	}
	
	this._baseElement.onclick = function(){
		instance._module.clickShadow(instance);
	}
}

Rup.extend(Task_Variant_7_Shadow, Element_Abstract);

Task_Variant_7_Shadow.prototype.indicate = function()
{
	this._baseElement.style.backgroundColor = '#B3F497';
}

Task_Variant_7_Shadow.prototype.unIndicate = function()
{
	this._baseElement.style.backgroundColor = '';
}