What's a message box ?
do you mean in JavaScript?
You may be interested in the RedBox library.
http://www.agilewebdevelopment.com/plugins/redbox
-NSHB
Just do:
<% unless flash[:error].blank? %> <script>alert(<%= flash[:error] -%>)</script> <% end %>
And in your controller :
unless login_successful? flash[:error] = 'Login unsuccessful.' end