	function TSpin(name) {
		this.name = name;
		this.__ref; // nome referencia da classe
		this.__edit; // referencia do edit

		this.oldValue = 0;

		this.create = function () {
			this.__ref = "spin_" + this.name.replace(/\[|\]/g, '_');
			eval(this.__ref + " = this");

			document.write("<table border=0 cellspacing=0 cellpadding=0>" +
			"<tr><td rowspan=2><input type=text class=formEdit size=1 name='" + this.name + "' id='" + this.name + "' value='0' onchange='" + this.__ref + ".change()'></td>" +
			"<td><img src='img/bt_form_up.gif'  onclick='" + this.__ref + ".up_click()'></td></tr>" +
			"<tr><td><img src='img/bt_form_down.gif' onclick='" + this.__ref + ".dow_click()'></td></tr></table>");

			this.__edit = document.getElementById(this.name)
		}

		this.isInt = function (value) {
			return (value*1).toString().match(/[0-9]+$/) != null;
		}

		this.getValue = function () {
			if (!this.isInt(this.__edit.value)) {
				this.__edit.value = this.oldValue;
			}

			return this.__edit.value;
		};

		this.setValue = function (value) {
			if (this.isInt(value)) {
				this.oldValue = value;
			}

			if (this.__edit.value != this.oldValue) {
				this.__edit.value = this.oldValue;
				this.__edit.onchange();
			}
		};

		this.up_click = function () {
			var value = this.getValue();
			value++;
			this.setValue(value);
		};

		this.dow_click = function () {
			var value = this.getValue();
			value--;
			this.setValue(value);
		};

		this.change = function change() {
			this.getValue();
		};

		this.addEvent = function (eveName, func) {
			var eve = eval('document.getElementById("' + this.name + '").' + eveName);

			if (eve)
				eve = eve.toString().replace(/\n/g, '').replace(/function[^\{]+\{/, '').replace(/}$/, '');

			func = func.toString().replace(/\n/g, '').replace(/function[^\{]+\{/, '').replace(/\}$/, '');

			eval('document.getElementById("' + this.name + '").' + eveName + ' = function () {' + eve + '\n' + func + '}');
		}
		this.create();
	}