function resize_textarea(txtBox) {
  nCols = txtBox.cols;
  sVal = txtBox.value;
  nVal = sVal.length;
  nRowCnt = 1;

  for (var i=0; i<nVal; i++) {
    if (sVal.charAt(i).charCodeAt(0) == 10) {
      nRowCnt += 1;
    }
  }

  if (nRowCnt < (nVal / nCols)) {
    nRowCnt = 1 + (nVal / nCols); 
  }
  txtBox.rows = nRowCnt; 
}

function resize_parts() {
  var the_form = document.getElementById('my_form');
  var es = the_form.elements;
  for (var i=0; i<es.length; i++) {
    if (es[i].tagName.toLowerCase() !== 'textarea') {continue;}
    resize_textarea(es[i]);
  }
  setTimeout(resize_parts, 1000);
}
YAHOO.util.Event.addListener(window, "load", resize_parts);

