Added error message for login form.
Restructures javascript code
Renamed "login" field to "name" field; implemented AJAX server request to login