function showLogin(){$("ajaxLogin").style.display="block";}function onSuccessfulLogin(){Element.hide("ajaxLogin");Element.hide("loginLink");}function authAjax(){Element.update("loginMessage","Sending request ...");Element.show("loginMessage");var form=document.ajaxLoginForm;var params=Form.serialize(form)+"&spring-security-redirect=/login/ajaxSuccess";Form.disable(form);new Ajax.Request(form.action,{method:"POST",postBody:params,onSuccess:function(response){var responseText=response.responseText||"[]";var json=responseText.evalJSON();if(json.success){Element.hide("ajaxLogin");Element.hide("loginLink");onSuccessfulLogin();}else{if(json.error){Element.update("loginMessage","<span class='errorMessage'>"+json.error+"</error>");Form.enable(document.ajaxLoginForm);}else{Element.update("loginMessage",responseText);Form.enable(document.ajaxLoginForm);}}}});}
