// SWF methods for sharing on FB and Twitter

// Facebook
function connectFacebook(score) {

	// No score, share link
	if ( score == 0 ) {
		
		FB.ui({
			method:			'stream.share',
			u:				'http://www.facebook.com/pages/Grogger-Dont-Get-Smashed/37575217229'
		});
		
	// Has score, publish to wall
	} else {
	
		FB.ui({
			method:				'stream.publish',
			message:			'I got a score of '+score+' on Grogger!',
			attachment: {
				name:			'Grogger - Don\'t Get Smashed!',
				caption:		'Brought to you by the City of Melbourne',
				description: 	'I just played the Grogger - Don\'t Get Smashed game and scored '+score+'! http://www.grogger.com.au/ #Grogger',
				href:			'http://www.facebook.com/pages/Grogger-Dont-Get-Smashed/37575217229'
			},
			action_links: [
				{ text: 'Grogger - Don\'t Get Smashed!', href: 'http://www.facebook.com/pages/Grogger-Dont-Get-Smashed/37575217229' }
			],
			user_message_prompt:	'Tell your friends about Grogger - Don\'t Get Smashed!'
		},
		function(response) {
			if ( response && response.post_id ) {
				//alert( 'Post was published.' );
			} else {
				//alert( 'Post wasn\'t published.' );
			}
		});
		
	}

}

// Twitter
function connectTwitter(score) {
	
	window.open( 'http://twitter.com/share?url=http://www.grogger.com.au/&text=I+just+played+the+Grogger+-+Don\'t+Get+Smashed+game!+%23Grogger', 'twitterShare', 'width=550,height=300' );
	
}



