Xeon.Core.namespace('Calculator');

Calculator.GraphTable = function(tabelId)
{
	var tableId;
	var tableElement;
	
	this.tableId = tabelId;
	this.tableElement = document.getElementById(this.tableId);
	
	this.addRow = function(cells)
	{
		var cellsLength = cells.length;
		var oRow = document.createElement('tr');
		for (var i = 0; i < cellsLength; i++) {
			var oCell = document.createElement('td');
			oCell.appendChild(document.createTextNode(cells[i]));
			oRow.appendChild(oCell);
		}
		this.tableElement.childNodes[0].appendChild(oRow);
	};
	
	this.show = function()
	{
		if (this.tableElement.style.display == 'none') {
			this.tableElement.style.display = 'block';
		}
	};

	this.hide = function()
	{
		if (this.tableElement.style.display != 'none') {
			this.tableElement.style.display = 'none';
		}
	};
	
	this.clearBody = function()
	{
		var oTBody = this.tableElement.childNodes[0];
		var cells = oTBody.childNodes.length;
		for(var i = cells - 1 ; i > 0; i--) {
			oTBody.removeChild(oTBody.childNodes[i]);
		}
	}
}