/**
* Get FaceBook session
*/
function fbSession(root_path)
{
	var url = "";
	root_path = root_path || '';

	try{
		if(document.getElementById('login').redirect.value != "")
		{
			url = 'fbconnect.php?redir='+escape(document.getElementById('login').redirect.value);
		}else{
			url = 'fbconnect.php';
		}
	}catch(err){
		url = 'fbconnect.php';
	}

	FB.ensureInit(function()
	{
    	FB.Connect.ifUserConnected(url, function ()
    	{
        	FB.Connect.requireSession(function ()
			{
				document.location = root_path + url;
			});
		});
	});
}