<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Room.aspx.cs" Inherits="RM.Web.Live.Room" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
    <title>
        <%=liveName %>-<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("live_Room")%>
    </title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style type="text/css" media="screen">
        html, body { height: 100%; }
        body { margin: 0; padding: 0; overflow: auto; text-align: center; background-color: #ececec; }
        #flashContent { display: none; }
        .closeLiveResult { width: 1000px; margin: 0 auto; }
        .closeLiveResult { margin-top: 10px; background-color: #FFF; border: 1px solid #DEDEDE; box-shadow: 0 6px 9px -8px rgba(0, 0, 0, 0.5); display: none; font-size: 16pt; font-weight: bold; color: #4cb7db; text-align: center; height: 300px; line-height: 300px; }
        .warningImg { vertical-align: middle; }
    </style>
    <link rel="stylesheet" type="text/css" href="history/history.css" />
    <script type="text/javascript" src="history/history.js"></script>
    <script type="text/javascript" src="swfobject.js"></script>
    <script src="../Themes/Scripts/jquery-1.8.2.min.js" type="text/javascript"></script>
    <link href="../Themes/Scripts/ShowMsg/msgbox.css" rel="stylesheet" type="text/css" />
    <script src="../Themes/Scripts/ShowMsg/msgbox.js" type="text/javascript"></script>
</head>
<body>
<div style=" height:53px; background-color:White;">
        <div style=" width:1000px; margin:0 auto; text-align:left;"><img src="Images/liveroom_logo.gif" />
        
        <div style=" float:right; font-size:12px; margin-right:10px; margin-top:20px;" id="headname"></div>
        </div>
</div>


    <div id="page" style="width: 100%;">
        <div id="flashContent">
            <p>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("live_Room_flash")%>.
            </p>
            <script type="text/javascript">
                var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
                document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
								+ pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>"); 
            </script>
        </div>
        <noscript>
            <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"
                id="TKSLIVE">
                <param name="movie" value="TKSLIVE.swf" />
                <param name="quality" value="high" />
                <param name="bgcolor" value="#ececec" />
                <param name="allowScriptAccess" value="sameDomain" />
                <param name="allowFullScreen" value="true" />
                <!--[if !IE]>-->
                <object type="application/x-shockwave-flash" data="TKSLIVE.swf" width="100%" height="100%">
                    <param name="quality" value="high" />
                    <param name="bgcolor" value="#ececec" />
                    <param name="allowScriptAccess" value="sameDomain" />
                    <param name="allowFullScreen" value="true" />
                    <!--<![endif]-->
                    <!--[if gte IE 6]>-->
                    <p>
                        Either scripts and active content are not permitted to run or Adobe Flash Player
                        version 10.0.0 or greater is not installed.
                    </p>
                    <!--<![endif]-->
                    <a href="http://www.adobe.com/go/getflashplayer">
                        <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
                            alt="Get Adobe Flash Player" />
                    </a>
                    <!--[if !IE]>-->
                </object>
                <!--<![endif]-->
            </object>
        </noscript>
    </div>


    

    <div class="closeLiveResult" id="closeWarning">
        <img src="/LiveTelecast/Images/LiveWarning.png" alt="" class="warningImg" />
        <span id="warningText">
            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("live_Room_end")%></span>
    </div>

   
    <script type="text/javascript">
     var a="<%=item.LiveTelecast_CreateUserId%>";  
    var b="<%=LiveTelecast_TeacherId %>";
    if(a!=b){
    var flashvars = {
            	rid:'<%=roomId %>',
            	name:'<%=item.LiveTelecast_CreateUserName %>',
            	id:'<%=item.LiveTelecast_CreateUserId%>',
            	type:<%=item.LiveTelecast_InType=="3"?0:item.LiveTelecast_InType=="1"?1:item.LiveTelecast_InType=="2"?1:item.LiveTelecast_InType=="4"?1:0 %>,
            	rtmpGo:'<%=RM.Common.DotNetConfig.ConfigHelper.GetAppSettings("rtmpGo")%>', 
            	rtmpVideo:'<%=RM.Common.DotNetConfig.ConfigHelper.GetAppSettings("RmtpURL")%>',
            	rtmpWhiteboard:'<%=RM.Common.DotNetConfig.ConfigHelper.GetAppSettings("RmtpURL")%>',
            	tkspath: tksurl,
                record:'<%=IsVideo%>',
                bookname:"<%=LiveTelecast_Name%>",
                data:"<%=LiveTelecast_StartDate%>",
                createuserName:"<%=LiveTelecast_Teacher%>"
     };
    var swfVersionStr = "10.0.0";
    var xiSwfUrlStr = "playerProductInstall.swf";
    var tksurl='http://'+window.location.host;
    var params = {quality:"high",bgcolor:"#ececec",allowscriptaccess:"sameDomain",allowfullscreen:"true"};
    var attributes = {id:"TKSLIVE",name:"TKSLIVE",align:"middle"};

        var id = getCookie("liveroomT-"+flashvars.rid);
        if(id == flashvars.id){
                    showWarning("很抱歉，您已经被管理员T出直播间！");
                    location.replace();
        }
        else{
             document.getElementById("headname").innerHTML = "您好，"+flashvars.name;
              var h = document.documentElement.clientHeight;
              swfobject.embedSWF("TKSLIVE.swf", "flashContent", "1100",h-53,swfVersionStr, xiSwfUrlStr,flashvars, params, attributes);
              swfobject.createCSS("#flashContent", "display:block;text-align:left;");
       }
   }
   else{
        showWarning("请主讲人，使用软件登陆！！");
   }


    window.onbeforeunload = onbeforeunload_handler;
    function onbeforeunload_handler() {
        var warning = "";
        var fxControl = document.TKSLIVE || window.TKSLIVE;
        if (fxControl)
            if (typeof fxControl.getUnsavedDataWarning == "function")
                warning = fxControl.getUnsavedDataWarning();    //This calls a function in our Flex app  

        if (warning != '')
            return warning;
        else
            return void (0);
    }
    window.onunload = function () {
        var fxControl = document.TKSLIVE || window.TKSLIVE;
        if (fxControl)
            if (typeof fxControl.javascriptOnUnload == "function")
                fxControl.javascriptOnUnload();  // This calls a function in our Flex app  
    }
    
   
    function close() {
        ///<summary>
        ///踢出
        ///</summary>
        SetCookie("liveroomT-"+flashvars.rid,flashvars.id);
        showWarning("您已经被老师从直播间中移出！");
        reload();
    }
    function showWarning (text) {
            /// <summary>
            ///     1: 页面呈现指定的警告内容【注：此页面数据将被移除，不可再用】
            ///     &#10;    1.1 - showWarning(text) - 在页面中呈现指定的警告内容，同时将该页面数据清空，注：所有被清空的内容不再恢复，之后页面将无法进行任何操作
            /// </summary>
            /// <param name="text" type="String">
            ///     要显示的警告内容
            /// </param>
            /// <returns type="String" />
            var obj = document.getElementById('content');
            var closeBtn = document.getElementById('liveClose');
            var page = document.getElementById('page');
            if (obj) {
                obj.parentNode.removeChild(obj);
            }
            if (closeBtn) {
                closeBtn.parentNode.removeChild(closeBtn);
            }
            if(page){
                page.parentNode.removeChild(page);
            }
            document.getElementById('warningText').innerHTML = text ? text : '<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("live_Room_end")%>';
            document.getElementById('closeWarning').style.display = 'block';
             
            
    }
    function livelog(msg) {
        ///<summary>
        ///日志
        ///</summary>
        console.log(msg)
    }
    function SetCookie(name, value)
    {
        var Days = 1; 
        var exp = new Date();    //new Date("December 31, 9998");
        exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
        document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
    }

    function getCookie(name)//取cookies函数        
    {
        var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
        if (arr != null) return unescape(arr[2]); return null;
    }
    </script>
</body>
</html>
