window.addEvent('domready', function() {
	(function() {
		(new Element('script',{src:document.location.protocol + '//connect.facebook.net/en_US/all.js',async:true})).inject($('fb-root'));
    }());
});
window.fbAsyncInit = function() {
	FB.JSON.stringify = function (value) { return JSON.encode(value);};
    FB.init({
        appId: '216281901758057',
        channelURL: 'https://www.jamaicansmusic.com/js/channel.html',
        status: true,
        cookie: true,
		domain: 'jamaicansmusic.com',
        oauth: true,
        xfbml: true
    });
	FB.UIServer.setActiveNode = function(a,b){FB.UIServer._active[a.id]=b;} // IE hack to correct FB bug
};

function shareIt(props,callback) {
	if(!callback) callback = function(){};
	FB.ui(
	{
		method: 'stream.publish',
		message: props.message,
		attachment: {
			name: props.title, 
			caption: props.caption, 
			description: props.description,
			href: props.href,
			media: props.media //[{'type': 'image','src': "http://www.jamaicansmusic.com/images/skin/logo.png",'href': '<?php echo $curUrl; ?>'}]
		},
		action_links: props.actionlinks //[{text: "Link Name", href: 'Link Url'}]
	},
	function(response) {
		if (response && response.post_id) {
			callback();
		} else {
			alert('Post was not published.');
		}
	});			
}
