function CSuper(ObjectName, TRID, TDID)
{
	this.ObjectName = ObjectName;
	this.TRID = TRID;
	this.TDID = TDID;
	this.Url  = document.location.href.split('?')[0];
	this.Init();
}

CSuper.prototype.Init = function()
{
	var Data = new CData();
	Data.SetObject(this.ObjectName);
	Data.SetCommand("init");

	var Obj = document.getElementById(this.TDID); if(Obj != null) Obj.innerHTML = "<img src='skin/current/wait.gif'/>";
	
	Ajax.Post(this.TDID, this.Url, function(Value, DstObjID)
	{
		var Obj = document.getElementById(DstObjID);
		if(Obj) Obj.innerHTML = Value;
		launchJavascriptFromText(Value);
	}
	, Data);
}

CSuper.prototype.Exec = function(Application, Resource, ExecData)
{
	var Data = new CData();
	Data.SetObject(this.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));

	var Obj = document.getElementById(this.TDID); if(Obj != null) Obj.innerHTML = "<img src='skin/current/wait.gif'/>";
	
	Ajax.Post(this.TDID, this.Url, function(Value, DstObjID)
	{	
		var Obj = document.getElementById(DstObjID);
		if(Obj) Obj.innerHTML = Value;
		launchJavascriptFromText(Value);
	}
	, Data);
}

CSuper.prototype.ToggleVisible = function()
{
	var Obj = document.getElementById(this.TRID);
	Obj.style.display = Obj.style.display == 'none' ? 'block' : 'none';
}
