//var myscript = document.createElement('script');
//myscript.type = 'text/javasript';
//myscript.src = 'http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php';
//document.getElementsByTagName('head')[0].appendChild(myscript);

function facebookconnect_display_logout(divId) {

  var div = document.getElementById(divId);

  div.innerHTML = '<a href="#" onclick="FB.Connect.logout(function() { reload(); }); return false;" ><img id="fb_logout_image" src="http://static.ak.fbcdn.net/images/fbconnect/logout-buttons/logout_small.gif" alt="Disconnect"/></a>';

  // because this is XFBML, we need to tell Facebook to re-process the document 
  // FB.XFBML.Host.parseDomTree();
}

function facebookconnect_display_login(divId) {

  var div = document.getElementById(divId);

  div.innerHTML = '<a href="#" onclick="FB.Connect.requireSession(function() { reload(); }); return false;" ><img id="fb_login_image" src="http://static.ak.fbcdn.net/images/fbconnect/login-buttons/connect_light_medium_short.gif" alt="Connect"/></a>';

  // because this is XFBML, we need to tell Facebook to re-process the document 
  // FB.XFBML.Host.parseDomTree();
}

function facebookconnect_init(divId) {
  FB.init("dc6cf034afde1deabd4e14f28244d438","xd_receiver.htm");
  //FB.ensureInit(function() {
  //  FB.Connect.ifUserConnected(function() { facebook_display_logout("fbc"); }, function() { facebook_display_login("fbc"); } );
  //});
}

