function isWhite(s) {
	if (s==' ') return true;
	if (s=='\t') return true;
	if (s=='\n') return true;
	if (s=='\r') return true;
	if (s=='\b') return true;
	return false;
}

function trim(s) {
  while (isWhite(s.substring(0,1))) {
    s = s.substring(1,s.length);
  }
  while (isWhite(s.substring(s.length-1,s.length))) {
    s = s.substring(0,s.length-1);
  }
  return s;
}

function FormTrim(f) {
	els = f.elements;
	for (i in els) {
		o = els[i];
		t = o.type;
		if ((t=='text' || t=='textarea') && !o.readOnly) o.value = trim(o.value);
	}
}