﻿
var silverlightPluginId = 'SilverlightPlugin';


function initFB(name, imageSource, description, url, msg) {

    FB_RequireFeatures(["Connect"], function () {
        alert("init fb");
        //fb_sendInviteExtracted()
        FB.init("50a60426942de2b8e1632aada5e36eed",
               "/development/Halo_Reach/20100429_1/nobleteam/xd_receiver.htm",
                { doNotUseCachedConnectState: true });
        //                FB.Connect.forceSessionRefresh(null);

        alert("face book connect");
        FB.Connect.requireSession(
                    function () {
                        streamPublish(name, imageSource, description, url, msg);
                    }
                , null);
    });
        

};


function streamPublish(name, imageSource, description, url, msg) {
    alert("face book stream publish");
    alert(description);
    
    FB.Connect.streamPublish('', attachment, null, null,
    msg,
    streamPublish_callback);


    var attachment =
			{
			    'media':
				[
					{
					    'type': 'image',
					    'src': imageSource,
					    'href': url
					}
				],
			    'name': name,
			    'description': description,
			    'href': url
			};

    var actionLinks =
			[
				{
				    'text': name,
				    'href': url
				}
			];

    FB.Connect.streamPublish('', attachment, actionLinks);
}

function streamPublish_callback(post_id, exception) {
    if (post_id) {
        // alert("thanks. posted.");
    }
}  

