 	///////////////////////////////////////////////////
 	// Outbound from Flex (Properties)  (HTML Specific)
 	///////////////////////////////////////////////////
    //This is an example of usage of the Unicorn Media SDK in communication with the Unicorn Media Player API, and is being provided for your use on an “as     //is” basis and without warranty implied or otherwise. Use of this software and example is at your own risk and it may not function properly if modified    //or altered in such a manner as it ceases to interface properly with the Unicorn Media System. If you are having difficulty with the function or           //implementation of this software, please contact support@unicornmedia.com.
    //
    // Updates the specified HTML element with the given value.
    function updateHTML(elmId, value) 
    {
    	if (elmId == "aEvents")
    	{
    		document.getElementById(elmId).value = document.getElementById(elmId).value + "\n" + value;
    	}
    	else
    	{
    		document.getElementById(elmId).value = value;
    	}
    	
    }
    
    // Updates all static HTML elements to reflect Player information at this 
    // functions call time. 
    function updateytplayerInfo() 
    { 
    updateHTML("PlayheadTime", GetPlayheadTime('flashobject')); 
    updateHTML("MediaItemTitle", GetMediaItemTitle('flashobject')); 
    updateHTML("MediaItemGuid", GetMediaItemGuid('flashobject')); 
    updateHTML("MediaItemDuration", GetMediaItemDuration('flashobject')); 
    updateHTML("MediaItemEntityName", GetMediaItemEntityName('flashobject')); 
    updateHTML("MediaItemRating", GetMediaItemRating('flashobject')); 
    updateHTML("MediaItemType", GetMediaItemType('flashobject')); 
    updateHTML("MediaItemKeywords", GetMediaItemKeywords('flashobject')); 
    updateHTML("MediaItemThumbnailURL", GetMediaItemThumbnailURL('flashobject'));
    //updateHTML("EntityThumbnailURL", GetEntityThumbnailURL('flashobject'));				//Revision 2 
    //updateHTML("PlaylistThumbnailURL", GetPlaylistThumbnailURL('flashobject'));   //Revision 2 
    //updateHTML("PlaylistName", GetPlaylistName('flashobject'));										//Revision 2 
    updateHTML("MediaItemDescription",GetMediaItemDescription('flashobject')); 
    updateHTML("MuteState", GetMuteState('flashobject')); 
    updateHTML("PlayerVolumeState", GetPlayerVolumeState('flashobject')); 
    updateHTML("PlayerState", GetPlayerState('flashobject'));
    updateHTML("MediaItemAdBreaks", GetMediaItemAdBreaks('flashobject'));
    updateHTML("PlayerEmbedCode", GetPlayerEmbedCode('flashobject'));
    updateHTML("AdMediaURL", GetAdMediaURL('flashobject'));
    updateHTML("AdMediaClickURL", GetAdMediaClickURL('flashobject'));
    updateHTML("CompanionAdArray", GetAdCompanionAds('flashobject')); }

	// Sends the current playhead time on update (Number)
	function UMOExt_JS_PlayheadTime(i) {
		updateHTML("aPlayheadTime", i);
	}

	// Sends the current mediaitem title on update (String)
	function UMOExt_JS_MediaItemTitle(i)
	{
		updateHTML("aMediaItemTitle", i);
	}

	// Sends the current mediaitem guid on update (String) 	
	function UMOExt_JS_MediaItemGuid(i)
	{
		updateHTML("aMediaItemGuid", i);
	}
	 
	// Sends the current mediaitem duration on update (Number)
	function UMOExt_JS_MediaItemDuration(i)
	{
		updateHTML("aMediaItemDuration", i);
	}

	// Sends the current mediaitem entity name (String)
	function UMOExt_JS_MediaItemEntityName(i)
	{
		updateHTML("aMediaItemEntityName", i);
	}

	// Sends the current mediaitem type on update (String) 	
	function UMOExt_JS_MediaItemType(i)
	{
		updateHTML("aMediaItemType", i);
	}
	
	// Sends the current mediaitem keywords on update (String)
	function UMOExt_JS_MediaItemKeywords(i)
	{
		updateHTML("aMediaItemKeywords", i);
	}

	// Sends the current mediaitem description on update (String)
	function UMOExt_JS_MediaItemDescription(i)
	{
		updateHTML("aMediaItemDescription", i);
	}

	// Sends the current media item ad positions (Array)
	function UMOExt_JS_MediaItemAdBreaks(i)
	{
		var adArray = i;
		var adList = adArray.length + " ads: (";
		for (var i = 0; i < adArray.length; i++)
		{
			adList = adList + " " + i + ": " + adArray[i].Duration + adArray[i].Type + "@" + adArray[i].SecondsIn + " ";
		}
		adList = adList + ")";
		
		updateHTML("aMediaItemAdBreaks", adList);
	}

	// Sends the current medaiitem rating on update (String)
	function UMOExt_JS_MediaItemRating(i)
	{
		updateHTML("aMediaItemRating", i);
	}

	// Sends the current mediaitem thumbnail URL (String)
	function UMOExt_JS_MediaItemThumbnailURL(i)
	{
		updateHTML("aMediaItemThumbnailURL", i);
	}

	// Sends the original embed code for the player instance 
	function UMOExt_JS_PlayerEmbedCode(i)
	{
		updateHTML("aPlayerEmbedCode", i);
	}

	// Sends the current Video Ad URL
	function UMOExt_JS_AdMediaURL(i)
	{
		updateHTML("aAdMediaURL", i);
	}
	
	// Sends the current Video Ad Click URL
	function UMOExt_JS_AdMediaClickURL(i)
	{
		updateHTML("aAdMediaClickURL", i);
	}

	// Sends the current Companion Ad Array
	function UMOExt_JS_AdCompanionAds(i)
	{
		updateHTML("aCompanionAdArray", i.toString());
	}

	
	//////////  Revision 2 Items
	//			// Sends the current Playlist Name.
	//			function UMOExt_JS_PlaylistName(i)
	//			{
	//				updateHTML("aPlaylistName", i);
	//			}
	//			
	//			// Sends the current Playlist Thumbnail URL
	//			function UMOExt_JS_PlaylistThumbnailURL(i)
	//			{
	//				updateHTML("aPlaylistThumbnailURL", i);
	//			}
	//			
	//			// Sends the current Media Items Category
	//			function UMOExt_JS_MediaItemCategories(i)
	//			{
	//				updateHTML("aMediaItemCategories", i);
	//			}
	//			
	//			// Sends the current Entity Thumbnail URL
	//			function UMOExt_JS_EntityThumbnailURL(i)
	//			{
	//				updateHTML("aEntityThumbnailURL", i);
	//				}


 	//////////////////////////////////
 	// Outbound from Flex (States)
 	//////////////////////////////////

	// Sends the current volume of the player (Number, 0 - 10)
	function UMOExt_JS_PlayerVolumeState(i)
	{
		updateHTML("aPlayerVolumeState", i);
	}

	// Sends the current mute state of the player (uint, 0 = mute on, 1 = mute off)
	function UMOExt_JS_MuteState(i)
	{
		updateHTML("aMuteState", i);
	}

	// Sends the current player state, corresponding to a subset of fl.video.VideoState values (String)
	function UMOExt_JS_PlayerState(i)
	{
		updateHTML("aPlayerState", i);
	}

 	//////////////////////////////////
 	// Outbound from Flex (Events)
 	//////////////////////////////////
 	
 	// Called from Flex when Player is completly loaded and ready
//	function UMOExt_JS_PlayerReady() {

//		updateHTML("aPlayerReadyEvent", "Player Ready");
//		
//		thisMovie("flashobject").UMIExt_JS_AddEventListener("UMOExt_Evt_MediaItemPlayStart", "handle_UMOExt_Evt_MediaItemPlayStart");

//		thisMovie("flashobject").UMIExt_JS_AddEventListener("UMOExt_Evt_MediaItemPlayComplete", "handle_UMOExt_Evt_MediaItemPlayComplete");
//	}
	
	// Called from the Loader, fires before it actually loads the player SWF
//	function UMOExt_JS_PlayerLoaded()
//	{
//	    updateHTML("aPlayerLoadedEvent", "Player Loaded");
//	}
	
	// This is called from our Event Listener when the Player Ready event is received
	function handle_UMOExt_Evt_PlayerReady(s)
	{
		updateHTML("aEvents", "UMOExt_Evt_PlayerReady: " + s);
	}
	
    // This is called from our Event Listener when the Play Start event is received
//	function handle_UMOExt_Evt_MediaItemPlayStart(s) {
//	
//		updateHTML("aPlayerStartEvent", "Player Started");
//	}

	// This is called from our Event Listener when the Play Complete event is received
	function handle_UMOExt_Evt_MediaItemPlayComplete(s) {
	    alert("oye");
		updateHTML("aPlayerCompleteEvent", "Player Completed");
	}

	// This is called from our Event Listener when the Player State changes
	function handle_UMOExt_Evt_PlayerState(s)
	{
		updateHTML("aEvents", "handle_UMOExt_Evt_PlayerState: " + s);
	}
	
	// Adds an event listener for a specific event to execute an arbitrary javascript method
	function AddAllEventListeners(movie)
	{
		updateHTML("aEvents", "Adding event listeners...");

		updateHTML("aEvents", "  UMOExt_Evt_PlayerReady");
		thisMovie("flashobject").UMIExt_JS_AddEventListener("UMOExt_Evt_PlayerReady", "handle_UMOExt_Evt_PlayerReady");
		
		updateHTML("aEvents", "  UMOExt_Evt_PlayerLoaded");
		thisMovie("flashobject").UMIExt_JS_AddEventListener("UMOExt_Evt_PlayerLoaded", "UMOExt_Evt_PlayerLoaded");

		updateHTML("aEvents", "  UMOExt_Evt_PlayerState");
		thisMovie("flashobject").UMIExt_JS_AddEventListener("UMOExt_Evt_PlayerState", "handle_UMOExt_Evt_PlayerState");

		updateHTML("aEvents", "Done.\n");
	}
