function updateFBUserbox() {
    var content = "<div id='facebookicon' style='float:left;padding-right:5px;'>"
    + "<fb:profile-pic uid='loggedinuser' facebook-logo='true' width='32px'></fb:profile-pic><br>"
    +"</div>"
    +"<div id='facebookuser' style='float:left'>"
    + "Welcome, <fb:name uid='loggedinuser' useyou='false'></fb:name>.<br>You are signed in with your Facebook account."
    + "<br><a href='"+ref+"'>Click here to continue</a>"
    + "</div>";
    $('#signinWrapper').fadeOut('slow');
    $('#twitterlogin').fadeOut('slow');
    $('#facebookConnect').html(content);
    // because this is XFBML, we need to tell Facebook to re-process the document
    FB.XFBML.Host.parseDomTree();
}
function updateCommentBox(){
    var content = ""
    +"<div id='facebookicon' style='float:left;padding-right:5px;'>"
    + "<fb:profile-pic uid='loggedinuser' facebook-logo='true' width='32px'></fb:profile-pic><br>"
    +"</div>"
    +"<div id='facebookuser' style='float:left'>"
    + "<span class='orangeHighlight'><fb:name uid='loggedinuser' useyou='false'></fb:name></span><br />You can comment with your Facebook account."
    + "</div>";
    $('#nameBox').fadeOut();
    $('#facebookButton').fadeOut();
    $('#twitterButton').fadeOut();
    $('#facebookComment').html(content);
    // because this is XFBML, we need to tell Facebook to re-process the document
    FB.XFBML.Host.parseDomTree();
}
function displayFBUserBox() {
    var content = "<div style='float:left'>"
    +"<fb:profile-pic uid='loggedinuser' facebook-logo='true' width='32px'></fb:profile-pic><br>"
    +"</div>"
    + "You are signed in with your Facebook account."
    +"<br />Click here to continue";
    $('#facebookConnect').html(content);
    // because this is XFBML, we need to tell Facebook to re-process the document
    FB.XFBML.Host.parseDomTree();
    $('#twitterlogin').fadeOut('slow');
    $('#signinWrapper').fadeOut('slow');
}
function fbCommentLogin(){
    var content ='<fb:login-button size="medium" background="dark" length="long" onlogin="displayFBUserBox();"></fb:login-button>';
    $('#facebookComment').html(content);
}
function fbLoginButton() {

    var content ='<fb:login-button size="medium" background="dark" length="long" onlogin="displayFBUserBox();"></fb:login-button>';
    $('#facebookConnect').html(content);
    // because this is XFBML, we need to tell Facebook to re-process the document
    FB.XFBML.Host.parseDomTree();
}