Fixed a few javascript issues, tested in 3 browsers.