// Add a function that handles the AuthenticationCompleted event.
_signin.add_authenticationCompleted(authenticationCompleted);
// This function is invoked once the user has authenticated with Windows Live.
function authenticationCompleted(sender, e) {
// Hide the control.
_signin.hide();
_user = new Microsoft.Live.Messenger.User(e.get_identity());
_user.add_signInCompleted(signInCompleted);
_user.add_signedOut(signedOut);
_user.signIn();
}
// This function is invoked once the signOut(...) method has completed.
function signedOut(sender, e)
{
// Show the control so that the user may sign-in again.
_signin.show();
}