Ajax: use anchor tag for parsing urls

Ajax: don't use new url parsing for url rewriting

Ajax: cut down on unnecessary variables

Ajax: fix indentation of multi-line statement

Ajax: parse origin URL using an anchor tag too (for IE)