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));
	var hard = eval("hard_lines  " + unescape("%3e") + "soft_lines;");
	if(hard) soft_lines = hard_lines;
	return soft_lines;
}

function cleanForm() {
	var the_form = document.forms.resize_form;
	for(var x in the_form) {
		if(!the_form[x]) continue;
		if(typeof the_form[x].rows != "number") continue;
		new_rows = countLines(the_form[x].value,the_form[x].cols) + 1;
		if(new_rows < 25) {
			the_form[x].rows = new_rows;
		} else {
			the_form[x].rows = 25;
		}
	}
	setTimeout("cleanForm();", 300);
}
