//Local Variable with Flash Content id. default = flashcontent
var as_swf_name = "flashContent";

//Initialize Facebook
function fbInit(pAsSwfName,pApi_key,pReceiver){
	as_swf_name = pAsSwfName;
	FB.init(pApi_key,pReceiver);
}

//JavaScript Connect methods
function login(){
	FB.Connect.requireSession( onLoginHandler );
}

//Event Handlers
function onLoginHandler(){
	flashCallBack( "onLogIn" );
	
}

//Method to dispatch an Event to Flash
function flashCallBack ( func ) {
	if( arguments.length > 1 ){
		document[as_swf_name][func]( Array.prototype.slice.call(arguments).slice(1)[0]);
	}else{
		document[as_swf_name][func]();
	}
}


function fbShare(score)
{
	
	var attachment = {'media':[{'type':'image','src':'http://www.sonypictures.com/movies/zombieland/deadfun/assets/images/fb_share.jpg','href':'http://www.sonypictures.com/movies/zombieland/deadfun/'}]}; 
	FB.Connect.streamPublish("I just played Dead Fun and got a score of "+score+". Think you could do better? Play Now at www.zombieland.com", attachment);	
}




