function CBody(TRID, TDID)
{
	this.prototype = new CSuper('body', TRID, TDID);
}

CBody.prototype.Set = function(Name, Value, InsertBeforePosition)
{
	var Container = document.getElementById('id_document_container_td_body_table_tr');
	var Elements = Container.getElementsByTagName('td');

	for(var i = 0; i < Elements.length; ++i)
	{
		if(Elements[i].id == 'id_body_table_td_' + Name)
		{
			Elements[i].innerHTML = Value;
			return Elements[i];
		}
	}

	var NewElement = document.createElement('td');
	
	NewElement.id = 'id_body_table_td_' + Name;
	NewElement.className = 'body_table_td_' + Name;
	NewElement.innerHTML = Value;
	
	if(typeof(InsertBeforePosition) == 'undefined') Container.appendChild(NewElement);
	else Container.insertBefore(NewElement, Elements[InsertBeforePosition]);
		
	return NewElement;
}

CBody.prototype.Kill = function(Name)
{
	var Container = document.getElementById('id_document_container_td_body_table_tr');
	var Elements = Container.getElementsByTagName('td');

	for(var i = 0; i < Elements.length; ++i)
	{
		if(Elements[i].id == 'id_body_table_td_' + Name)
		{
			Container.removeChild(Elements[i]);
			return;
		}
	}
}

CBody.prototype._GetArea = function(Name)
{
	var Container = document.getElementById('id_document_container_td_body_table_tr');
	var Elements = Container.getElementsByTagName('td');
	for(var i = 0; i < Elements.length; ++i) if(Elements[i].id == 'id_body_table_td_' + Name) return Elements[i];
	return null;
}

CBody.prototype.Exec = function(Application, Resource, Area, ExecData)
{
	var Data = new CData();
	Data.SetObject(this.prototype.ObjectName);
	Data.SetCommand('exec');
	Data.SetAttrib('Application', Application);
	Data.SetAttrib('Resource', Resource);
	
	if(typeof(ExecData) != 'undefined') for(var i = 0; i < ExecData.GetParamCount(); ++i) Data.SetParam(ExecData.GetParamName(i), ExecData.GetParamValue(i));
	
	Ajax.Post(Area, this.prototype.Url, function(Value, Area)
	{	
		var InsertBeforePosition = null;
		if(Area == 'sidebar') InsertBeforePosition = 0;
		Body.Set(Area, Value, InsertBeforePosition);
		launchJavascriptFromText(Value);
	}
	, Data);
}
