﻿window.fbAsyncInit = function () {
	var id = document.getElementById('FacebookApplicationId').content;
	FB.init({ appId: id, status: false, cookie: true, xfbml: false, logging: false });

	FB.Event.subscribe('auth.sessionChange', function (response) {
		FacebookConnectAuthentication.Refresh();
	});	
};


function Initialize() {
	window.FacebookConnectAuthentication = document.getElementById('Application').content.FacebookConnectAuthentication;
	FB.getLoginStatus(function (response) {
		FacebookConnectAuthentication.Refresh();
	});
}

function Connect() {
	FB.login( null, { perms: document.getElementById('FacebookPermissions').content });
}
 
function Disconnect() {
	FB.logout();
};

(function () {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
} ());
