var xController = function ()
{
	this.oButtons = [];
}

xController.prototype = new xCommon;

xController.prototype.fInit = function ()
{
	var p = this;
	var Divs = document.body.getElementsByTagName("DIV");

	for (var i = 0; i < Divs.length; i++)
	{
		if (Divs[i].getAttribute("func") == "button")
		{
			var ind = this.oButtons.length;
			this.oButtons[ind] = new xButton;
			this.oButtons[ind].vIdElement = Divs[i];
			this.oButtons[ind].vCaption = Divs[i].getAttribute("title");
			this.oButtons[ind].vAction = Divs[i].getAttribute("action");
			this.oButtons[ind].vModule = Divs[i].getAttribute("module");
			this.oButtons[ind].vIndex = ind;
			this.oButtons[ind].vPicLeftSide = 'button_l1.gif';
			this.oButtons[ind].vPicLeftSideOver = 'button_l1_over.gif';
			this.oButtons[ind].vPicRightSide = 'button_r1.gif';
			this.oButtons[ind].vPicRightSideOver = 'button_r1_over.gif';
			if (Divs[i].getAttribute("image"))
				this.oButtons[ind].vImage = Divs[i].getAttribute("image") + this.vPicExt;
			else
				this.oButtons[ind].vImage = Divs[i].getAttribute("action") + this.vPicExt;
			this.oButtons[ind].onClick = function ()
			{
				var el = arguments[0];
				$('action').value = el.vAction;
				$('module').value = (el.vModule?el.vModule:(p.vCurrentModule?p.vCurrentModule:'main'));
				$(p.vMainForm).submit();
			}
			this.oButtons[ind].fShow();
		}
	}
}

xController.prototype.fInitButton = function ()
{
	var ind = this.oButtons.length;
	this.oButtons[ind] = new xButton;
	this.oButtons[ind].vIndex = ind;
	this.oButtons[ind].vPicLeftSide = 'button_l.gif';
	this.oButtons[ind].vPicLeftSideOver = 'button_l_over.gif';
	this.oButtons[ind].vPicRightSide = 'button_r.gif';
	this.oButtons[ind].vPicRightSideOver = 'button_r_over.gif';

	return this.oButtons[ind];
}
