I've tried this and it works very well.
I've also tried to find out whether or not the user is already logged in, when entering the page. I've had several attempts on this, but I can't figure out how to do it. It seems that the facebook api scripts aren't available on page load, which is why I can't check the current login status.
How would you go about building a getLoginStatus-check into the solution you've posted, so that the username is shown in stead of the login button, when the user is already authenticated?
/Brian