// FACEBOOK
function facebook_onGetSession(){
    var element = document.getElementById(flashID);
    document.getElementById('hebbe').facebook_onGetSession(null);
}

function facebook_login(){
    FB.login(handleSessionResponse, facebookPermissions);
}

function facebook_logout(){
    FB.logout(handleSessionResponse);
}

function parseSession(session){
    var info = "info: ";
    for (var eachAttr in session) {
        info += "\n" + eachAttr + ":" + session[eachAttr];
        if (eachAttr == "uid") {
            uid = session[eachAttr];
        }
    }
}

function handleSessionResponse(response){
    // if we dont have a session, ... do something
    if (!response.session) {
        return;
    }
};

// SHARE
// @see http://developers.facebook.com/docs/reference/dialogs/feed/
// Note: the redirect_uri needs to be the on the domain that belongs to the app.
function doStreamPublish(name, description, link, picture) {
	// alert("doStreamPublish: " + name + ", " + description + ", " + link + ", " + picture);
    FB.ui({
        method: 'stream.publish',
        message: '',
		name: name,
        caption: '',
        description: (description),
        link: link,
        user_message_prompt: '',
		picture:picture,
		redirect_uri:'http://shower.axe.nl/php/facebook_result.php',
		next:null
    }, handleStreamPublish);
};

function handleStreamPublish(response){
    if (response != null && typeof response != 'undefined' && typeof response.post_id != 'undefined') {
        // Tell Flash the post was successfull.
        handleShareSuccess("facebook");
    }
    else {
        handleShareFault("facebook");
    }
};

function parseResponse(response){
    var info = "info: ";
    for (var eachAttr in response) {
        info += "\n" + eachAttr + ":" + response[eachAttr];
    }
};

