 var Qype = {};

      Qype.rez_area = Class.create({
        min_height: 5,
        margin: 1.2,
        unit: "em",
  
        initialize: function(field) {
          this.element = $(field);
          this.element.setStyle({
            height: this.min_height + this.unit,
            
            overflow: "hidden"
            //overflow-y: 'hidden'
            
          });
  
          this._resize();
          this.element.observe('keyup', this._resize.bind(this));
        },
  
        _resize: function() {
          this.rows = this._calcRows();
          this.height = (this.rows*this.margin) + this.margin;
          if (this.height <this.min_height) this.height = this.min_height;
          this.element.morph({height: (this.height + this.unit)}, {duration: .2});
        },
  
        _calcRows: function() {
          this.cols = this.element.getWidth() / 8;
          this.rows = Math.floor(this.element.value.length / this.cols) + this.element.value.split("\n").length;
        return this.rows
        }
      });



        document.observe('dom:loaded', function()
        {
          $$('textarea').each(function(el) {
          new Qype.rez_area(el);
          });
	   });
   