<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Admin.Course.KS_CosPropGame" Codebehind="KS.CosPropInfo.aspx.cs" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.BLL" %>
<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" runat="server">
    
<link href="/admin/images/style.css" rel="stylesheet" type="text/css" />
<link href="/admin/images/style2.css" rel="stylesheet" type="text/css" />
<link href="/admin/images/Main.css" rel="stylesheet" />
<link href="/admin/images/popup.css" rel="stylesheet" />
<script src="/ks_inc/jquery.js"></script>
<script src="/ks_inc/kesion.common.js"></script>
    <div class="m-Popup">
	<div class="m-TabTitle clearfix">
		<span class="m-TabIcon1 curr">赠送积分</span>
		<span class="m-TabIcon2"<%=(!Kesion.Cache.CommonJsonCache.CheckYunAPPHasAllow("plus.wenjuan")?" style=display:none":"") %>>问卷调查</span>
		<span class="m-TabIcon3"<%=(!Kesion.Cache.CommonJsonCache.CheckYunAPPHasAllow("plus.announce")?" style=display:none":"") %>>>发布公告</span>
		<span class="m-TabIcon4">发布投票</span>
		<span class="m-TabIcon5">试卷</span>
		<span class="m-TabIcon6"<%=(!BaseFun.CheckModulePower("mall")?" style=display:none":"") %>>商品链接</span>
		<span class="m-TabIcon7">游戏其他</span>
	</div>
	<div class="m-TabCon">
        <!--通用js函数-->
        <script>
            var key = "";//搜索的关键字
            var keyid = "0";//搜索选项信息   名称或者id
            //搜索信息
            function search(p, num, type) {
                key = ""; keyid = "0";//初始化  清空数据  默认值
                switch (type) {
                    case "wenjuan"://问卷信息
                        key = document.getElementsByName("wenjuankey")[0].value;
                        if (key == "关键字") {
                            key = "";
                        }
                        for (var i = 0; i < document.getElementsByName("serachwenjuan").length; i++) {
                            var KS = document.getElementsByName("serachwenjuan")[i];
                            if (KS.checked == true) {
                                keyid = KS.value;//获取下拉的选项信息
                            }
                        }
                        showwenjuan(p, num);//ajax加载  搜索之后
                        break;
                    case "sj"://试卷信息
                        key = document.getElementsByName("sjkey")[0].value;
                        if (key == "关键字") {
                            key = "";
                        }
                        for (var i = 0; i < document.getElementsByName("searchsj").length; i++) {
                            var KS = document.getElementsByName("searchsj")[i];
                            if (KS.checked == true) {
                                keyid = KS.value;//获取下拉的选项信息
                            }
                        }
                        showsj(p, num);
                        break
                    case "shop"://商品信息
                        key = document.getElementsByName("shopkey")[0].value;
                        if (key == "关键字") {
                            key = "";
                        }
                        for (var i = 0; i < document.getElementsByName("searchshop").length; i++) {
                            var KS = document.getElementsByName("searchshop")[i];
                            if (KS.checked == true) {
                                keyid = KS.value;//获取下拉的选项信息
                            }
                        }
                        showshop(p, num)
                        break
                    case "game"://游戏
                        key = document.getElementsByName("gamekey")[0].value;
                        if (key == "关键字") {
                            key = "";
                        }
                        for (var i = 0; i < document.getElementsByName("searchgame").length; i++) {
                            var KS = document.getElementsByName("searchgame")[i];
                            if (KS.checked == true) {
                                keyid = KS.value;//获取下拉的选项信息
                            }
                        }
                        showgame(p, num);
                        break;
                    case "gonggao"://公告
                        key = document.getElementsByName("gongagokey")[0].value;
                        if (key == "关键字") {
                            key = "";
                        }
                        for (var i = 0; i < document.getElementsByName("searchgonggao").length; i++) {
                            var KS = document.getElementsByName("searchgonggao")[i];
                            if (KS.checked == true) {
                                keyid = KS.value;//获取下拉的选项信息
                            }
                        }
                        showgonggao(this, p, num);
                        break;
                    case "vote"://投票
                        key = document.getElementsByName("votekey")[0].value;
                        if (key == "关键字") {
                            key = "";
                        }
                        for (var i = 0; i < document.getElementsByName("searchvote").length; i++) {
                            var KS = document.getElementsByName("searchvote")[i];
                            if (KS.checked == true) {
                                keyid = KS.value;//获取下拉的选项信息
                            }
                        }
                        showtoupiao(this, p, num);
                        break;

                }

            }
            //关闭ajax
            function closeajax(type,id) {
                switch (type) {
                    case "wenjuan":
                        $("#showwenjuan").html("");//移除
                        $("#showwenjuan").hide();//隐藏
                        break;
                    case "sj":
                        $("#showsj").html("");//移除
                        $("#showsj").hide();//隐藏
                        break;
                    case "shop":
                        $("#showshop").html("");//移除
                        $("#showshop").hide();//隐藏
                        break;
                    case "game":
                        $("#showgame").html("");
                        $("#showgame").hide();
                        break;
                    case "gonggao":
                        $("#showgonggao" + id).html("");
                        $("#showgonggao" + id).hide();//隐藏绑定
                        break;
                    case "vote":
                        $("#showtoupiao" + id).html("");
                        $("#showtoupiao" + id).hide();//隐藏绑定
                        break;
                }
            }
        </script>
	    <div class="m-TabBox" style="display:block;" >
		   <div class="p-Giftpoints">
        <!-- 道具信息-->
               <script>
                   //移除积分信息
                   function removejifen(id) {
                       if (id == jQuery("#jifennum").val()) {
                           jQuery('#jifentr' + id).remove();
                           jQuery("#jifennum").val(parseInt(jQuery('#jifennum').val()) - parseInt(1));//积分num减一
                       }
                   }
                   //添加积分信息
                   function addjifen(timecount) {
                       var xiala = "";
                       for (var i = 1; i <= timecount; i++) {
                           xiala += "<option value='" + i + "'>" + i + "</option>";
                       }
                       var str = "";
                       var id = parseInt(jQuery('#jifennum').val()) + parseInt(1);//添加数据的编号
                       str += "<tr id='jifentr"+id+"' >";
                       str += "<td class='p-l-td'>播放时间达到：</td>";
                       str += "<td class='p-r-td'><div class='p-textBox'><i class='fr deleteBtnIcon' onclick='removejifen("+id+")'></i><select name='jifentime" + id + "' style='width:120px'><option selected='selected' value='0'>0</option>" + xiala + "</select>";
                       str += "<span>分钟时，启动道具，赠送</span><input name='getjifen" + id + "' type='text' class='textbox' style='width:50px;'><span>个积分</span></div> </td></tr>";
                       if (id <= timecount) {//添加数量小于总时长
                           jQuery('#jifen').append(str);
                           jQuery("#jifennum").val(parseInt(jQuery('#jifennum').val()) + parseInt(1));//积分num加一
                       }
                   }
               </script>
               <input type="hidden" name="jifennum" id="jifennum" value="1" />
		     <table class="p-commonTable" width="100%" border="0" cellpadding="0" cellspacing="0">
			    <tr>
				  <td class="p-l-td">课时信息：</td>
				  <td class="p-r-td"><%=periodname %></td>
				</tr>
				<tr>
				  <td class="p-l-td">视频播放状态：</td>
				  <td class="p-r-td">
					  <span class="p-radioBox"><input type="radio" name="jifentype" value="1" checked="checked"><label>暂停</label></span>
					  <span class="p-radioBox"><input type="radio" name="jifentype" value="0"><label>播放</label></span>
				  </td>
				</tr>
				<tr>
				  <td class="p-l-td">播放时间达到：</td>
				  <td class="p-r-td">
					  <i class="fr addBtnIcon" onclick="addjifen('<%=periodtimecount %>')"></i>
					  <div class="p-textBox">
						  <select name="jifentime1"  style="width:120px">
							<option selected="selected" value="0">0</option>
							<%=shijian(Utils.StrToInt(KSCMS.S("periodid"))) %>
						  </select>
						  <span>分钟时，启动道具，赠送</span><input name="getjifen1" type="text" class="textbox" style="width:50px;" value="0"><span>个积分</span>
                          <span style="color:red">(注意积分数量大于0且不能带小数点)</span>
					  </div> 
				  </td>
				</tr> 
                <tbody id="jifen">
                    
                </tbody>
			 </table>
		   </div>
		</div>
		<div class="m-TabBox">
		   <div class="p-Question">
        <!-- 问卷信息-->
               <script>
                   //移除问卷信息
                   function removewenjuan(id)  {
                       if (id == jQuery("#wenjuannum").val()) {
                           jQuery('#wenjuantr' + id).remove(); 
                           jQuery("#wenjuannum").val(parseInt(jQuery('#wenjuannum').val()) - parseInt(1));//问卷num减一
                       }
                   }
                   //添加问卷信息
                   function addwenjuan(timecount) {
                       var xiala = "";
                       for (var i = 1; i <= timecount; i++) {
                           xiala += "<option value='" + i + "'>" + i + "</option>";
                       }
                       var str = "";
                       var id = parseInt(jQuery('#wenjuannum').val()) + parseInt(1);//添加数据的编号
                       str += "<tr id=wenjuantr"+id+" >";
                       str += "<td class='p-l-td'>播放时间达到：</td>";
                       str += "<td class='p-r-td'><div class='p-textBox'><i class='fr deleteBtnIcon' onclick='removewenjuan(" + id + ")'></i><select name='wenjuantime" + id + "' style='width:120px'><option selected='selected' value='0'>0</option>" + xiala + "</select><span>分钟时，启动道具，一次做</span>";
                       str += "<input name='worknum" + id + "' type='text' class='textbox' style='width:50px;' value=2><span>个题目</span><input type='button' value='绑定问卷' class='button' onclick=showwenjuan(1," + id + ") ><input type='hidden' name='wenjuanid" + id + "' id='wenjuanid" + id + "' /><span class='blueFont' id='wenjuanname"+id+"'>这里是最新绑定的问卷</span></div></td>";
                       str += "</tr>";
                       if (id <= timecount) {//添加数量小于总时长
                           jQuery('#wenjuan').append(str);
                           jQuery("#wenjuannum").val(parseInt(jQuery('#wenjuannum').val()) + parseInt(1));//积分num加一
                       }
                   }
                   //显示问卷信息
                   function showwenjuan(p,num)
                   {
                       $("#showwenjuan").show();//显示
                       jQuery.ajax({
                           type: "post",
                           url: "KS.CosPropInfo.aspx",
                           data: { action: "getwenjuan", p: p, num: num, key: key, keyid: keyid },
                           contentType: "application/x-www-form-urlencoded; charset=utf-8",
                           success: function (data) {
                               key = ""; keyid = "0";//初始化  清空数据  恢复默认值
                               $("#showwenjuan").html(data);//显示试卷信息
                           }
                       });
                   }
                   //选择题库信息
                   function selectwenjuan(num)
                   {
                       var sid = null;
                       var name = null;
                        for (var i = 0; i < document.getElementsByName("wjid"+num).length; i++) {
                            var KS = document.getElementsByName("wjid" + num)[i];
                            var KSname = document.getElementsByName("wenjuanname" + num)[i];
                            if (KS.checked == true) {
                                sid = KS.value;
                                name = KSname.value;
                            }
                        }
                        jQuery("#wenjuanname"+num).html(name);//移除
                        jQuery("#wenjuanid" + num).val(sid);//将题库ID赋值
                        $("#showwenjuan").html("");//移除
                   }
                   
               </script>
               <input type="hidden" name="wenjuannum" id="wenjuannum" value="1" />
		     <table class="p-commonTable" width="100%" border="0" cellpadding="0" cellspacing="0">
			    <tr>
				  <td class="p-l-td">课时信息：</td>
				  <td class="p-r-td"><%=periodname %></td>
				</tr>
				<tr>
				  <td class="p-l-td">视频播放状态：</td>
				  <td class="p-r-td">
					  <span class="p-radioBox"><input type="radio" name="wenjuantype" value="1" checked="checked"><label>暂停</label></span>
					  <span class="p-radioBox"><input type="radio" name="wenjuantype" value="0"><label>播放</label></span>
				  </td>
				</tr>
				<tr>
				  <td class="p-l-td">播放时间达到：</td>
				  <td class="p-r-td">
				      <i class="fr addBtnIcon" onclick="addwenjuan('<%=periodtimecount %>')"></i>
					  <div class="p-textBox">
						  <select name="wenjuantime1" style="width:120px">
							<option selected="selected" value="0">0</option>
							<%=shijian(Utils.StrToInt(KSCMS.S("periodid"))) %>
						  </select>
						  <span>分钟时，启动道具，一次做</span><input name="worknum1" type="text" class="textbox" style="width:50px;" value="2"><span>个题目</span>
						  <input type="button" value="绑定问卷" class="button" onclick="showwenjuan(1,1)"><input type="hidden" name="wenjuanid1" id="wenjuanid1" />
                              <span class="blueFont" id="wenjuanname1">这里是最新绑定的问卷</span>
					  </div>
				  </td>
				</tr>
                 <tbody id="wenjuan">

                 </tbody>
                 <tbody id="showwenjuan">

                 </tbody>                 
			 </table>
		   </div>
		</div>
		<div class="m-TabBox">
		   <div class="p-Notice">
        <!-- 公告信息-->
               <script>
                   //移除公告
                   function removegonggao(id)
                   {
                       if (id == jQuery("#gonggaonum").val()) {
                           jQuery('#gonggaotr' + id).remove(); 
                           jQuery('#removetr' + id).remove();//删除整行
                           jQuery("#gonggaonum").val(parseInt(jQuery('#gonggaonum').val()) - parseInt(1));//问卷num减一
                       }
                   }
                   //添加公告
                   function addgonggao(timecount) {
                       var xiala = "";
                       for (var i = 1; i <= timecount; i++) {
                           xiala += "<option value='" + i + "'>" + i + "</option>";
                       }
                       var str = "";
                       var id = parseInt(jQuery('#gonggaonum').val()) + parseInt(1);//添加数据的编号
                       str += "<tr class='noneBorder' id=gonggaotr"+id+">";
                       str += "<td class='p-l-td'>播放时间达到：</td>";
                       str += "<td class='p-r-td'><div class='p-textBox'><i class='fr deleteBtnIcon' onclick='removegonggao(" + id + ")'></i><select name='gonggaotime" + id + "' style='width:120px'><option selected='selected' value='0'>0</option>" + xiala + "</select><span>分钟时，提示公告</span> <span class='TabNoticeB'><span class='NoticeB setBtn' onclick=shezhigonggao(this," + id + ")>设置公告</span>";
                       str += "<span class='NoticeB' onclick=showgonggao(this,1," + id + ")>绑定公告</span></span><span class='blueFont' id='sgonggaoname" + id + "'>这里是最新绑定的公告</span></div> <input type='hidden' name='gonggaoid" + id + "' id='gonggaoid" + id + "' /><input type='hidden' name='gonggaostatus" + id + "' id='gonggaostatus" + id + "' /></td></tr>";
                       str += "<tr id=removetr"+id+" >";
                       str += "<td colspan='2'class='p-0'><table class='TabConBox' border='0' cellpadding='0' cellspacing='0' width='100%'>";
                       str += "<tbody class='tabInner tabShow' id=gonggaoconten" + id + " >";
                       str += "<tr class='noneBorder'><td colspan='2'class='p-0 pt-0'><div class='p-listBox'style='padding-left:0;'><table width='100%' border='0' cellpadding='0' cellspacing='0'><tr class='noneBorder' >";
                       str += "<td class='p-l-td'>公告标题：<input type='hidden' name='addgonggaoid"+id+"' id='addgonggaoid"+id+"' value='0' /></td>";
                       str += "<td class='p-r-td'><input type='text' class='textbox' name='gongaotitle" + id + "'></td><td class='p-r-td' rowspan='2' align=right ><input type='button' value='确定设置' id='augonggao" + id + "' class='button' onclick='addorupdategonggao(" + id + ")' /></td></tr>";
                       str += "<tr class='noneBorder'><td class='p-l-td'>公告内容：</td><td class='p-r-td'>";
                       str += "<textarea class='textbox' name='gongaoIntro"+id+"' style='width:95%;height:80px'></textarea>";
                       str += "</td></tr><tr class='noneBorder'><td class='p-l-td'></td></tr></table></div></td></tr></tbody><tbody class='tabInner noneBorder' id=showgonggao" + id + "></tbody></table>";
                       str += "</td></tr>";
                       if (id <= timecount) {//添加数量小于总时长
                           jQuery('#gonggao').append(str);
                           jQuery("#gonggaonum").val(parseInt(jQuery('#gonggaonum').val()) + parseInt(1));//积分num加一
                       }
                   }
                   //绑定公告信息
                   function showgonggao(obj,p,num)
                   {
                       var $this = $(obj);
                       $this.addClass("setBtn").siblings().removeClass("setBtn");
                       jQuery("#sgonggaoname" + num).html("请选择绑定的公告信息");
                       jQuery('#gonggaostatus' + num).val("1");
                       jQuery('#gonggaoconten' + num).hide();
                       jQuery.ajax({
                           type: "post",
                           url: "KS.CosPropInfo.aspx",
                           data: { action: "getgonggao", p: p, num: num, key: key, keyid: keyid },
                           success: function (data) {
                               key = ""; keyid = "0";//初始化  清空数据  恢复默认值
                               $("#showgonggao" + num).html(data);//显示试卷信息
                               $("#showgonggao" + num).show();//显示绑定
                           }
                       });
                   }
                   //设置公告信息
                   function shezhigonggao(obj,id)
                   {
                       var $this = $(obj);
                       $this.addClass("setBtn").siblings().removeClass("setBtn");
                       var gonggaoid = document.getElementsByName("addgonggaoid" + id)[0].value;
                       if (gonggaoid == 0) {
                           jQuery("#sgonggaoname" + id).html("自主设置公告信息");
                       } else {
                           jQuery("#sgonggaoname" + id).html("修改公告信息");
                       }
                       jQuery('#gonggaostatus' + id).val("0");
                       jQuery('#gonggaoconten' + id).show();
                       $("#showgonggao" + id).html("");
                       $("#showgonggao" + id).hide();//隐藏绑定
                   }
                   //选择公告信息
                   function selectgonggao(num)
                   {
                       var sid = null;
                       var name = null;
                       for (var i = 0; i < document.getElementsByName("sgonggaoid" + num).length; i++) {
                           var KS = document.getElementsByName("sgonggaoid" + num)[i];
                           var KSname = document.getElementsByName("sgonggaoname" + num)[i];
                           if (KS.checked == true) {
                               sid = KS.value;
                               name = KSname.value;
                           }
                       }
                       jQuery("#sgonggaoname" + num).html(name);//将题库ID赋值
                       jQuery("#gonggaoid" + num).val(sid);//将题库ID赋值
                       $("#showgonggao"+num).html("");//移除
                   }
                   //确定设置公告信息以及修改公告信息
                   function addorupdategonggao(num)
                   {
                        //公告id进行判断新增还是修改   0-新增   其他修改
                        var gonggaoid = document.getElementsByName("addgonggaoid" + num)[0].value;
                        var gonggaotitle = document.getElementsByName("gongaotitle" + num)[0].value;
                        var gonggaocontent = document.getElementsByName("gongaoIntro" + num)[0].value;
                        if (gonggaotitle == "") { alert("请填写公告标题！"); return false; }
                        if (gonggaocontent == "") { alert("请填写公告内容！"); return false; }
                        jQuery.ajax({
                            type: "post",
                            url: "?action=addgonggao&title=" + gonggaotitle + "&content=" + gonggaocontent+"&gonggaoid="+gonggaoid,
                            success: function (data) {
                                jQuery("#gonggaoid" + num).val(data);//将公告ID赋值---存储信息使用的
                                jQuery("#addgonggaoid" + num).val(data)//将公告id赋值
                                jQuery("#sgonggaoname" + num).html(gonggaotitle);//将标题显示
                                jQuery('#gonggaoconten' + num).hide();//隐藏设置公告的信息
                                jQuery("#augonggao" + num).val("修改公告")//按钮文字变换
                            }
                        });
                   }
               </script>
               <input type="hidden" name="gonggaonum" id="gonggaonum" value="1" />
		     <table class="p-commonTable" width="100%" border="0" cellpadding="0" cellspacing="0">
			    <tr>
				  <td class="p-l-td">课时信息：</td>
				  <td class="p-r-td"><%=periodname %></td>
				</tr>
				<tr>
				  <td class="p-l-td">视频播放状态：</td>
				  <td class="p-r-td">
					  <span class="p-radioBox"><input type="radio" name="gonggaotype" value="1" checked="checked"><label>暂停</label></span>
					  <span class="p-radioBox"><input type="radio" name="gonggaotype" value="0"><label>播放</label></span>
				  </td>
				</tr>
				<tbody id="gonggao">
					<tr class="noneBorder">
					  <td class="p-l-td">播放时间达到：</td>
					  <td class="p-r-td">
						  <i class="fr addBtnIcon" onclick="addgonggao('<%=periodtimecount %>')"></i>
						  <div class="p-textBox">
							  <select name="gonggaotime1" style="width:120px">
								<option selected="selected" value="0">0</option>
							<%=shijian(Utils.StrToInt(KSCMS.S("periodid"))) %>
							  </select>
							  <span>分钟时，提示公告</span>
							  <span class="TabNoticeB">
								  <span class="NoticeB setBtn" onclick="shezhigonggao(this,1)">设置公告</span><input type="hidden" name="gonggaostatus1" id="gonggaostatus1" value="0" />
								  <span class="NoticeB" onclick="showgonggao(this,1,1)">绑定公告</span><input type="hidden" name="gonggaoid1" id="gonggaoid1" />
							  </span>
                              <span class="blueFont" id="sgonggaoname1">这里是最新绑定的公告</span>
						  </div>
					  </td>
					</tr>
					<tr>
					  <td colspan="2" class="p-0">
						<table class="TabConBox" border="0" cellpadding="0" cellspacing="0" width="100%" >
							<tbody class="tabInner tabShow" id="gonggaoconten1">
                                <tr class="noneBorder">
                                <td colspan='2'class='p-0 pt-0'>
                                <div class='p-listBox'style="padding-left:0;">
                                <table width='100%' border='0' cellpadding='0' cellspacing='0'>
								<tr class="noneBorder">
								  <td class="p-l-td">公告标题：<input type="hidden" name="addgonggaoid1" id="addgonggaoid1" value="0" /></td>
								  <td class="p-r-td">
									  <input type="text" class="textbox" name="gongaotitle1">
								  </td>
								  <td class="p-l-td" rowspan="2" align="center" ><input type="button" value="确定设置" id="augonggao1" class="button" onclick="addorupdategonggao(1)" /></td>
								</tr>
								<tr class="noneBorder">
								  <td class="p-l-td">公告内容：</td>
								  <td class="p-r-td">
									  <textarea class="textbox" name="gongaoIntro1" style="width:80%;height:80px"></textarea>
								  </td>
								</tr> 
                                </table>
                                </div>
                                </td>
                                </tr>
							</tbody>
                            <tbody id="showgonggao1" class="noneBorder"></tbody>
						</table>
					  </td>
					</tr>
				</tbody>
				<tr class="noneBorder">
				  <td class="p-l-td"></td>
				  <td class="p-r-td">
				  </td>
				</tr>
			 </table>
		   </div>
		</div>
		<div class="m-TabBox">
		   <div class="p-Vote">
        <!-- 发布投票 -->
               <script>
                   //移除投票信息
                   function removetoupiao(id)
                   {
                       if (id == jQuery("#toupiaonum").val()) {
                           jQuery('#toupiaotr' + id).remove();
                           jQuery('#removetoupiao' + id).remove();//删除整行
                           jQuery("#toupiaonum").val(parseInt(jQuery('#toupiaonum').val()) - parseInt(1));//问卷num减一
                       }
                   }
                   //添加投票信息
                   function addtoupiao(timecount) {
                       var xiala = "";
                       for (var i = 1; i <= timecount; i++) {
                           xiala += "<option value='" + i + "'>" + i + "</option>";
                       }
                       var str = "";
                       var id = parseInt(jQuery('#toupiaonum').val()) + parseInt(1);//添加数据的编号
                       str += "<tr class='noneBorder' id=toupiaotr"+id+" >";
                       str += "<td class='p-l-td'>播放时间达到：</td>";
                       str += "<td class='p-r-td'><div class='p-textBox'><i class='fr deleteBtnIcon' onclick='removetoupiao(" + id + ")'></i><select name='toupiaotime" + id + "' style='width:120px'><option selected='selected' value='0'>0</option>" + xiala + "</select><span>分钟时，开始投票</span> ";
                       str += "<span class='TabNoticeB'><span class='NoticeB setBtn' onclick='shezhitoupiao(this," + id + ")' >设置投票</span><span class='NoticeB' onclick='showtoupiao(this,1," + id + ")'>绑定投票</span></span>";
                       str += "<span class='blueFont' id='toupiaoname" + id + "'>这里是最新绑定的投票信息</span><input type='hidden' name='toupiaoid" + id + "' id='toupiaoid" + id + "' /><input type='hidden' name='toupiaostatus" + id + "' id='toupiaostatus" + id + "' value='0' /></div></td></tr>";
                       str += "<tr id=removetoupiao"+id+">";
                       str += "<td colspan='2' class='p-0'><table class='TabConBox' border='0' cellpadding='0' cellspacing='0' width='100%'>";
                       str += "<tbody class='tabInner tabShow' id=toupiaocontent" + id + "  >";
                       str += "<tr class='noneBorder'><td colspan='2' class='p-0'><div class='p-listBox'style='padding-left:0;'><table class='TabConBox' border='0' cellpadding='0' cellspacing='0' width='100%'><tr class='noneBorder'>";
                       str += "<td class='p-l-td'>投票标题：<input type='hidden' name='auvoteid" + id + "' id='auvoteid" + id + "' value='0' /></td>";
                       str += "<td class='p-r-td'><input type='text' class='textbox' name='Votetitle" + id + "'></td><td rowspan='2' align=center><input type='button' class='button fr' id='autoupiao1' value='确定设置' onclick=adddorupdatetoupiao(" + id + ") /></td></tr>";
                       str += "<tr class='noneBorder'><td class='p-l-td'>投票类型：</td><td class='p-r-td'>";
                       str += "<span class='p-radioBox'><input type='radio' name='vote" + id + "' value='0' checked='checked'><label>单选</label></span><span class='p-radioBox'><input type='radio' name='vote" + id + "' value='0'><label>多选</label></span>";
                       str += "</td></tr><tr class='noneBorder'><td class='p-l-td' >投票选项：</td><td class='p-r-td' id='answernum" + id + "-" + id + "'><input type='hidden' name='answernum" + id + "' id='answernum" + id + "' value='3' />";
                       str += "<div class='v-option'><span class='v-o-n'>(1)</span><input type='hidden' name='answerid" + id + "_1' id='answerid" + id + "_1' /><input type='text' class='textbox' name='answer" + id + "_1' /></div><div class='v-option'><span class='v-o-n'>(2)</span><input type='hidden' name='answerid" + id + "_2' id='answerid" + id + "_2' />";
                       str += "<input type='text' class='textbox' name='answer" + id + "_2' /></div><div class='v-option'><span class='v-o-n'>(3)</span><input type='hidden' name='answerid" + id + "_3' id='answerid" + id + "_3' /><input type='text' class='textbox' name='answer" + id + "_3' /></div>";
                       str += "</td></tr><tr class='noneBorder'><td class='p-l-td' ></td><td class='p-r-td'><a href='javascript:;' class='NoticeB' onclick='addanswer(" + id + ")' style='margin-left: 30px;'>增加选项</a></td></tr></table></div></td></tr></tbody><tbody class='tabInner noneBorder' id=showtoupiao" + id + "></tbody></table>";
                       str += "</td></tr>";
                       if (id <= timecount) {//添加数量小于总时长
                           jQuery('#toupiao').append(str);
                           jQuery("#toupiaonum").val(parseInt(jQuery('#toupiaonum').val()) + parseInt(1));//积分num加一
                       }
                   }
                   //显示绑定投票信息
                   function showtoupiao(obj,p, num)
                   {
                       var $this = $(obj);
                       $this.addClass("setBtn").siblings().removeClass("setBtn");
                       jQuery('#toupiaostatus' + num).val("1");
                       jQuery('#toupiaocontent' + num).hide();//设置的隐藏
                       jQuery.ajax({
                           type: "post",
                           url: "KS.CosPropInfo.aspx",
                           data: { action: "gettoupiao", p: p, num: num, key: key, keyid: keyid },
                           success: function (data) {
                               key = ""; keyid = "0";//初始化  清空数据  恢复默认值
                               $("#showtoupiao" + num).html(data);
                               $("#showtoupiao" + num).show();//显示绑定投票信息
                           }
                       });
                   }
                   //显示设置投票信息
                   function shezhitoupiao(obj,id)
                   {
                       var $this = $(obj);
                       $this.addClass("setBtn").siblings().removeClass("setBtn");
                       var auvoteid = document.getElementsByName("auvoteid" + id)[0].value;
                       if (auvoteid == 0) {
                           jQuery("#toupiaoname" + id).html("自主设置投票信息");
                       } else {
                           jQuery("#toupiaoname" + id).html("修改投票信息");
                       }
                       jQuery('#toupiaostatus' + id).val("0");
                       jQuery('#toupiaocontent' + id).show();
                       $("#showtoupiao" + id).html("");
                       $("#showtoupiao" + num).hide();//隐藏绑定
                   }
                   //选择投票信息
                   function selecttoupiao(num)
                   {
                       var sid = null;
                       var name = null;
                       for (var i = 0; i < document.getElementsByName("stoupiaoid" + num).length; i++) {
                           var KS = document.getElementsByName("stoupiaoid" + num)[i];
                           var KSname = document.getElementsByName("stoupaioname" + num)[i];
                           if (KS.checked == true) {
                               sid = KS.value;
                               name = KSname.value;
                           }
                       }
                       jQuery("#toupiaoname" + num).html(name);//将题库ID赋值
                       jQuery("#toupiaoid" + num).val(sid);//将题库ID赋值
                       $("#showtoupiao" + num).html("");//移除
                   }
                   //增加投票选项信息
                   function addanswer(id)//答案编号  从三开始
                   {
                       var str = "";
                       var aid = parseInt(jQuery('#answernum' + id).val()) + parseInt(1);//添加答案的编号
                       str += "<div class='v-option' id='ans" + id + "_" + aid + "'>";//第一个是答题编号  第二个是答案编号
                       str += "<i class='fr deleteBtnIcon' onclick='delanswer("+id+"," + aid + ")'></i>";
                       str += "<span class='v-o-n'>(" + aid + ")</span><input type='hidden' name='answerid" + id + "_" + aid + "' id='answerid" + id + "_" + aid + "' value='0' /><input type='text' class='textbox' name='answer" + id + "_" + aid + "' /></div>";
                       if (id <= 10) {//限制答案选项的数量
                           jQuery("#answernum"+ id+"-" + id).append(str);//显示新增选项信息
                           jQuery("#answernum"+id).val(parseInt(jQuery('#answernum'+id).val()) + parseInt(1));//小题答案选项数量加一
                       }
                   }
                   //删除投票选项信息 id-答题编号  aid-小题编号
                   function delanswer(id,aid)//删除选项小题
                   {
                       if (aid == jQuery("#answernum"+id).val()) {
                           jQuery('#ans' + id + "_" + aid).remove();//移除小题
                           jQuery("#answernum" + id).val(parseInt(jQuery('#answernum' + id).val()) - parseInt(1));//小题答案选项数量减一
                       }
                   }
                   //新增投票  以及修改投票
                   function adddorupdatetoupiao(num)
                   {
                       var data = "";//传递的选项答案信息参数组
                       var Votetitle = document.getElementsByName("Votetitle" + num)[0].value;//投票标题
                       if (Votetitle == "") { alert("请填写投票的标题"); return false; }//标题校验****
                       var vote = null;//存储的投票类型
                       for (var i = 0; i < document.getElementsByName("vote" + num).length ; i++)//投票类型
                       {
                           var KS = document.getElementsByName("vote" + num)[i];
                           if (KS.checked == true) {
                               vote = document.getElementsByName("vote" + num)[i].value
                           }
                       }
                       var voteid = jQuery('#auvoteid' + num).val();//投票主题的id   默认为0    其他修改
                       var votenum = jQuery('#answernum'+num).val();//投票选项的数量
                       for (var i = 1; i <= votenum; i++)
                       {
                           if (i <= 2) {//校验前两题的大难信息
                               if (document.getElementsByName("answer" + num + "_" + i)[0].value == "")//选项校验****
                               {
                                   alert("请在出现的选项中至少两个填写答案！");
                                   return false;
                               }
                           }
                           data += "&answer" + i + "=" + document.getElementsByName("answer" + num + "_" + i)[0].value;
                           if (voteid != 0)//不等于零  修改使用的参数信息
                           {
                               data += "&answerid" + i + "=" + document.getElementsByName("answerid" + num + "_" + i)[0].value;
                           }
                       }
                       var strs = new Array();//返回的数据存储数组
                       jQuery.ajax({
                           type: "post",
                           url: "?action=addtoupiao&title=" + Votetitle + "&type=" + vote + "&voteid=" + voteid + "&votenum=" + votenum,
                           data: data,
                           success: function (data) {
                               strs = data.split("&&");
                               jQuery("#toupiaoname" + num).html(Votetitle);//将投票主题显示
                               //第一个参数是投票主题id  strs[0]
                               jQuery("#toupiaoid" + num).val(strs[0]);//将投票ID赋值---存储道具信息使用的
                               jQuery("#auvoteid" + num).val(strs[0]);//将投票主题id赋值  判断修改或新增使用
                               for (var i = 1; i <= votenum; i++)
                               {
                                   jQuery("#answerid" + num + "_" + i).val(strs[i]);//将选项id信息保存
                               }
                               jQuery('#toupiaocontent' + num).hide();//隐藏设置投票的信息
                               jQuery("#autoupiao" + num).val("修改投票")//按钮文字变换
                           }
                       });
                   }
               </script>
               <input type="hidden" name="toupiaonum" id="toupiaonum" value="1" />
		     <table class="p-commonTable" width="100%" border="0" cellpadding="0" cellspacing="0">
			    <tr>
				  <td class="p-l-td">课时信息：</td>
				  <td class="p-r-td"><%=periodname %></td>
				</tr>
				<tr>
				  <td class="p-l-td">视频播放状态：</td>
				  <td class="p-r-td">
					  <span class="p-radioBox"><input type="radio" name="toupiaotype" value="1" checked="checked"><label>暂停</label></span>
					  <span class="p-radioBox"><input type="radio" name="toupiaotype" value="0"><label>播放</label></span>
				  </td>
				</tr>
				<tbody id="toupiao">
					<tr class="noneBorder">
					  <td class="p-l-td">播放时间达到：</td>
					  <td class="p-r-td">
						  <i class="fr addBtnIcon" onclick="addtoupiao('<%=periodtimecount %>')"></i>
						  <div class="p-textBox">
							  <select name="toupiaotime1" style="width:120px">
								<option selected="selected" value="0">0</option>
							    <%=shijian(Utils.StrToInt(KSCMS.S("periodid"))) %>
							  </select>
							  <span>分钟时，开始投票</span>
							  <span class="TabNoticeB">
								  <span class="NoticeB setBtn" onclick="shezhitoupiao(this,1)">设置投票</span><input type="hidden" name="toupiaostatus1" id="toupiaostatus1" value="0" />
								  <span class="NoticeB" onclick="showtoupiao(this,1,1)">绑定投票</span><input type="hidden" name="toupiaoid1" id="toupiaoid1" />
							  </span>
                              <span class="blueFont" id="toupiaoname1">这里是最新绑定的投票信息</span>
						  </div>
					  </td>
					</tr>
					<tr>
					  <td colspan="2" class="p-0">
                                
						<table class="TabConBox" border="0" cellpadding="0" cellspacing="0" width="100%" style="table-layout:fixed">
							<tbody class="tabInner tabShow" id="toupiaocontent1">
								<tr class="noneBorder">
								   <td colspan="2" class="p-0">
									   <div class='p-listBox'style="padding-left:0;">
										   <table class="TabConBox" border="0" cellpadding="0" cellspacing="0" width="100%">
											<tr class="noneBorder">
											  <td class="p-l-td">投票标题：<input type="hidden" name="auvoteid1" id="auvoteid1" value="0" /></td>
											  <td class="p-r-td">
												  <input type="text" class="textbox" name="Votetitle1">
											  </td>
												<td rowspan="2" align="center" ><input type="button" class="button fr" id="autoupiao1" value="确定设置" onclick="adddorupdatetoupiao(1)" /></td>
											</tr>
											<tr class="noneBorder">
											  <td class="p-l-td">投票类型：</td>
											  <td class="p-r-td">
												  <span class="p-radioBox"><input type="radio" name="vote1" value="1" checked="checked"><label>单选</label></span>
												  <span class="p-radioBox"><input type="radio" name="vote1" value="0"><label>多选</label></span>
											  </td>
											</tr>
											<tr class="noneBorder">
											  <td class="p-l-td">投票选项：</td>
											  <td class="p-r-td" id="answernum1-1">
												  <input type="hidden" name="answernum1" id="answernum1" value="3" /><!-- 答案选项的数量 -->
												  <div class="v-option" id="ans1_1"><span class="v-o-n">(1)</span><input type="hidden" name="answerid1_1" id="answerid1_1" /><input type="text" class="textbox" name="answer1_1" /></div>
												  <div class="v-option" id="ans1_2"><span class="v-o-n">(2)</span><input type="hidden" name="answerid1_2" id="answerid1_2" /><input type="text" class="textbox" name="answer1_2" /></div>
												  <div class="v-option" id="ans1_3"><span class="v-o-n">(3)</span><input type="hidden" name="answerid1_3" id="answerid1_3" /><input type="text" class="textbox" name="answer1_3" /></div>
											  </td>
											</tr>
											<tr class="noneBorder">
											  <td class="p-l-td"></td>
											  <td class="p-r-td">
												  <a href="javascript:;" class="NoticeB" onclick="addanswer(1)" style="margin-left: 30px;">增加选项</a>
											  </td>
											</tr>
										  </table>
									  </div>
								  </td>
								</tr>
							</tbody>
							<tbody class="tabInner noneBorder" id="showtoupiao1"></tbody>
						</table>
					  </td>
					</tr>
				</tbody>
				<tr class="noneBorder">
				  <td class="p-r-td" colspan="2">
					  <div id="Div1" class="message"><span class="state"><strong>操作说明：</strong></span>1.请注意设置视频播放时长<br>2.删除道具相关信息之后记得点击修改<br>3.推广链接请使用英文！</div>
				  </td>
				</tr>
			 </table>
		   </div>
		</div>
		<div class="m-TabBox">
		   <div class="p-Exam">
        <!--试卷信息-->
               <script>
                   //移除试卷
                   function removesj(id) {
                       if (id == jQuery("#sjnum").val()) {
                           jQuery('#sjtr' + id).remove();
                           jQuery("#sjnum").val(parseInt(jQuery('#sjnum').val()) - parseInt(1));//积分num减一
                       }
                   }
                   //添加试卷
                   function addsj(timecount) {
                           var xiala = "";
                           for (var i = 1; i <= timecount; i++) {
                               xiala += "<option value='" + i + "'>" + i + "</option>";
                           }
                           var str = "";
                           var id = parseInt(jQuery('#sjnum').val()) + parseInt(1);//添加数据的编号
                           str += "<tr id='sjtr"+id+"'>";
                           str += "<td class='p-l-td'>播放时间达到：</td>";
                           str += "<td class='p-r-td'><div class='p-textBox'><i class='fr deleteBtnIcon' onclick='removesj(" + id + ")'></i><select name='sjtime" + id + "' style='width:120px'><option selected='selected' value='0'>0</option>" + xiala + "</select><span>分钟时，启动道具</span><span class='TabNoticeB'>";
                           str += "<span class='NoticeB setBtn' onclick=showsj(1,"+id+")>绑定试卷</span><input type='hidden' name='sjid" + id + "' id='sjid" + id + "'  /></span><span class='blueFont' id='ssjname"+id+"'>这里是最新绑定的试卷</span></div></td></tr>";
                           
                           if (id <= timecount) {//添加数量小于总时长
                               jQuery('#sj').append(str);
                               jQuery("#sjnum").val(parseInt(jQuery('#sjnum').val()) + parseInt(1));//积分num加一
                           }
                   }
                   //显示试卷
                   function showsj(p,num)
                   {
                       $("#showsj").show();//显示试卷信息
                       jQuery.ajax({
                           type: "post",
                           url: "KS.CosPropInfo.aspx",
                           data: { action: "getsj", p: p, num: num, key: key, keyid: keyid },
                           success: function (data) {
                               key = ""; keyid = "0";//初始化  清空数据  恢复默认值
                               $("#showsj").html(data);//显示试卷信息
                           }
                       });
                   }
                   //选择试卷
                   function selectsj(num)
                   {
                       var sid = null;
                       var name = null;
                       for (var i = 0; i < document.getElementsByName("ssjid" + num).length; i++) {
                           var KS = document.getElementsByName("ssjid" + num)[i];
                           var KSname = document.getElementsByName("ssjname" + num)[i];
                           if (KS.checked == true) {
                               sid = KS.value;
                               name = KSname.value;
                           }
                       }
                       if (sid == "" || sid == null) {
                           alert("您未选择试卷信息！");
                           return false;
                       }
                       jQuery("#ssjname" + num).html(name);
                       jQuery("#sjid" + num).val(sid);//将题库ID赋值
                       $("#showsj").html("");//移除
                   }
               </script>
               <input type="hidden" name="sjnum" id="sjnum" value="1" />
		     <table class="p-commonTable" width="100%" border="0" cellpadding="0" cellspacing="0">
			    <tr>
				  <td class="p-l-td">课时信息：</td>
				  <td class="p-r-td"><%=periodname %></td>
				</tr>
				<tr>
				  <td class="p-l-td">视频播放状态：</td>
				  <td class="p-r-td">
					  <span class="p-radioBox"><input type="radio" name="sjtype" value="1" checked="checked"><label>暂停</label></span>
					  <span class="p-radioBox"><input type="radio" name="sjtype" value="0"><label>播放</label></span>
				  </td>
				</tr>
				<tbody id="sj">
					<tr>
					  <td class="p-l-td">播放时间达到：</td>
					  <td class="p-r-td">
						  <i class="fr addBtnIcon" onclick="addsj('<%=periodtimecount %>')"></i>
						  <div class="p-textBox">
							  <select name="sjtime1" style="width:120px">
								<option selected="selected" value="0">0</option>
							<%=shijian(Utils.StrToInt(KSCMS.S("periodid"))) %>
							  </select>
							  <span>分钟时，启动道具</span>
							  <span class="TabNoticeB">
								  <span class="NoticeB setBtn"  onclick="showsj(1,1)">绑定试卷</span><input type="hidden" name="sjid1" id="sjid1"  />
							  </span>
                              <span class="blueFont" id="ssjname1">这里是最新绑定的试卷</span>
						  </div>
					  </td>
					</tr> 
				</tbody>
                 <tbody id="showsj">

                 </tbody>
				<tr class="noneBorder">
				  <td class="p-r-td" colspan="2">
					  <div id="Div2" class="message"><span class="state"><strong>操作说明：</strong></span>1.请注意设置视频播放时长<br>2.删除道具相关信息之后记得点击修改<br>3.推广链接请使用英文！</div>
				  </td>
				</tr>
			 </table>
		   </div>
		</div>
		<div class="m-TabBox">
		   <div class="p-Shop">
        <!-- 商品链接 -->
                <script>
                    //移除商品
                    function removeshop(id)
                    {
                        if (id == jQuery("#shopnum").val()) {
                            jQuery('#shoptr' + id).remove();
                            jQuery("#shopnum").val(parseInt(jQuery('#shopnum').val()) - parseInt(1));//积分num减一
                        }
                    }
                    //添加商品信息
                    function addshop(timecount) {
                        var xiala = "";
                        for (var i = 1; i <= timecount; i++) {
                            xiala += "<option value='" + i + "'>" + i + "</option>";
                        }
                        var str = "";
                        var id = parseInt(jQuery('#shopnum').val()) + parseInt(1);//添加数据的编号
                        str += "<tr id=shoptr"+id+">";
                        str += "<td class='p-l-td'>播放时间达到：</td>";
                        str += "<td class='p-r-td'><div class='p-textBox'><i class='fr deleteBtnIcon' onclick='removeshop("+id+")'></i><select name='shoptime" + id + "' style='width:120px'><option selected='selected' value='0'>0</option>" + xiala + "</select>";
                        str += "<span>分钟时，启动道具</span><span class='TabNoticeB'><span class='NoticeB setBtn' onclick=showshop(1," + id + ") >商品绑定</span></span><span class='blueFont' id=shopname" + id + " >这里是最新绑定的商品</span><input type='hidden' name='shopid" + id + "' id='shopid" + id + "' /></div></td></tr>";
                        if (id <= timecount) {//添加数量小于总时长
                            jQuery('#shop').append(str);
                            jQuery("#shopnum").val(parseInt(jQuery('#shopnum').val()) + parseInt(1));//积分num加一
                        }
                    }
                    //显示商品信息
                    function showshop(p,num)
                    {
                        $("#showshop").show();//隐藏
                        jQuery.ajax({
                            type: "post",
                            url: "KS.CosPropInfo.aspx",
                            data: { action: "getshop", p: p, num: num, key: key, keyid: keyid },
                            success: function (data) {
                                key = ""; keyid = "0";//初始化  清空数据  恢复默认值
                                $("#showshop").html(data);//显示试卷信息
                            }
                        });
                    }
                    //选择商品信息
                    function selectshop(num)
                    {
                        var sid = null;
                        var name = null;
                        for (var i = 0; i < document.getElementsByName("sshopid" + num).length; i++) {
                            var KS = document.getElementsByName("sshopid" + num)[i];
                            var KSname = document.getElementsByName("sshopname" + num)[i];
                            if (KS.checked == true) {
                                sid = KS.value;
                                name = KSname.value;
                            }
                        }
                        if (sid == "" || sid == null)
                        {
                            alert("您未选择商品信息！");
                            return false;
                        }
                        jQuery("#shopname" + num).html(name);//将题库ID赋值
                        jQuery("#shopid" + num).val(sid);//将题库ID赋值
                        $("#showshop").html("");//移除
                    }
               </script>
               <input type="hidden" name="shopnum" id="shopnum" value="1" />
		     <table class="p-commonTable" width="100%" border="0" cellpadding="0" cellspacing="0">
			    <tr>
				  <td class="p-l-td">课时信息：</td>
				  <td class="p-r-td"><%=periodname %></td>
				</tr>
				<tr>
				  <td class="p-l-td">视频播放状态：</td>
				  <td class="p-r-td">
					  <span class="p-radioBox"><input type="radio" name="shoptype" value="1" checked="checked"><label>暂停</label></span>
					  <span class="p-radioBox"><input type="radio" name="shoptype" value="0"><label>播放</label></span>
				  </td>
				</tr>
				<tbody id="shop">
					<tr>
					  <td class="p-l-td">播放时间达到：</td>
					  <td class="p-r-td">
						  <i class="fr addBtnIcon" onclick="addshop('<%=periodtimecount %>')"></i>
						  <div class="p-textBox">
							  <select name="shoptime1" style="width:120px">
								<option selected="selected" value="0">0</option> 
							<%=shijian(Utils.StrToInt(KSCMS.S("periodid"))) %>
							  </select>
							  <span>分钟时，启动道具</span>
							  <span class="TabNoticeB">
								  <span class="NoticeB setBtn" onclick="showshop(1,1)">商品绑定</span>
							  </span>
							  <span class="blueFont" id="shopname1">这里是最新绑定的商品</span><input type="hidden" name="shopid1" id="shopid1" />
						  </div>
					  </td>
					</tr> 
				</tbody>
                 <tbody id="showshop">

                 </tbody>
				<tr class="noneBorder">
				  <td class="p-r-td" colspan="2">
					  <div id="Div3" class="message"><span class="state"><strong>操作说明：</strong></span>1.请注意设置视频播放时长<br>2.删除道具相关信息之后记得点击修改<br>3.推广链接请使用英文！</div>
				  </td>
				</tr>
			 </table>
		   </div>
		</div>
		<div class="m-TabBox">
		   <div class="p-Play">
        <!-- 游戏其他--> 
               <script>
                   //移除游戏
                   function removegame(id)
                   {
                       if (id == jQuery("#gamenum").val()) {
                           jQuery('#gametr' + id).remove();
                           jQuery("#gamenum").val(parseInt(jQuery('#gamenum').val()) - parseInt(1));//积分num减一
                       }
                   }
                   //添加游戏
                   function addgame(timecount) {
                             var xiala = "";
                             for (var i = 1; i <= timecount; i++) {
                                 xiala += "<option value='" + i + "'>" + i + "</option>";
                             }
                             var str = "";
                             var id = parseInt(jQuery('#gamenum').val()) + parseInt(1);//添加数据的编号
                             str += "<tr  id=gametr"+id+">";
                             str += "<td class='p-l-td'>播放时间达到：</td>";
                             str += "<td class='p-r-td'><div class='p-textBox'><i class='fr deleteBtnIcon' onclick='removegame("+id+")'></i><select name='gametime" + id + "' style='width:120px'><option selected='selected' value='0'>0</option>" + xiala + "</select>";
                             str += "<span>分钟时，启动道具</span><span class='TabNoticeB'><span class='NoticeB setBtn' onclick='showgame(1," + id + ")'>选择游戏库</span><input type='hidden' name='gameid" + id + "' id='gameid" + id + "' /></span><span class='blueFont' id='gamename" + id + "'>这里是最新绑定的游戏库</span></div></td></tr>";
                             if (id <= timecount) {//添加数量小于总时长
                                 jQuery('#game').append(str);
                                 jQuery("#gamenum").val(parseInt(jQuery('#gamenum').val()) + parseInt(1));//积分num加一
                             }
                   }
                   //显示游戏
                   function showgame(p,num)
                   {
                       $("#showgame").show();//显示试卷信息
                       jQuery.ajax({
                           type: "post",
                           url: "KS.CosPropInfo.aspx",
                           data: { action: "getgame", p: p, num: num, key: key, keyid: keyid },
                           success: function (data) {
                               key = ""; keyid = "0";//初始化  清空数据  恢复默认值
                               $("#showgame").html(data);//显示试卷信息
                           }
                       });
                   }
                   //选择游戏库
                   function selectgame(num)
                   {
                       var sid = null;
                       var name = null;
                       for (var i = 0; i < document.getElementsByName("sgameid" + num).length; i++) {
                           var KS = document.getElementsByName("sgameid" + num)[i];
                           var KSname = document.getElementsByName("sgamename" + num)[i];
                           if (KS.checked == true) {
                               sid = KS.value;
                               name = KSname.value;
                           }
                       }
                       jQuery("#gamename" + num).html(name);//将游戏库名
                       jQuery("#gameid" + num).val(sid);//将游戏库ID赋值
                       $("#showgame").html("");//移除
                   }
               </script>
               <input type="hidden" name="gamenum" id="gamenum" value="1" />
		     <table class="p-commonTable" width="100%" border="0" cellpadding="0" cellspacing="0">
			    <tr>
				  <td class="p-l-td">课时信息：</td>
				  <td class="p-r-td"><%=periodname %></td>
				</tr>
				<tr>
				  <td class="p-l-td">视频播放状态：</td>
				  <td class="p-r-td">
					  <span class="p-radioBox"><input type="radio" name="gametype" value="1" checked="checked"><label>暂停</label></span>
					  <span class="p-radioBox"><input type="radio" name="gametype" value="0"><label>播放</label></span>
				  </td>
				</tr>
				<tbody id="game">
					<tr>
					  <td class="p-l-td">播放时间达到：</td>
					  <td class="p-r-td">
						  <i class="fr addBtnIcon" onclick="addgame('<%=periodtimecount %>')"></i>
						  <div class="p-textBox">
							  <select name="gametime1" style="width:120px">
								<option selected="selected" value="0">0</option>
							<%=shijian(Utils.StrToInt(KSCMS.S("periodid"))) %>
							  </select>
							  <span>分钟时，启动道具</span>
							  <span class="TabNoticeB">
								  <span class="NoticeB setBtn" onclick="showgame(1,1)">选择游戏库</span><input type="hidden" name="gameid1" id="gameid1" />
							  </span>
                              <span class="blueFont" id="gamename1">这里是最新绑定的游戏库</span>
						  </div>
					  </td>
					</tr>
				</tbody>
                 <tbody id="showgame">

                 </tbody>
				<tr class="noneBorder">
				  <td class="p-r-td" colspan="2">
					  <div id="Div4" class="message"><span class="state"><strong>操作说明：</strong></span>1.请注意设置视频播放时长<br>2.删除道具相关信息之后记得点击修改<br>3.推广链接请使用英文！</div>
				  </td>
				</tr>
			 </table>
		   </div>
		</div>
	</div>
        <input name="propid" id="propid" type="hidden" value="<%=propid %>" />
        <input name="panaction" type="hidden" value="addorupdate" />
        <textarea name="propinfocontent" id="propinfocontent" style="display:none" ></textarea> 
        <div style="height:55px;"></div>
    <div class="main-button p-btnBox">
		<input type="submit" value="<%=buttonname %>" class="button" onclick="return (check());">
		<input type="button" value="取消返回(C)" class="button" onclick="parent.box.close();" >
	</div>
</div>
<script>
    //大框架切换效果
    $(function () {
        $(".m-TabTitle span").click(function () {
            $(this).addClass("curr").siblings().removeClass("curr");
            $('.m-TabCon>.m-TabBox:eq(' + $(this).index() + ')').show().siblings().hide();
        })
        //公告的切换
        $('.TabNoticeB').on('click', '.NoticeB', function () {
            $(this).addClass("setBtn").siblings().removeClass("setBtn");
            $(this).parents(".noneBorder").next().find('.tabInner').eq($(this).index()).addClass("tabShow").siblings().removeClass('tabShow');
        });
    })
</script>
    <script>
        var shifoutianjia = 1;//校验时间点标志判断能否增加数据库信息
        //var propnum = 0;//存储道具的总使用次数
        var propinfo = "";//存储的道具使用信息
        var time = "0";//存储的时间点
        //var status = 1;//是否提交的标志
        //校验数据
        function check()//校验提交表单
        {
            shifoutianjia = 0;
            //校验积分
            if (shifoutianjia == 0) {
                checkjifen();               
            }
            //校验问卷
                if (shifoutianjia==0) {
                    checkwenjuan();
                }
            //校验公告
                if (shifoutianjia == 0) {
                    checkgonggao();
                }
            //校验投票
                if (shifoutianjia == 0) {
                    checktoupiao();
                }
            //校验试卷
                if (shifoutianjia == 0) {
                    checksj();
                }
            //校验商品
                if (shifoutianjia == 0) {
                    checkshop();
                }
            //校验游戏
                if (shifoutianjia == 0) {
                    checkgame();
                }

                if (shifoutianjia == 1) {
                    return false;
                } else {
                    jQuery("#propinfocontent").html(propinfo);
                    //alert( jQuery("#propinfocontent").val());
                    return true;
                }
             
        }
        //校验积分相关信息
        function checkjifen()
        {
            if (document.getElementsByName("jifentime1")[0].value != 0) {//触发时间点不为0
                for (var i = 0; i < document.getElementsByName("jifentype").length ; i++)//投票类型
                {
                    var KS = document.getElementsByName("jifentype")[i];
                    if (KS.checked == true) {
                        propinfo += document.getElementsByName("jifentype")[i].value + "@@@";
                    }
                }
                //获取积分赠送数量
                var jifennum = jQuery('#jifennum').val();
                // propinfo += "[jifennum]" + jifennum + "[/jifennum]";//修改需要
                propinfo += jifennum + "@@@";
                //校验时间点----**************
                var checktime = new Array();
                if (jifennum >= 1) {//如果积分道具的数量大于1
                    for (var i = 1; i <= jifennum; i++) {
                        var jifentime = document.getElementsByName("jifentime" + i)[0].value;
                        shifoutianjia = 1;//校验时间点标志
                        checktime = time.split(",");
                        for (var p = 0; p < checktime.length; p++) {
                            if (jifentime == checktime[p]) {//时间点相同
                                shifoutianjia = 1;
                                propinfo = "";//清空数据
                                time = "";//清空时间点
                                alert("积分中道具使用的时间点冲突");
                                break;
                                //return false;
                            } else {
                                shifoutianjia = 0;
                            }
                        }
                        if (shifoutianjia == 0) {
                            time += "," + jifentime;
                            var getjifen = document.getElementsByName("getjifen" + i)[0].value;
                            if (parseInt(getjifen) == 0 || jifentime == "0") {
                                shifoutianjia = 1;
                                propinfo = "";//清空数据
                                time = "";//清空时间点
                                alert("请填写正确的积分时间或获取积分数量！");
                                break;
                            } else {
                                propinfo += document.getElementsByName("jifentime" + i)[0].value + "&&";
                                propinfo += document.getElementsByName("getjifen" + i)[0].value + "&#&";
                            }
                        } else {
                            break;
                        }
                    }
                }
            }
            if (shifoutianjia == 0) {
                propinfo += "#####";
            }
        }
        //校验问卷调查
        function checkwenjuan()
        {
            if (document.getElementsByName("wenjuantime1")[0].value != 0) {
                for (var i = 0; i < document.getElementsByName("wenjuantype").length ; i++)//投票类型
                {
                    var KS = document.getElementsByName("wenjuantype")[i];
                    if (KS.checked == true) {
                        propinfo += document.getElementsByName("wenjuantype")[i].value + "@@@";
                    }
                }
                var wenjuannum = jQuery('#wenjuannum').val();
                propinfo += wenjuannum + "@@@";//修改需要
                //校验时间点----**************
                var checktime = new Array();
                if (wenjuannum >= 1) {
                    for (var i = 1; i <= wenjuannum; i++)//循环问卷记录数
                    {
                        checktime = time.split(",");
                        var wenjuantime = document.getElementsByName("wenjuantime" + i)[0].value;//问卷出现的时间
                        var worknum = document.getElementsByName("worknum" + i)[0].value;//每次做题数量
                        var wenjuanid = document.getElementsByName("wenjuanid" + i)[0].value;//绑定问卷库的id
                        shifoutianjia = 1;//校验时间点标志
                        for (var p = 0; p < checktime.length; p++)
                        {
                            if (wenjuantime == checktime[p]) {//时间点相同
                                shifoutianjia = 1;
                                propinfo = "";//清空数据
                                time = "";//清空时间点
                                alert("问卷调查中道具使用的时间点与前面使用过的时间点冲突");
                                break;
                                //return false;
                            } else
                            {
                                shifoutianjia = 0;
                            }
                        }
                        //时间点不相同可以添加
                        if (shifoutianjia == 0) {
                            time += "," + wenjuantime;
                            propinfo += wenjuantime + "&&";
                            if (wenjuanid == "" || worknum == "") {
                                shifoutianjia = 1;
                                propinfo = "";//清空数据
                                time = "";//清空时间点
                                alert("请将先绑定问卷！"); break;
                            } else {
                                propinfo += wenjuanid + "&&";
                                propinfo += worknum + "&#&";
                            }
                        } else { break; }
                    }
                }
            }
            if (shifoutianjia == 0) {
                propinfo += "#####";
            }
        }
        //校验公告
        function checkgonggao()
        {
            if (document.getElementsByName("gonggaotime1")[0].value != 0) {
                for (var i = 0; i < document.getElementsByName("gonggaotype").length ; i++)//投票类型
                {
                    var KS = document.getElementsByName("gonggaotype")[i];
                    if (KS.checked == true) {
                        propinfo += document.getElementsByName("gonggaotype")[i].value + "@@@";
                    }
                }
                var gonggaonum = jQuery('#gonggaonum').val();
                propinfo += gonggaonum + "@@@";//修改需要
                //校验时间点----**************
                var checktime = new Array();
                if (gonggaonum >= 1) {
                    for (var i = 1; i <= gonggaonum; i++)//循环问卷记录数
                    {
                        checktime = time.split(",");
                        var gonggaotime = document.getElementsByName("gonggaotime" + i)[0].value;//问卷出现的时间
                        var gonggaoid = document.getElementsByName("gonggaoid" + i)[0].value;//绑定问卷库的id
                        shifoutianjia = 1;//校验时间点标志
                        for (var p = 0; p < checktime.length; p++)
                        {
                            if (gonggaotime == checktime[p]) {//时间点相同
                                shifoutianjia=1;
                                propinfo = "";//清空数据
                                time = "";//清空时间点
                                alert("发布公告中道具使用的时间点与前面使用过的时间点冲突");
                                return false;
                            } else {
                                //可以添加信息    确认
                                shifoutianjia=0;
                            }

                        }
                        if (shifoutianjia == 0)//校验时间点标志
                        {
                            time += "," + gonggaotime;
                            if (gonggaoid == "") {
                                shifoutianjia = 1;
                                propinfo = "";//清空数据
                                time = "";//清空时间点
                                alert("请绑定公告！"); break;
                            } else {
                                propinfo += gonggaotime + "&&";
                                propinfo += gonggaoid + "&#&";
                            }
                        }
                    }
                }
            }
            if (shifoutianjia == 0) {
                propinfo += "#####";
            }
        }
        //校验投票
        function checktoupiao()
        {
            if (document.getElementsByName("toupiaotime1")[0].value != 0) {
                for (var i = 0; i < document.getElementsByName("toupiaotype").length ; i++)//投票类型
                {
                    var KS = document.getElementsByName("toupiaotype")[i];
                    if (KS.checked == true) {
                        propinfo +=   document.getElementsByName("toupiaotype")[i].value + "@@@";
                    }
                }
                var toupiaonum = jQuery('#toupiaonum').val();
                propinfo += toupiaonum + "@@@"; //数量
                //校验时间点----**************
                var checktime = new Array();
                if (toupiaonum >= 1) {
                    for (var i = 1; i <= toupiaonum; i++)//循环问卷记录数
                    {
                        checktime = time.split(",");
                        var toupiaotime = document.getElementsByName("toupiaotime" + i)[0].value;//问卷出现的时间
                        var toupiaoid = document.getElementsByName("toupiaoid" + i)[0].value;//绑定问卷库的id
                        shifoutianjia = 1;//校验时间点标志
                        for (var p = 0; p < checktime.length; p++) {
                            if (toupiaotime == checktime[p]) {//时间点相同
                                shifoutianjia = 1;
                                propinfo = "";//清空数据
                                time = "";//清空时间点
                                alert("发布投票中道具使用的时间点与前面使用过的时间点冲突");
                                return false;
                            } else {
                                shifoutianjia = 0;
                            }
                        }
                        if (shifoutianjia == 0) {
                            //判断公告是自己设置的还是绑定的
                            time += "," + toupiaotime;
                            propinfo += toupiaotime + "&&";
                            if (toupiaoid == "") {
                                shifoutianjia = 1;
                                propinfo = "";//清空数据
                                time = "";//清空时间点
                                alert("请绑定投票！"); break;
                            } else {
                                propinfo += toupiaoid + "&#&";
                            }
                        }
                    }
                }
            }
            if (shifoutianjia == 0) {
                propinfo += "#####";
            }
        }
        //校验试卷
        function checksj()
        {
            if (document.getElementsByName("sjtime1")[0].value != 0) {
                for (var i = 0; i < document.getElementsByName("sjtype").length ; i++)//投票类型
                {
                    var KS = document.getElementsByName("sjtype")[i];
                    if (KS.checked == true) {
                        propinfo += document.getElementsByName("sjtype")[i].value + "@@@";
                    }
                }
                var sjnum = jQuery('#sjnum').val();
                propinfo += sjnum + "@@@";//修改需要
                //校验时间点----**************
                var checktime = new Array();//时间点数组
                if (sjnum >= 1) {
                    for (var i = 1; i <= sjnum; i++)//循环问卷记录数
                    {
                        checktime = time.split(",");
                        shifoutianjia = 1;//校验时间点标志
                        var sjtime = document.getElementsByName("sjtime" + i)[0].value;//问卷出现的时间
                        var sjid = document.getElementsByName("sjid" + i)[0].value;//绑定问卷库的id
                        for (var p = 0; p < checktime.length; p++)//校验时间点
                        {
                            if (sjtime == checktime[p]) {//时间点相同
                                shifoutianjia = 1;
                                propinfo = "";//清空数据
                                time = "";//清空时间点
                                alert("试卷中道具使用的时间点与前面使用过的时间点冲突！");
                                return false;
                            } else {
                                shifoutianjia = 0;
                            }
                        }
                        if (shifoutianjia == 0) {
                            time += "," + sjtime;
                            propinfo += sjtime + "&&";
                            if (sjid == "") {
                                shifoutianjia = 1;
                                propinfo = "";//清空数据
                                time = "";//清空时间点
                                alert("请绑定试卷！"); break;
                            } else {
                                propinfo += sjid + "&#&";
                            }
                        }
                    }
                }
            }
            if (shifoutianjia == 0) {
                propinfo += "#####";
            }
        }
        //校验商品
        function checkshop() 
        {
            if (document.getElementsByName("shoptime1")[0].value != 0) {
                for (var i = 0; i < document.getElementsByName("shoptype").length ; i++)//投票类型
                {
                    var KS = document.getElementsByName("shoptype")[i];
                    if (KS.checked == true) {
                        propinfo += document.getElementsByName("shoptype")[i].value + "@@@";
                    }
                }
                var shopnum = jQuery('#shopnum').val();
                propinfo += shopnum + "@@@";//修改需要
                //校验时间点----**************
                var checktime = new Array();//时间点数组
                if (shopnum >= 1) {
                    for (var i = 1; i <= shopnum; i++)//循环问卷记录数
                    {
                        shifoutianjia = 1;
                        checktime = time.split(",");
                        var shoptime = document.getElementsByName("shoptime" + i)[0].value;//问卷出现的时间
                        var shopid = document.getElementsByName("shopid" + i)[0].value;//绑定问卷库的id
                        for (var p = 0; p < checktime.length; p++)//校验时间点
                        {
                            if (shoptime == checktime[p]) {//时间点相同
                                shifoutianjia = 1;
                                propinfo = "";//清空数据
                                time = "";//清空时间点
                                alert("商品链接中道具使用的时间点与前面使用过的时间点冲突！");
                                return false;
                            } else {
                                shifoutianjia = 0;
                            }
                        }
                        if (shifoutianjia == 0) {
                            time += "," + shoptime;
                            propinfo +=  shoptime + "&&";
                            if (shopid == "") {
                                shifoutianjia = 1;
                                propinfo = "";//清空数据
                                time = "";//清空时间点
                                alert("请绑定商品！"); break;
                            } else {
                                propinfo += shopid + "&#&";
                            }
                        }
                    }
                }
            }
            if (shifoutianjia == 0) {
                propinfo += "#####";
            }
        }
        //校验游戏
        function checkgame()
        {
            if (document.getElementsByName("gametime1")[0].value != 0) {
                for (var i = 0; i < document.getElementsByName("gametype").length ; i++)//投票类型
                {
                    var KS= document.getElementsByName("gametype")[i];
                    if (KS.checked == true) {
                        propinfo += document.getElementsByName("gametype")[i].value + "@@@";
                    }
                }
                var gamenum = jQuery('#gamenum').val();
                propinfo += gamenum + "@@@";//修改需要
                //校验时间点----**************
                var checktime = new Array();//时间点数组
                if (gamenum >= 1) {
                    for (var i = 1; i <= gamenum; i++)//循环问卷记录数
                    {
                        shifoutianjia = 1;
                        checktime = time.split(",");
                        var gametime = document.getElementsByName("gametime" + i)[0].value;//问卷出现的时间
                        var gameid = document.getElementsByName("gameid" + i)[0].value;//绑定问卷库的id
                        for (var p = 0; p < checktime.length; p++)//校验时间点
                        {
                            if (gametime == checktime[p]) {//时间点相同
                                shifoutianjia = 1;
                                propinfo = "";//清空数据
                                time = "";//清空时间点
                                alert("游戏其他中道具使用的时间点与前面使用过的时间点冲突！");
                                return false;
                            } else {
                                shifoutianjia = 0;
                            }
                        }
                        if (shifoutianjia == 0) {
                            time += "," + gametime;
                            propinfo += gametime + "&&";
                            if (gameid == "") {
                                shifoutianjia = 1;
                                propinfo = "";//清空数据
                                time = "";//清空时间点
                                alert("请绑定游戏！"); break;
                            } else {
                                propinfo += gameid + "&#&";
                            }
                        }
                    }
                }
            }
            if (shifoutianjia == 0) {
                propinfo += "#####";
            }
        }
    </script>


</asp:Content>
