//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 );
}

//JavaScript Share methods
function share() {
    FB.Connect.showShareDialog("http://www.welcometofc.com", onShareHandler);
}
function showShare(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300,left = 710,top = 450');");
}



//Event Handlers
function onLoginHandler(){
	flashCallBack( "onLogIn" );
}
function onShareHandler(){

	flashCallBack( "onShare" );
}

//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]();
	}
}

