JavaScript trim functions