Fixed a bug in the format function causing everything to fail in IE (but work in other browsers).

I used an invalid compare function with Array.sort, which returned a boolean when it really should return an integer (gt 0, 0, or lt 0).