explicitly define a trim function. now works in chrome, too.