make JS compatible with IE 8

Hi,

I've been testing widearea in IE 8 and noticed that the only problem was missing `trim` function.

This PR replaces the `trim` function with a regexp, making widearea work in IE 8.