An attempt to make things more compatible with IE.

Semi-successful. Main things are replacing URL parsing stuff,
addinew new tests, and not relying on array.indexOf. Tests still
fail though, of course.