Upgraded the login and api functions

1) Moved search/api.js to search/static/api.js
2) Created show_login function that shows the dialog, but is parameterized with
   callbacks
3) Added a cancel button to the login dialog
4) Added a message box to display errors in the login dialog
5) Added onsubmit to be the same as clicking "Login"
6) Rewrote general api_call function to be slightly more complete