window.fbAsyncInit = function() {
	FB.init({
		apiKey: '2b1e3cf6c97cacbcd022c93ef4a392a0',
		status: true,
		cookie: true,
		xfbml: true
	});
};

function fb_publish_stream(msg) {
	FB.ui({
		method: 'stream.publish',
		message: '',
		attachment: {
			name: 'Milram Bauernweisheiten',
			caption: '{*actor*} bildet sich fort und liest die Bauernweisheiten auf www.milram.de',
			description: msg,
			media: [
				{
					type: 'image',
					//src: 'http://connect.meemoo-apps.com/img/default_stream_icon.png',
					src: 'http://www.milram.de/bauernweisheiten_files/img/milram_milchkanne_facebook.jpg',
					href: 'http://www.milram.de/'
				}
			]
		},
		action_links: [
			{
				text: 'Milram',
				href: 'http://www.milram.de/'
			}
		],
		user_prompt_message: msg
	});	
}


	$j('.fb_wallpost').bind('click', function()	{
		try {
			var weissheitenbox_id = 'bweissheit_' + this.id;
			var txt_weissheit = $j('#' + weissheitenbox_id).html();

			//console.log(txt_autor);
			//console.log(txt_weissheit);

			fb_publish_stream(txt_weissheit);
		} catch (ex) {
			//console.log(ex);
		}
		return false;
	});
/*
$j('.fb_wallpost').bind('click', function()	{
		try {
			var weisheiten_container = 'bweissheit_' + this.id;
			var msg = $j('#' + weisheiten_container).html();

			console.log(msg);

			fb_publish_stream(msg);
			// Autor und Text kombinieren:
			//fb_publish_stream($j('#bautor_' + $j(this).id.html() + ' ' + '#bweisheit_' + $j(this).id.html()));
		} catch (ex) {
			console.log(ex);
		}
		return false;
	});
*/
