/*
FB.Event.subscribe('auth.login', function(response) {
	fb_login();
});

FB.Event.subscribe('auth.logout', function(response) {
	fb_logout();
});
*/
function fb_logout_click(){
	FB.logout(function(response){
		document.location.href = "http://"+location.hostname+"/logout.php?logout=true&page="+location.pathname;
	});
}

function fb_disconnect() {
	FB.api(
		{
			method : 'Auth.revokeAuthorization'
		},
		function(response) {
			document.location.href = "http://"+location.hostname+"/logout.php?logout=true&page="+location.pathname;
		});
}

function fb_statuschange(response){
	
}

function fb_post_prank(file) {
	FB.ui( {
		method : 'stream.publish',
		message : '',
		attachment : {
			name : 'Blåst med Busring.se',
			caption : '{*actor*} har precis blåst någon med Busring.se!',
			description : ('Lyssna nu!'),
			href : 'http://www.busring.se/rec/' + file + '.html?ref=124',
			media : [ {
				type : 'mp3',
				src : 'http://www.busring.se/userrecordings/' + file + '.mp3',
				title : 'En blåsning från Busring.se',
				artist : 'Busring.se',
				album : 'Busring.se - Blås skiten ur dina polare'
			} ]
		},
		action_links : [ {
			text : 'Gör din egen blåsning',
			href : 'http://www.busring.se/?ref=124'
		} ],
		user_message_prompt : 'Publicera din blåsning på Facebook:',
		target_id: '65158150579'
	}, function(response) {
		if (response && response.post_id) {
			alert('Post was published.');
		} else {
			alert('Post was not published.');
		}
	});
}
