<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="../common/common.jsp" %>
<title>品牌植入分析</title>
<script type="text/javascript">
$(function(){
	$.resetText();
    $(".text").input();
    //剧名称下拉
    var tvSelect = $('select[name="tv"]').select2({
    	placeholder: "请选择对标剧",
    	allowClear: true,
    	width:'150px',
    	ajax:{
            url: _PUBLIC_ +'ad-tv/select/list2.do',
    		dataType:'json',
    		quietMillis:100,
    		data:function(params){
    			return {
    				name : params.term,
                    ids: $("#ids").val(),
    				pageNo : params.page || 1,
    				pageSize : 20
    			}
    		},
    		processResults: function (data, params) {
    			params.page = params.page || 1;
    			return {
    		        results: data.results,
    		        pagination: {
    		          more: (params.page * 20) < data.total
    		        }
    		    };
    		},
    		cache: true
    	}
    });
});
function add(){
    var newId = $("#tv").val();
    if (newId.isEmpty()){
        top.alert("请选择对标剧");
        return false;
    }
	var ids = $("#ids").val() + ',' + newId;
    var startDate = $("#startDate").val(), endDate = $("#endDate").val(),day = $("#day").val();
	top.window.location.href='benchmarking.do?ids='+ids+'&startDate='+startDate+'&endDate='+endDate+'&day='+day;
}

</script>
</head>
<body>
<div class="" style="overflow: hidden;">
    <input type="hidden" name="ids" id="ids" value="${ids}"/>
    <input type="hidden" name="startDate" id="startDate" value="${startDate}"/>
    <input type="hidden" name="endDate" id="endDate" value="${endDate}"/>
    <input type="hidden" name="day" id="day" value="${day}"/>
	 <div class="">电视剧：
          <select id="tv" name="tv">
             <option value=""></option>
          </select>
     </div>
</div>
<div class="open-fixed-buttons">
	<a href="javascript:add();" class="btn-radius">确定</a>
	<a href="javascript:top.$.closeWindow();" class="btn-radius">关闭</a>
</div>
</body>
</html>