JavaScript file compatibility improvements

The JavaScript file now works fine for IE. Also, we're using
BeforePageDisplay and GetLocalURL::Internal (mainly for logout link
handling).

Change-Id: Ic784a576393283831b4944d53d47edf3db89efeb