﻿var osToken;
var ownerid;
var appid;
var container;
var installState;

function registerOS() {
    container = MyOpenSpace.MySpaceContainer.get();

    MyOpenSpace.MySpaceContainer.get().registerParam("panelId", "apppanel_" + appid + "_canvas");
//Set the location of the ifpc_relay_external001.html within your server
    MyOpenSpace.MySpaceContainer.get().registerParam("localRelay", "ifpc_relay_external001.html");

//If the application uses more than one page the OpenSocial token will need to be set manually for the 
//no landing pages if the the query string do not contains opensocial_token variable.
	MyOpenSpace.MySpaceContainer.get().registerParam("osToken", osToken);
	
//If the application uses more than one page the owner will need to be set manually for the 
//no landing pages if the the query string do not contains opensocial_owner_id variable.
	MyOpenSpace.MySpaceContainer.get().registerParam("ownerid", ownerid);

//If the application uses more than one page the appid will need to be set manually for the 
//no landing pages if the the query string do not contains appid variable.
	MyOpenSpace.MySpaceContainer.get().registerParam("appid", appid);

}




    function SendBulletin() {
                registerOS();
				// We get the title
				var titleText = 'Check out this MySpace app - watch full length shows';
				// We get the message
				var messageText = "Watch your favorite TV show or Movie for free with <a href=\"http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=121970&autoInitiateInstall=true\">Watch It App </a> <br>Check this out...<br> <object width=\"400\" height=\"232\"><param name=\"movie\" value=\"http://www.hulu.com/embed/drrxkjt0Rt8ihzwx-70Lew\"></param><embed src=\"http://www.hulu.com/embed/drrxkjt0Rt8ihzwx-70Lew\" type=\"application/x-shockwave-flash\"  width=\"400\" height=\"232\"></embed></object>";
				// We get the type of message
				var postToType = 'BULLETINS'
				
				
				var params = {};
				//Set The title of the message
				params[MyOpenSpace.Message.Field.TITLE] = titleText;
				//Set the type of message
				params[MyOpenSpace.Message.Field.TYPE] = postToType;
				
				
				
				var message = container.newMessage(messageText, params);
                container.postTo(message, callbacker);

    
    
    }
    
    function SendBulletinWithVideo(vidurl) {
                registerOS();
				// We get the title
				var titleText = 'Check out this MySpace app - watch full length shows';
				// We get the message
				var messageText = "Watch your favorite TV show or Movie for free with <a href=\"http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=121970&autoInitiateInstall=true\">Watch It App </a> <br>Check this out...<br> <object width=\"400\" height=\"232\"><param name=\"movie\" value=\""+vidurl+"\"></param><embed src=\""+vidurl+"\" type=\"application/x-shockwave-flash\"  width=\"400\" height=\"232\"></embed></object>";
				// We get the type of message
				var postToType = 'BULLETINS'
				
				
				var params = {};
				//Set The title of the message
				params[MyOpenSpace.Message.Field.TITLE] = titleText;
				//Set the type of message
				params[MyOpenSpace.Message.Field.TYPE] = postToType;
				
				
				
				var message = container.newMessage(messageText, params);
                container.postTo(message, callbacker);

    
    
    }    
    
     function callbacker(stuff) {}
     
     
     function gohome() {
     
        registerOS();
        container.requestNavigateTo(MyOpenSpace.View.Field.CANVAS);
     }
     
     