function initFB() {
//	FB.init("56f5537e522eda6824ce460d168bc10d","/xd_receiver.htm",{permsToRequestOnConnect : "email",});
	FB.init("19266d91e2097846669b918d7f03cf0c","/xd_receiver.htm");
//	FB.Connect.showPermissionDialog("email");	
}


function update_user_box(){

//	FB.Connect.showPermissionDialog("email");			
//	var user_box = document.getElementById("user"); 
	// add in some XFBML. note that we set useyou=false so it doesn't display "you" 
//	user_box.innerHTML = "<span>" + "<fb:profile-pic uid=loggedinuser facebook-logo=true></fb:profile-pic>" + "Welcome, <fb:name uid=loggedinuser useyou=false></fb:name>. You are signed in with your Facebook account." + "</span>";
	// because this is XFBML, we need to tell Facebook to re-process the document 
//	FB.XFBML.Host.parseDomTree();
		
	// ajax to fb_register.php
	$.post("./logic/fb_register.php", function(data){
		if(!data){
			alert('fb_register.php send back nothing');
		}else{
			var form_data = data.split(" ");

//			alert(form_data);
			$.post("forum/ucp.php?mode=login", {'login':'Go!', 'login-username':form_data[2], 'username':form_data[2], 'login-password':form_data[4], 'password':form_data[4], 'redirect':form_data[6], 'external_login':1, 'asfsagrg4':'d76fghhjd'}, function(result){
			 		 if(result){
			 		 	 location.href= form_data[6];
			 		 }else{
			 		 	 alert('ucp.php return nothing!');
			 		 }
			 	}		
			 ); 
			 
		}
			
	});
	
	
}

function callPublish(msg, attachment, action_link) {
	FB.ensureInit(function () {			  
		 FB.Connect.streamPublish('', attachment, action_link);		   
	});			  
}



