js code fixes

#Modifications:
1. getDomain() now works with https sites also
2. XHR wrapper GET wrapping modified
3. url rewriting made easier