function update_user_box(result) {
	var user_box = document.getElementById("user");
	if (result == FB.ConnectState.connected) {
		// add in some XFBML. note that we set useyou=false so it doesn't display "you"
		user_box.innerHTML = "<table cellpadding=4><tr><td><fb:profile-pic size=\"square\" uid=loggedinuser facebook-logo=true></fb:profile-pic></td>" + "<td><font color=\"white\">Logged in as</font> <br><b><fb:name uid=loggedinuser useyou=false></fb:name></b></td></tr></table>";
		// because this is XFBML, we need to tell Facebook to re-process the document
		FB.XFBML.Host.parseDomTree();
	} else {
		user_box.innerHTML = "<font color=\"white\">Sign-in using:</font><br/><fb:login-button onlogin='window.document.location=\"/\";'></fb:login-button>";
		FB.XFBML.Host.parseDomTree();
	}
}

function check_status() {
	//FB.XFBML.Host.parseDomTree();
	var stat = FB.Connect.get_status();
	stat.waitUntilReady(update_user_box);
}
