<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LearnMoblie.aspx.cs" Inherits="RM.Web.Training.Learn.LearnMoblie" %>

<%@ Register Src="~/UserControl/mobile_head.ascx" TagName="Head" TagPrefix="uc" %>
<%@ Register Src="~/UserControl/mobile_foot.ascx" TagName="Foot" TagPrefix="uc" %>
<!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">
<head>
    <title>
        <%=csname %>-<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Learn_zaixianxx")%>
    </title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
    <link href="/Themes/Styles/Mobile.css" rel="stylesheet" type="text/css" />
    <link type="text/css" href="/Themes/Styles/mobile_index.css" rel="stylesheet" />
    <style type="text/css">
    
    #xinxi img {
    width: 100%;
}
    </style>
</head>
<body>
    <uc:Head ID="Head1" runat="server" />
    <div id="noflash" style="text-align: center; display: none; border: 1px #ffdbad dotted;
        background-color: #fffadc; color: #ff6000; margin: 0.3em; padding: 0.2em;">
        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("learn_wjcdbfq")%></div>
    <div id="video" style="width: 100%;height:250px; margin:50px 0 auto; background-color: #000; background-image: url('m/learnplay_bg.gif');
        background-position: center;">
        <div id="a1">
        </div>
    </div>
    <iframe id="scormHtml" style="text-align: left; position: relative; background-color: #020301;
        background-image: url('m/learnplay_bg.gif'); background-position: center; background-repeat: no-repeat;
        z-index: 999; display: none; border: none; width: 98%;"></iframe>
    <ul class="play_vio_menu tc fs14">
        <li><a href="javascript:show(1)" id="hover">
            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Form_jj")%></a></li>
        <li><a href="javascript:show(2)">
            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ChapterIndex_zj")%></a></li>
        <li><a href="javascript:show(3)">
            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Button_pingjia")%></a></li>
        <li style="display:none;"><a href="javascript:show(4)">
            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Learn_down")%></a></li>
    </ul>
    <div class="Tmain  pb60" id="Tmain">
        <ul id="xinxi" class="play_jianjie p10">
            <li class="fwb fs14">
                <%=csname %>
                <% if (mylearn == "true")
                   {  %>
                <span style="float: right; border: 1px solid; color: #4e91db; padding: 2px 5px;"
                    onclick="javascript:delcourse('<%=mycsmodel.Courseware_CsID %>')" id="Span1">
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Learn_qxxk")%></span>
                <% }
                   else if (mylearn == "false")
                   {
                       if (mycsmodel.Courseware_Price == 0)
                       {
                %>
                <span style="float: right; border: 1px solid; color: #4e91db; padding: 2px 5px;"
                    onclick="javascript:selcourse('<%=mycsmodel.Courseware_CsID %>','<%=csname %>')"
                    id="leartStat">
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Plan_selcours")%></span>
                <%}
                       else
                       {%>
                <span style="float: right; border: 1px solid; color: #4e91db; padding: 2px 5px;"
                    onclick="javascript:addByCart('<%=csname %>','<%=mycsmodel.Courseware_CsID %>','','<%=mycsmodel.Courseware_Price %>','2', 'buy')">
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Mall_AppendShopInfo_Ljgm")%></span>
                <% }
                   } %>
            </li>
            <li>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_CourType_Kjfl")%>：<%=mycsmodel.TKS_CoursewareType.CoursewareType_CtName %></li><br />
            <hr style="border: 0; background-color: #f2f2f2; height: 2px;" />
            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Learn_bfzj")%>：<span id="cstitle"></span><br />
            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Learn_jkls")%>：<%=mycsmodel.Courseware_CsTeacher %><br />
            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Learn_peixuntype")%>：<%=mycsmodel.CoursewareType_CtName %><br />
            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Learn_kcjs")%>：<%=mycsmodel.Courseware_CsDiscription %><br />
            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("RandomQue_zysx")%>：<%=mycsmodel.Courseware_CsAttention %><br />
        </ul>
        <ul class="zhangjie" id="zhangjie" style="display: none;">
            <%=ziyuan %>
        </ul>
        <div class="interMain" id="interMain" style="display: none;">
        </div>
        <div class="interMain" id="Evaltext" style="display: none; width: 100%;">
        </div>
        <div class="zhangjie" id="download" style="display: none;">
            <%=xiazai %>
        </div>
    </div>
    <uc:Foot ID="Foot1" runat="server" />
    <script src="/Themes/Scripts/jquery-1.8.2.min.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/FunctionJS.js" type="text/javascript"></script>
    <script type="text/javascript" src="/Training/Learn/m/ckplayer/ckplayer.js" charset="utf-8"></script>
    <script src="/Live/swfobject.js" type="text/javascript"></script>
    <script src="/Training/Learn/m/LearnPC.js?aa=asas" type="text/javascript"></script>
    <script type="text/javascript">
        var jbid =0;
        var playTime = 0;  //全局变量，当前视频播放时间,单位秒
        var playVodieId = "";
        var dqbh = 0; //当前应该播放的视频索引，默认是0
        var flvurl = new Array(); //视频地址组
        var API="Phone";
       // <%=varstring %>
            <%try{ %>
        	<%=varstring.Substring(0,varstring.IndexOf("playload")) %>
            <%=varstring.Substring(varstring.IndexOf("'0'")+5) %>
            <%}catch{ %>
            <%=varstring %>
            <%} %>       
        if (!$("#scormHtml").is(":hidden")) {//如果是Scorm课件因为捕捉不了时间，只能计时
                var firstObj = $(".zhangjie").find("a").first();
                showHtml(firstObj, firstObj.attr("data"));
        } else {
            if(flvurl!=undefined && flvurl.indexOf(".swf")>=0){
                var mima=flvurl[dqbh];
                var params = { bgcolor: '#000', allowFullScreen: true, allowScriptAccess: 'always', wmode: 'opaque' };
                var flashvars = {};
                var attributes = { id: 'game_ring', name: 'game_ring' };
                swfobject.embedSWF(mima, "a1", "100%", "250px", "10.2.0", "/live/expressInstall.swf", flashvars, params, attributes);
            }else if (flvurl!=undefined && (flvurl.indexOf(".htm")>=0 ||flvurl.indexOf(".html")>=0)){
                if(mima.indexOf("width")<0){mima+="&width=320";}
                if(mima.indexOf("height")<0){mima+="&height=300";}
                    $("#a1").append("<iframe  style=\"text-align: left; background-color: #fff; background-position: center;background-repeat: no-repeat; border: none; width:100%;Height:300px;\" src='" + mima + "'></iframe>");
            }else{
//                var flashvars = {f: flvurl[dqbh],c: 0,b: 0,p: 1,e: 0,h: 3};
//                var video = [flvurl[dqbh] + '->video/mp4'];
//                     alert(flvurl[dqbh]);
//	            var support=['all'];
//	            CKobject.embedHTML5('a1','ckplayer_a1','100%',220,video,flashvars,support);
//                 dqbh = dqbh + 1; //把正在播放的视频的索引+1得到下个视频的索引用来做循环播放
//                if (dqbh >= flvurl.length) {
//                    //全部视频都播放完成后，目前回到第一个视频，也可以对用户进行提示
//                    dqbh = 0;
//                }
              
            }
         }       
        function ulyinchang(){
         $("#zhangjie").find("div").each(function(){
            $(this).click(function(i){
               // alert($("#ul_0").css('display'));
                var dis = $(this).attr("id");                
                var ss=dis.substring(dis.length-1);
                if($("#ul_"+ss).css("display")== "none"){
                    $("#ul_"+ss).attr("style", "");
                }
                else{
                    $("#ul_"+ss).attr("style", "display:none");
                }                               
            });
         });           
        }
    function ADDflash( Height, mima) {
        /// <summary>
        /// 增加FLASH组件
        /// </summary>        
        
    }

        //视频高度自适应
        function iframeresize() {
           
        }
        function show(id){
            $(".play_vio_menu a").removeAttr("id");
            $(".play_vio_menu a").eq(id-1).attr("id","hover")
            if(id==1)
            {
                $("#xinxi").show();
                $("#zhangjie").hide();
                $("#Evaltext").hide();
                $("#download").hide();
            }
            else if(id == 2)
            {
                $("#xinxi").hide();
                $("#zhangjie").show();
                $("#Evaltext").hide();
                $("#download").hide();
            }
            else if(id == 3)
            {
                $("#xinxi").hide();
                $("#zhangjie").hide();
                $("#Evaltext").show();
                $("#download").hide();
            }
            else
            {
                $("#xinxi").hide();
                $("#zhangjie").hide();
                $("#Evaltext").hide();
                $("#download").show();
            }
        }
        
//立即购买
//addByCart('系统操作演示','1daca5ef-c78a-4eec-aab7-dd8a76925e48','','500','2', 'buy')
//添加购物车购买
//addByCart('系统操作演示','10cf9a06-6565-4001-ad99-32bd7d606db3 ','10cf9a06-6565-4001-ad99-32bd7d606db3','2380','2', '')
function addByCart(shopname, shopid, property, price, type, buy) {
    var parm = "shopname=" + shopname + "&shopid=" + shopid + "&property=" + property + "&price=" + price + "&type=" + type + "&buy=" + buy;
    getAjax("/Mall/Order/AddShoppingCart.ashx", parm, function (rs) {
        if (rs == "1") {
            var thisTop = $("#csinfo_buycart").offset().top; //所在位置的高度
            var thisLeft = $("#csinfo_buycart").offset().left; //所在位置的宽度
            animatenTop(thisTop, thisLeft);
        }
        else if (rs == "2") {
            //alert("购物车false");
        }
        else if (rs == "3") {
            //alert("login");
            window.location.href = "/Frame/Login.aspx";
        }
        else if (rs == "0") {
            alert("info false");
        }
        else {
            window.location.href = "/Mall/Order/Mall_Finance_Order_m.aspx?" + rs;
        }
    });
}
//选课
function selcourse(shopid,shopname){
    $.post("/WebService/APP/course.ashx",
    {action:"selcourse",shopid:shopid, shopname:shopname,userid:"<%=userid %>"},
    function(date){
        var retdate = eval("("+date+")");
        if(retdate.state=="1"){
            if(retdate.mes=="no"){alert("课程已经存在！");}
            if(retdate.mes=="ok"){
                alert("选择课程成功！");
                window.location.href="/Training/Learn/Learn_ListMoblie.aspx";
            }
            if(retdate.mes=="1"){alert("购物车主表添加失败！");}
            if(retdate.mes=="2"){alert("购物车细表添加失败！");}        
        }else{
            alert("系统异常！");
        }
    });
}
//取消选课
function delcourse(csid){
    $.post("/Mall/DeleteOrderCS.ashx",
    {csid:csid,userid:"<%=userid %>"},
    function(data){ 
        if(data=="1"){
            alert("取消课程成功！");
            window.location.href="/Training/Learn/Learn_ListMoblie.aspx";
        }else{
            alert("取消课程失败！");
        }
    });
}
//播放记录 t=1播放 0 暂停   zanting = 1;
//$(function () {  
//<% if (mylearn == "true"){  %>  

//<%} %>
//});
    setInterval(Setlearntime, 10000); //统计学习时间,10秒统计1次，越小统计精度越大
//更新统计学习时间
function Setlearntime() {
    $.get("/Training/Learn/Interacts.ashx?Key=" + QueryString("Key") + "&t=" + zanting);
}

///声明常用变量
var PageIndex = 1;
var PageSize = 5;
var Order = "Evaluation_Date";
var OrderType = "desc";
var count = 0;
///异步查询评价
function GetEvaluation() {    
    var tid = QueryString("Key");
    var sqlwhere = " and Evaluation_TCID='"+tid+"'" ;
    var para = "sqlwhere=" + sqlwhere + "&&PageIndex=" + PageIndex + "&&PageSize=" + PageSize + "&&orderfile=" + Order + "&&ordertype=" + OrderType + "&&status=2";
    getAjax("/Mall/Evaluation.ashx", para, function (data) {
        if (data != "0") {
            var obj = eval('(' + data + ')')            
            var json = eval('(' + obj.str + ')')            
            textHtml(json);            
        } else {            
            $("#Evaltext").html("<tr><td  colspan='2'>暂无信息</td></tr>");            
        }
    });
}


///数据转换成html
function textHtml(data) {
    var str = "";
    for (var i = 0; i < data.length; i++) {
        var img = starImg(data[i].Evaluation_Star);
        str += "<tr>";
        str += "<td class=\"td1\"> <img style=\"margin-bottom: 5px;\" src=\"/Mall/User_Image.ashx?id=" + data[i].Evaluation_UserID + "\" width='59' height='59' /></td><td valign='top'> <span> " + data[i].Evaluation_UserName + " </span> <img  src=\"" + img + "\" /><br /><br /> <span>" + data[i].Evaluation_Content + "</span></td>";
        str += "</tr>";
    }
    if (str=="") {
    $("#Page").hide();
        str = "<tr ><td  colspan='2'>暂无信息</td></tr>";
    }   
    $("#Evaltext").html(str);
}
///判断星级 显示图片
function starImg(value) {
    if (value == 1) {
        return "/Template/default/Images/start_04.gif";
    } else if (value == 2) {
        return "/Template/default/Images/no_01.gif";
    }else if (value == 3) {
        return "/Template/default/Images/no_02.gif";
    }
    else if (value == 4) {
        return "/Template/default/Images/no_03.gif";
    }
    else {
        return "/Template/default/Images/sm_025.gif";
    }
}

 $(document).ready(function(){GetEvaluation();ulyinchang(); });
    </script>
</body>
</html>
