  

window.fbAsyncInit = function() {
	FB.init({appId: 'ac5166d10e616e9229cba6e8d13aa60d', status: true, cookie: true, xfbml: true});
};

var e = document.createElement('script'); 
e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/de_DE/all.js';
document.getElementById('fb-root').appendChild(e);	

dojo.addOnLoad(function() {	
//	FB.init("ac5166d10e616e9229cba6e8d13aa60d", "/xd_receiver.htm");
});

function facebook_login() {    
  FB.login(function(response) {
	  if (response.session) {
		callFunction("community","fblogin");
	  }
	});    
}

function signup_via_facebook() {
	dialog.hide();
	dialog.destroy();
	
	FB.login(function(response) {
		  if (response.session) {
		    if (response.perms) {
		    	callFunction('facebook','fbsignup');
		    } else {
		    	callFunction('facebook','fbsignup');
		    }
		  } 
		}, {perms:'publish_stream, status_update, photo_upload, share_item, user_about_me, user_location'});
}

function facebook_require() {
	FB.login(function(response) {
		  if (response.session) {
			window.location.reload();
		  } 
		});  	
}

function connect_to_facebook() {	
	FB.login(function(response) {
		  if (response.session) {
		    if (response.perms) {
		    	callFunction("community","fbconnect");
		    } else {
		    	callFunction("community","fbconnect");
		    }
		  } 
		}, {perms:'publish_stream, status_update, photo_upload, share_item'});    		
}

function fb_postLink(url, title) {
	pageTracker._trackEvent('Share', 'Link bei Facebook', url);
	window.open("http://www.facebook.com/sharer.php?u="+url+"&t="+title,"sharer","innerHeight=400, innerWidth=600");
}

function fb_postAdminLink(url, title) {
	callFunction("facebook","postAdminLink",url + ',' + title);
}
