$(document)
  .ready(function() {
           var targetHash = escape(document.location.hash.substr(document.location.hash.indexOf("#") + 1));
           document.location = window.m.ROOT + "login?" + document.location.search.substr(1) + (targetHash ? "&return=" + targetHash : "");
         });
