﻿
$(document).ready(function() {
    LoadSilverlight();
});

function LoadSilverlight() {
    // Create our install experience html
    var installExperienceHTML = '<div style="position:auto; text-align:left; background-repeat:no-repeat; height:420px; background-image:url(assets/faded_preinstall.png);">';
    installExperienceHTML += '  <div style="padding-left:140px; padding-top:170px;">';
    installExperienceHTML += '      <div id="InstallPromptDiv"></div>';
    installExperienceHTML += '  </div>';
    installExperienceHTML += '  <div id="PostInstallGuidance"style="width:100%; font-weight:bold; font-size:18px; font-family:sans-serif; height:auto; padding-top:50px;text-align:center; color:#fff; ';
    installExperienceHTML += '  font-weight:normal; font-size:11pt">&nbsp;</div>';
    installExperienceHTML += '</div>';

    // Calls installandcreatesilverlight method to instantiate silverlight once it is installed
    Silverlight.InstallAndCreateSilverlight('2.0.40115.0',
        document.getElementById('reproductor'),
		installExperienceHTML,
	    'InstallPromptDiv',
		createPlayer);
}

function createPlayer() {
    var showPlayer = $("#showPlayer").val();
    var streaming = $("#hidden_url").val();
    var type = $("#hidden_canal").val();
    var player = null;

    if (showPlayer == "True") {
        if (type == "audio") {
            img = $("#imgRadio").val();
            player = RTVCPlayer.embedSilverlight(streaming, img, null);
        }
        else {
            player = RTVCPlayer.embedSilverlight(streaming, null, null);
        }
    }
    else {
        player = RTVCPlayer.embedSilverlight(null, null, "copyrighted.jpg");
    }

    $("#reproductor").append(player);
}




