function trim(text) { var retval; retval = text.replace(/^\s+/g, ').replace(/\s+$/g, '); return retval; }