  
	window.fbAsyncInit = function() {
		FB.init({appId: fb_app_id, status: true, cookie: true, xfbml: true});
		
		//FB.Event.subscribe('auth.login', function(response) {
		//	window.location.reload();
		//});
		
		FB.Event.subscribe('auth.sessionChange', function(response) {
			if (response.session) {
				// A user has logged in, and a new cookie has been saved
				//alert('we should have a cookie');
				if (response.perms) {
					//alert("perms available");
				}
			} else {
				// The user has logged out, and the cookie has been cleared
				//alert('logout -- no cookie');
			}
			window.location.reload();
		});
	};
  
	(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);
	}());
  
	function logout() {
		FB.logout(function(response) {
			// user is now logged out
			//alert(response.status);
			window.location.reload();
		});
		return false;
	}
  
/*
  
  function fbs_click() {
	var u=location.href;
	var t=document.title;
	window.open("http://www.facebook.com/sharer.php?u="+encodeURIComponent(u)+"&t="+encodeURIComponent(t),"sharer","toolbar=0,status=0,width=626,height=436");
	return false;
}

function shareWithFacebook() {

	//alert ('shareWithFacebook');
	//if (isFBuser()) {
		var attachment = getFBshareAttachment('caption');
		
		//FB.Connect.streamPublish('', attachment, null, null, '');
		FB.ui(
			{	method: 'stream.share',
				attachment: attachment
			},
			function(response) {
			 if (response && response.post_id) {
			   alert('Post was published.');
			 } else {
			   alert('Post was not published.');
			 }
			}
		);

		

	//}
	//return false;
}
*/

 
