//function $(sId){ return document.getElementById(sId) }

/*
	Простыня
*/
function Sheet()
{
	this.number = 0; // номер платежа
	this.action = true;
}
Sheet.prototype = {
	print: function(o) // вывести таблицу
	{
		this.o = o;
		var _sheet = this;
		if(this.action) setTimeout(function(){ _sheet.make_list() }, 1000);
		this.action = false;
	},
	make_list: function()
	{
		this.calculate();
		this.action = true;
	},
	calculate: function()
	{
		// код рассчетов
	}
}


/*
	Element
*/
Element = {
	append: function(o)
	{
		if(this.o.tag) var oElement = document.createElement(this.o.tag);
		if(this.o.prop) this.o.prop(oElement); // properties
		this.o.before ? this.o.target.insertBefore(oElement, this.o.before) : this.o.target.appendChild(oElement);
	},
	html: function(o)
	{
		var sAttributes = '';
		var sHtml = '';
		for (var x in o)
		{
			if(x != 'html' && x != 'tag' && x != 'class_name') sAttributes += ' ' + x + '="' + o[x] + '"';
			if(x == 'html') sHtml = o[x];
			if(x == 'tag') sTag = o[x];
			if(x == 'class_name') sAttributes += ' class="' + o[x] + '"'; // fucked IE
		}
		return '<' + sTag + (sAttributes ? sAttributes : '') + '>' + sHtml + '</' + sTag + '>';
	}
}
