
//*****************************************************************************************
//*****************************************************************************************

		var button;
		var userInfo;
		
		window.fbAsyncInit = function() {
		
		
			FB.init({
				appId: '279450958742432',
				status: true,
				cookie: true,
				xfbml: true,
				oauth: true
			});


		function go(response) {
		
			button = document.getElementById('fbLogin');
			
			if (response.authResponse) 
			{ 
				//user is already logged in and connected
				FB.api('/me', function(info) {
					login(response, info);
					jQuery('#fbLogin').hide();
				});
				
				button.onclick = function() {
					FB.logout(function(response) {
						logout(response);
					});
				};
				
				//alert("connected!");
				
			} else { 
				
				//alert("not connected!");
				
				//user is not connected to your app or logged out
				button.onclick = function() {
					FB.login(function(response) {
						if (response.authResponse) {
							FB.api('/me', function(info) {
								login(response, info);
							});
						} else { //user cancelled login or did not grant authorization
							//showLoader(false);
						}
					}, {
						scope: 'email'
					});
				}
			}

		} // run once with current status and whenever the status changes
		
		FB.getLoginStatus(go);
		FB.Event.subscribe('auth.statusChange', go);

	};

	
	(function() {
		var e = document.createElement('script');
		e.async = true;
		e.src = document.location.protocol + '//connect.facebook.net/fr_FR/all.js';
		document.getElementById('fb-root').appendChild(e);
	}());

	function login(response, info) {
		if (response.authResponse) {
			jQuery(function() {
				jQuery('#lastname').val(info.last_name);
				jQuery('#firstname').val(info.first_name);
				if (info.email != "") {	jQuery('#email').val(info.email); }
			});
		}
	}
	

//*****************************************************************************************
//*****************************************************************************************

