/*
Auto grow vertically a Textarea
Contributor: zkonyves@bizware.com
Version: 0.8 - 10/20/2009
*/
function countLines(strtocount, cols) {
    var hard_lines = 1;
    var last = 0;
    while ( true ) {
        last = strtocount.indexOf("\n", last+1);
        hard_lines ++;
        if ( last == -1 ) break;
    }
    var soft_lines = Math.round(strtocount.length / (cols-1));
	return Math.max(hard_lines, 4);
}
function growTextArea() {
	for (var ii=0; ii<document.forms.length; ii++) {
    var the_form = document.forms[ii];
    for ( var x in the_form ) {
        if ( ! the_form[x] ) continue;
        if( typeof the_form[x].rows != "number" ) continue;
        the_form[x].rows = countLines(the_form[x].value,the_form[x].cols) +1;
    }
	}
    //setTimeout("growTextArea();", 1000);
}
setTimeout("growTextArea();", 300);