function StrixTextareaAutoHeight(id) {
	this.id = id || null;
	this.obj = null;
	this.oldValue = null;
	this.minRows = null;
	this.timerId = null;

	this._ticker = function() {
		if (this.oldValue !== null && this.oldValue === this.obj.value) {
			return;
		}
		this.oldValue = this.obj.value;
		var fixed = false;
		var curr_h = this.obj.clientHeight;
		while (this.obj.scrollHeight <= this.obj.clientHeight && this.obj.rows > this.minRows) {
			this.obj.rows--;
			if (this.obj.clientHeight >= curr_h) {
				fixed = true;
				break;
			}
			curr_h = this.obj.clientHeight;
		}
		while (this.obj.scrollHeight > this.obj.clientHeight) {
			this.obj.rows++;
			if (this.obj.clientHeight <= curr_h) {
				fixed = true;
				break;
			}
			curr_h = this.obj.clientHeight;
		}
		if (fixed) {
			try {
				this.obj.style.overflow = 'auto';
				this.obj.style.overflowX = 'auto';
				this.obj.style.overflowY = 'auto';
			}
			catch (ex) { }
			if (this.timerId) {
				clearInterval(this.timerId);
			}
			this.timerId = null;
		}
	};

	this.init = function() {
		if (!this.id) {
			return;
		}
		this.obj = self.document.getElementById(this.id) || null;
		if (!this.obj) {
			return;
		}
		try {
			this.obj.style.overflow = 'auto';
			this.obj.style.overflowY = 'hidden';
			this.obj.wrap = 'soft';
		}
		catch (ex) { }
		this.minRows = Math.max(parseInt(this.obj.rows || -1), 3);
		this.obj.rows = this.minRows;
		var _t = this;
		this.timerId = setInterval(function() {
			_t._ticker();
		}, 50);
	};

	if (self.document.readyState == 'complete') {
		this.init();
	} else {
		var _t = this;
		YAHOO.util.Event.addListener(self, 'load', function(ev) {
			_t.init();
			return true;
		});
	}

	return this;
}

