FB_RequireFeatures(["XFBML"], function(){
        FB.Facebook.init("40b028eb6f7aa661cf90148fef85e8af", "http://realityrateandpredict.com/xd_receiver.htm");
});

$(document).ready(function(){
	FB.init('40b028eb6f7aa661cf90148fef85e8af', 'xd_receiver.htm');
	check_fb_connection();

	$("a.fb_logout").live("click",function(event){
		var login_button = "<fb:login-button v='2' size='medium' onlogin='window.location.reload(true);'>Login with Facebook</fb:login-button>";
		FB.Connect.logout();

		$("#fb_info").html("");
	    $("#fb_login").html(login_button).show();
	
		FB.XFBML.Host.parseDomTree();
	    event.preventDefault();
	    
	   
	});
});
 
 
function check_fb_connection() {
	FB.ensureInit(function() {
		var check = $("#fb_info").text();

		if (check != '') FB.Connect.ifUserConnected(fb_update);
	});
}

function fb_update() {
	var profile_pic = "<fb:profile-pic uid='loggedinuser' facebook-logo='true'></fb:profile-pic>";
	var name = "<fb:name uid='loggedinuser' useyou='false'></fb:name>";
	var logout_link = " <a href='#' style='font-size: 10px' class='fb_logout'>Log Out</a>";

}

function init_flash() {
	
	if (jQuery.trim($("#site_flash").text()) != '') {
		$("#site_flash").fadeIn();
	}
	if (jQuery.trim($("#flash").text()) != '') {
		$("#flash").slideDown('slow',function(){setTimeout(function(){$("#flash").slideUp('slow')},8000)});	
	}

}

