var cur_program = '',cur_type = 1,cur_platform = '',cur_showYear,cur_showCycle;
function search(){
	getProgramAnalysisList(1);
	if(cur_type == 4){
		//电影
		$('#program_placement_div_1').hide();
		$('#program_placement_div_2').hide();
	}else if(cur_type == 3){
		//电视剧
		//综艺、栏目
		$('#program_placement_thead').html('<tr>'+
				'<th>序号</th>'+
				'<th>节目名称</th>'+
				'<th>第几集</th>'+
				'<th>一级分类</th>'+
				'<th>首播日期</th>'+
				'<th>电视频道</th>'+
				'<th>收视率</th>'+
				'<th>视频平台</th>'+
				'<th>点击量(千万)</th>'+
				'<th>品牌数</th>'+
				'<th>频次(次)</th>'+
				'<th>时长(秒)</th>'+
				'<th>预估价格(万)</th>'+
			'</tr>');
		$('#program_placement_div_1').show();
		$('#program_placement_div_2').show();
	}else{
		//综艺、栏目
		$('#program_placement_thead').html('<tr>'+
				'<th>序号</th>'+
				'<th>节目名称</th>'+
				'<th>年份/季</th>'+
				'<th>一级分类</th>'+
				'<th>首播日期</th>'+
				'<th>电视频道</th>'+
				'<th>收视率</th>'+
				'<th>视频平台</th>'+
				'<th>点击量(千万)</th>'+
				'<th>冠名</th>'+
				'<th>特约</th>'+
				'<th>互动支持</th>'+
				'<th>合作伙伴</th>'+
				'<th>指定产品</th>'+
				'<th>指定用车</th>'+
			'</tr>');
		$('#program_placement_div_1').show();
		$('#program_placement_div_2').show();
	}
	
}

/**
 * 打开对标页
 * @returns {Boolean}
 */
function setBenchmark(){
	var item = $("input[name='item']:checked"), ids = [];
	if(item.length != 2){
		alert("请选择两个对标的节目。");
		return false;
	}
	item.each(function(){
		ids.push($(this).val());
	});
	window.open("program_marking.do?type="+cur_type+"&ids="+encodeURIComponent(ids.join("|")),"new");
}

/**
 * 切换时间
 */
function changeTab(day){
	var end_date = '', start_date = '';
	if(day > 0){
		end_date = new Date().addDate(-1).Format("yyyy-MM-dd"),
		start_date = new Date(end_date).addDate(-day).Format("yyyy-MM-dd");
		$('#start_time').val(start_date);
		$('#end_time').val(end_date);
	}else{
		$('#start_time').val('');
		$('#end_time').val('');
	}
	$(".text").input();
	search();
}

/**
 * 切换节目
 * @param program
 */
function changeProgram(program){
	cur_program = program;
	getPlacementDetail();
}

function getPlacementDetail(){
	getPlacementDetailList(1);
	getPieData(cur_type);
	getRatingChart(cur_type,'');
	getNetChart(cur_type,'');
	if(cur_type == 4){
		getMovieNetGroupChart();
	}else{
		getTvGroupChart(cur_type,'');
		getNetGroupChart(cur_type);
	}
	getRankList(cur_type);
	changeTagName();
	if(cur_type == 4){
		$('#tv_title').hide();
		$('#tv_div').hide();
	}else{
		$('#tv_title').show();
		$('#tv_div').show();
	}
}


function getProgramAnalysisList(page){
	page = page || 1;
	cur_type = $("#type").val();
	var pageSize = "10", data = {
		"pageNo": page,
		"pageSize": pageSize,
		"type": cur_type,
		"name": $("#keyword").val(),
		"beginDate": $("#start_time").val(),
		"endDate": $("#end_time").val()
	}, html = "";
	$("#program_analysis_page, #program_analysis_list").empty();
	ajax("ajax_program_analysis_list.do",data,function(res){
		if(res.code == 1 && res.list.length > 0){
			$.each(res.list, function(index, item){
				if(index == 0){
					cur_program = item.program_name;
					cur_platform = (item.rating ? item.rating.split('/')[0] : '');
					if(cur_type == 1 || cur_type == 2){
						cur_showYear = (item.show_year ? item.show_year : '');
						cur_showCycle = (item.show_cycle ? item.show_cycle : '');
					}
				}
				var brand_count_html = (cur_type == 4 ? "<a href='javascript:openShowAnalyseTv("+item.id+")'><span class='orange'>"+(item.brand_count ? item.brand_count : 0)+"</span></a>" : (item.brand_count ? item.brand_count : '0'));
				html += "<tr data-program='"+item.program_name+"' data-showcycle='"+item.show_cycle+"' data-showyear='"+item.show_year+"' data-platform='"+(item.rating ? item.rating.split('/')[0] : '-')+"'>"+
					"<td>"+$.orderNum(page,pageSize,index)+"</td>"+
					"<td>"+item.program_name+"</td>"+
					"<td>"+item.type.toString().decode(1,"综艺",2,"栏目",3,"电视剧",4,"电影","")+"</td>"+
					(cur_type == 3 || cur_type == 4 ? "<td>"+(item.first_type ? item.first_type : '-')+"</td>" : "") +
					"<td>"+(cur_type == 1 || cur_type == 2 ? (item.show_cycle == 1 ? (item.show_year ? item.show_year+"年" : '-') : (item.show_year ? "第"+item.show_year+"季" : '-')) : "-")+"</td>"+
					"<td>"+(item.rating ? item.rating.split('/')[0] : '-')+"</td>"+
					"<td>"+(item.rating ? item.rating.split('/')[1] : '-')+"</td>"+
					"<td>"+(item.net_platform ? (item.net_platform.split(',').length > 2 ? '全网' : item.net_platform) : '-')+"</td>"+
					"<td>"+(item.click_times ? (item.click_times * 10).toFixed(2) : '0')+"</td>"+
					"<td>"+brand_count_html+"</td>"+
					"<td>"+(item.ad_count ? item.ad_count : '0')+"</td>"+
					"<td>"+(item.ind_count ? item.ind_count : '0')+"</td>"+
					"<td>"+(item.frequency ? item.frequency : '0')+"</td>"+
					"<td>"+(item.length ? item.length : '0')+"</td>"+
					"<td>"+(item.price ? item.price : '0')+"</td>"+
					"<td><input type='checkbox' class='checkbox {click:itemCheck}' name='item' value='"+item.program_name+"' /><label></label></td>"+
				"</tr>";
			});
			$("#program_analysis_list").html(html);
			$.checkbox();
			//综艺栏目隐藏一级分类
			if(cur_type == 1 || cur_type == 2){
				$("#program_analysis_list_table tr").each(function() {
				   $(this).find("th").eq(3).addClass("contentTxt");
				 });
			}else{
				$("#program_analysis_list_table tr").each(function() {
				   $(this).find("th").eq(3).removeClass("contentTxt");
				 });
			}
			$.radio();
			var newpage = new createPage(res.count,page,pageSize,3,"programAnalysisPageGo");
			$("#program_analysis_page").html(newpage.pageHtml);
			$('#program_analysis_count').html(res.count);
		
			$(".table").hoverTable(true, true);
			/**
			 * 点击事件
			 */
			$("#program_analysis_list>tr>td:not(td:last-child)").on("click",function(){
				$(this).closest("tr").addClass("active").siblings().removeClass("active");
				cur_platform = $(this).closest("tr").data("platform") != '-' ? $(this).closest("tr").data("platform") : '';
				if(cur_type == 1 || cur_type == 2){
					cur_showYear = $(this).closest("tr").data("showyear");
					cur_showCycle = $(this).closest("tr").data("showcycle");
				}else{
					cur_showYear = '';
					cur_showCycle = '';
				}			
				changeProgram($(this).closest("tr").data("program"));
			});
			$("#program_analysis_list>tr:eq(0)>td:eq(1)").click();
		}else{
			$("#program_analysis_list").info("暂无数据。");
			$('#program_analysis_count').html(0);
		}
	});
}

programAnalysisPageGo = getProgramAnalysisList;



function getPlacementDetailList(page){
	page = page || 1;
	var pageSize = "10",name =  $("#keyword").val(),beginDate = $("#start_time").val(),
		endDate = $("#end_time").val(),data = {
		"pageNo": page,
		"pageSize": pageSize,
		"program":cur_program,
		"platform" : cur_platform,
		"type": cur_type,
		"name": name,
		"beginDate": beginDate,
		"endDate": endDate,
		"showYear" : cur_showYear,
		"showCycle" : cur_showCycle
	}, html = "";
	$("#placement_detail_page, #placement_detail_list").empty();
	ajax("ajax_program_placement_list.do",data,function(res){
		if(res.code == 1 && res.list.length > 0){
			$.each(res.list, function(index, item){
				//115|特斯拉|4/118|特斯拉|1,2/120|特斯拉|2,6
				var details = item.detail ? item.detail.split("/") : [];
				var ids = [],brands = [],forms = [];
				for(var i in details){
					var detail = details[i].split("|");
					ids.push(detail[0]);
					brands.push(detail[1]);
					forms.push(detail[2]);
				}
				
				html += "<tr>"+
					"<td>"+$.orderNum(page,pageSize,index)+"</td>"+
					"<td>"+item.program_name+"</td>"+
					"<td>"+(cur_type == 1 || cur_type == 2 ? (item.show_cycle == 1 ? item.show_year+"年" : "第"+item.show_year+"季") : "第"+item.episode+"集")+"</td>"+
					"<td>"+item.first_type+"</td>"+
					"<td>"+item.show_time+"</td>"+
					"<td>"+(item.platform?item.platform.split('/')[0]:'-')+"</td>"+
					"<td>"+(item.platform?item.platform.split('/')[1]:'-')+"</td>"+
					"<td>"+(item.net_platform ? (item.net_platform.split(',').length > 2 ? '全网' : item.net_platform) : '-')+"</td>"+
					"<td>"+(item.click_times ? (item.click_times * 10).toFixed(2) : '-')+"</td>";
					if(cur_type == 1 || cur_type == 2){
						html += "<td>"+isExistForm(forms,ids,brands,1)+"</td>"+
						"<td>"+isExistForm(forms,ids,brands,2)+"</td>"+
						"<td>"+isExistForm(forms,ids,brands,3)+"</td>"+
						"<td>"+isExistForm(forms,ids,brands,4)+"</td>"+
						"<td>"+isExistForm(forms,ids,brands,5)+"</td>"+
						"<td>"+isExistForm(forms,ids,brands,6)+"</td>";
					}else{
						html += "<td>"+(item.brandcount ? "<a href='javascript:openShowAnalyseTv("+item.id+")'><span class='orange'>"+item.brandcount+"</span></a>" : '-')+"</td>"+
						"<td>"+(item.frequency ? item.frequency : '-')+"</td>"+
						"<td>"+(item.length ? item.length : '-')+"</td>"+
						"<td>"+(item.price ? item.price : '-')+"</td>";
					}
				html += "</tr>";
			});
			$("#placement_detail_list").html(html);
			$(".table").hoverTable(true, true);
			var newpage = new createPage(res.count,page,pageSize,3,"placementDetailPageGo");
			$("#placement_detail_page").html(newpage.pageHtml);
			$('#placement_detail_count').html(res.count);
			/**
			 * 点击事件
			 */
			$(".table").hoverTable(true, true);
		}else{
			$("#placement_detail_list").info("暂无数据。");
			$('#placement_detail_count').html(0);
		}
	});
}

placementDetailPageGo = getPlacementDetailList;

function openShowAnalyse(id){
	var url = 'open_show_analyse.do?id='+id;
	$.openWindow('',url, 840, 610, true, null, 'auto');
}
function openShowAnalyseTv(id){
	var url = 'open_show_analyse_tv.do?id='+id;
	$.openWindow('',url, 840, 610, true, null, 'auto');
}
/**
 * 
 * @param arr1 forms
 * @param arr2 ids
 * @param arr3 brands
 * @param form
 * @returns {Array}
 */
function isExistForm(arr1,arr2,arr3,form){
	var index = [],html = "";
	for(var i in arr1){
		if(arr1[i].indexOf(form) > -1){
			index.push(i);
		}
	}
	for(var m in index){
		if(m != 0){
			html += ",";
		}
		html += "<a href='javascript:openShowAnalyse("+arr2[index[m]]+")'><span class='orange'>"+arr3[index[m]]+"</span></a>";
	}
	if(html == ''){
		html = '-';
	}
	return html;
}

function getPieData(type){
	var data = {
			"type" : type,
			"program": cur_program,
			"beginDate": $("#start_time").val(),
			"endDate": $("#end_time").val(),
			"platform" : cur_platform,
			"showYear" : cur_showYear
		};
	//program_arr = [];
	ajax("list_program_frqc_lth.do",data,function(res){
		if(res.code == 1 && res.list.length > 0){
			var legend = [];
			var series_frequency = [];
			var series_length = [];
			$.each(res.list, function(index, item){
				var program = item.brand + ((type == 1 || type == 2) ? (item.form ? ("-" + res.adMode[item.form-1].val) : '') : '');
				legend.push(program);
				//program_arr.push(item.program_name);
				var lv1 = {
						value:item.frequency, 
						name:program
				};
				series_frequency.push(lv1);
				var lv2 = {
						value:item.length, 
						name:program
				};
				series_length.push(lv2);
				if(index > 15){
					return false;
				}
			});
			trend_pie("频次分布",legend,series_frequency,'frequency_pie');
			trend_pie("时长分布",legend,series_length,'length_pie');
		}else{
			$("#frequency_pie,#length_pie").info("暂无数据。", true);
		}
	},false);
}

function getRatingCharts(type){
	getRatingChart(type,1,1);
	getRatingChart(type,2,1);
}

function getRatingRatio(obj){
	getRatingChart(cur_type,$(obj).val())
}

function getRatingRatio2(obj){
	getNetChart(cur_type,$(obj).val())
}

/**
 * 电视频道品牌软广植入受众人群一览
 * @param type 1综艺 2栏目 3电视剧 4电影
 * @param rateType 1：35城  2:29城
 * @param ratioValue 1：4岁以上   2：A18-45  3:F18-45     
 */
function getRatingChart(type,platform){
	var data = {
			"type" : type,
			"program": cur_program,
			"beginDate": $("#start_time").val(),
			"endDate": $("#end_time").val(),
			"platform" : cur_platform,
			"showYear" : cur_showYear
		};
	ajax("list_program_audience_rating.do",data,function(res){
		if(res.code == 1 && res.list.length > 0){
			var legend = ['收视率(%)','线性(收视率)'],xdata = [],ydata = [],ys = [],platforms = [],html = [];
			$.each(res.list, function(index, item){
				if(platform == '' && index == 0){
					platform = item.platform;
				}
				if(item.platform == platform){
					xdata.push("第"+item.phase+(cur_type == 1 || cur_type == 2 ? '期' : '集'));
					ydata.push(item.audience_rating_4);
				}
				platforms.push(item.platform);
			});
			ys = calTrendline(ydata);
			trendBarWithLine(legend,xdata,ydata,ys,'rating_35');
			
			platforms = unique(platforms);
			for(var i in platforms){
				html +='<input type="radio" name="rating_ratio_35" class="radio {click:getRatingRatio}" value="'+platforms[i]+'" '+(platforms[i] == platform ? 'checked' : '')+'/><label>'+platforms[i]+'</label>&nbsp;&nbsp;&nbsp;&nbsp;';
			}
			$("#rating_ratio_div").html(html);
			$.radio();
		}else{
			$("#rating_35").info("暂无数据。",true);
			$("#rating_ratio_div").html('');
		}
	},false);
}


/**
 * 网络综艺节目植入效果一览
 */
function getNetChart(type,platform){
	var data = {
			"type" : type,
			"program": cur_program,
			"beginDate": $("#start_time").val(),
			"endDate": $("#end_time").val(),
			"platform" : cur_platform,
			"showYear" : cur_showYear
		};
	ajax("list_program_net_clicktimes.do",data,function(res){
		if(res.code == 1 && res.list.length > 0){
			var legend = ['点击率(千万)','趋势(点击率)'],xdata = [],ydata = [],ys = [],platforms = [],html = "";
			if(platform != ''){
				$.each(res.list, function(index, item){
					if(item.platform_name == platform){
						xdata.push(item.phase);
						ydata.push(item.click_times);
					}
					platforms.push(item.platform_name);
					if(xdata.length > 9){
						return false;
					}
				});
				ys = calTrendline(ydata);
				trendBarWithLine(legend,xdata,ydata,ys,'net_chart');
			}else{
				$.each(res.list, function(index, item){
						platforms.push(item.platform_name);
						xdata.push(item.phase);
						xdata = unique(xdata);
						if(xdata.length > 9){
							return false;
						}
				});
				$.each(res.list, function(index, item){
					for(var i in xdata){
						if(xdata[i] == item.phase){
							ydata[i] = Math.round(((ydata[i] ? ydata[i] : 0)*100 + item.click_times*100)) / 100;
						}
					}
				});
				ys = calTrendline(ydata);
				trendBarWithLine(legend,xdata,ydata,ys,'net_chart');
			}
	
			if(platform == ''){
				html += '<input type="radio" name="net_ratio" class="radio {click:getRatingRatio2}" value="" checked/><label>综合</label>&nbsp;&nbsp;&nbsp;&nbsp;';
				platforms = unique(platforms);
				for(var i in platforms){
					if(i > 3){
						break;
					}
					html +='<input type="radio" name="net_ratio" class="radio {click:getRatingRatio2}" value="'+platforms[i]+'" '+(platforms[i] == platform ? 'checked' : '')+'/><label>'+platforms[i]+'</label>&nbsp;&nbsp;&nbsp;&nbsp;';
				}
				$("#net_ratio_div").html(html);
				$.radio();
			}	
		}else{
			$("#net_chart").info("暂无数据。",true);
			$("#net_ratio_div").html('');
		}
	},false);
}


/**
 * 节目电视人群构成
 */
function getTvGroupChart(type,platform){
	var data = {
			"type" : type,
			"program": cur_program,
			"beginDate": $("#start_time").val(),
			"endDate": $("#end_time").val(),
			"platform" : cur_platform,
			"showYear" : cur_showYear
		};
	ajax("list_program_audience_group.do",data,function(res){
		if(res.code == 1 && res.list.length > 0){
			var xdata = [],ydata = [],platforms = [],html = "";
			$.each(res.list, function(index, item){
				if(platform == '' && index == 0){
					platform = item.platform;
				}
				if(item.platform == platform){
					xdata.push('男');ydata.push(item.sex_man);
					xdata.push('女');ydata.push(item.sex_woman);
					xdata.push('1-17岁');ydata.push(item.age_17);
					xdata.push('18-24岁');ydata.push(item.age_18_24);
					xdata.push('25-30岁');ydata.push(item.age_25_30);
					xdata.push('31-35岁');ydata.push(item.age_31_35);
					xdata.push('36-40岁');ydata.push(item.age_36_40);
					xdata.push('41-50岁');ydata.push(item.age_41_50);
					xdata.push('51-60岁');ydata.push(item.age_51_60);
					xdata.push('60岁以上');ydata.push(item.age_60);
				}
				platforms.push(item.platform);
			});
			trendBar('电视受众人群构成',xdata,ydata,'tv_group_chart');
			
			for(var i in platforms){
				html +='<input type="radio" name="tv_group_ratio" class="radio {click:getTvGroupRatio}" value="'+platforms[i]+'" '+(platforms[i] == platform ? 'checked' : '')+'/><label>'+platforms[i]+'</label>&nbsp;&nbsp;&nbsp;&nbsp;';
			}
			$("#tv_group_ratios").html(html);
			$.radio();
		}else{
			$("#tv_group_chart").info("暂无数据。",true);
			$("#tv_group_ratios").html('');
		}
	},false);
}

function getTvGroupRatio(obj){
	getTvGroupChart(cur_type,$(obj).val())
}


/**
 * 节目网络人群构成
 */
function getNetGroupChart(type){
	var data = {
			"type" : type,
			"program": cur_program,
			"beginDate": $("#start_time").val(),
			"endDate": $("#end_time").val(),
			"platform" : cur_platform,
			"showYear" : cur_showYear
		};
	ajax("list_program_net_audience_group.do",data,function(res){
		if(res.code == 1 && res.list.length > 0){
			var xdata = [],ydata = [],html = "";
			$.each(res.list, function(index, item){
				xdata.push('男');ydata.push(item.sex_man);
				xdata.push('女');ydata.push(item.sex_woman);
				xdata.push('1-17岁');ydata.push(item.age_17);
				xdata.push('18-24岁');ydata.push(item.age_18_24);
				xdata.push('25-30岁');ydata.push(item.age_25_30);
				xdata.push('31-35岁');ydata.push(item.age_31_35);
				xdata.push('36-40岁');ydata.push(item.age_36_40);
				xdata.push('40岁以上');ydata.push(item.age_40);
			});
			trendBar('网络受众人群构成',xdata,ydata,'net_group_chart');
		}else{
			$("#net_group_chart").info("暂无数据。",true);
		}
	},false);
}

/**
 * 电影网络人群构成
 */
function getMovieNetGroupChart(){
	var data = {
			"type" : 4,
			"program": cur_program,
			"beginDate": $("#start_time").val(),
			"endDate": $("#end_time").val()
		};
	ajax("list_program_net_audience_group.do",data,function(res){
		if(res.code == 1 && res.list.length > 0){
			var legend = ['男','女'],series = [],xdata = [],ydata = [],html = "";
			$.each(res.list, function(index, item){
				var lv = {
						value:item.sex_man, 
						name:'男'
				};
				series.push(lv);
				lv = {
						value:item.sex_woman, 
						name:'女'
				};
				series.push(lv);
				
				xdata.push('1-17岁');ydata.push(item.age_17);
				xdata.push('18-24岁');ydata.push(item.age_18_24);
				xdata.push('25-30岁');ydata.push(item.age_25_30);
				xdata.push('31-35岁');ydata.push(item.age_31_35);
				xdata.push('36-40岁');ydata.push(item.age_36_40);
				xdata.push('40岁以上');ydata.push(item.age_40);
			});
			trend_pie_normal("男女比例",legend,series,'tv_group_chart');
			trendBar('网络受众人群构成',xdata,ydata,'net_group_chart');
		}else{
			$("#tv_group_chart").info("暂无数据。",true);
			$("#net_group_chart").info("暂无数据。",true);
		}
	},false);
}


/**
 * 节目及品牌软性广告投放排名
 */
function getRankList(type){
	var data = {
			"type" : type,
			"beginDate": $("#start_time").val(),
			"endDate": $("#end_time").val()
		},html="";
	ajax("list_program_analysis_rank.do",data,function(res){
		var colors = [];
		if(res.code == 1 && res.data){
			if(res.data.list1 && res.data.list1.length > 0){
				var list1 = sortProgramRankList(res.data.list1);
				var xdata = [],ydata = [];
				$.each(list1, function(index, item){
					xdata.push(item.num);
					ydata.push(item.rank + "-" + item.program_name);
					colors.push(item.program_name == cur_program ? '#EDD24D' : '#FE8E60');
				});
				trendHorizontalBar('收视率',xdata.reverse(),ydata.reverse(),'rank_char_1',colors.reverse());
			}else{
				$("#rank_char_1").info("暂无数据。");
			}
			var colors2 = [];
			if(res.data.list2 && res.data.list2.length > 0){
				var xdata = [],ydata = [];
				var list2 = sortProgramRankList(res.data.list2);
				$.each(list2, function(index, item){
					xdata.push(item.num);
					ydata.push(item.rank + "-" + item.program_name);
					colors2.push(item.program_name == cur_program ? '#EDD24D' : '#FE8E60');
				});
				trendHorizontalBar('点击率',xdata.reverse(),ydata.reverse(),'rank_char_2',colors2.reverse());
			}else{
				$("#rank_char_2").info("暂无数据。");
			}
			
		}else{
			$("#rank_char_1, #rank_char_2").info("暂无数据。");
		}
	},false);
}

/**
 * 控制字符串长度
 * @param str
 */
function retProgramName(str){
	var ret = '';
	if(str.length > 7){
		ret = str.substring(0,7);
		ret += "\n";
		ret += str.substring(7,str.length);
	}else{
		ret = str;
	}
	return ret;
}

/**
 * 查询品牌植入排名
 * @param oldList 传入全部数组
 * @returns {Array} 返回排名数组
 */
function sortProgramRankList(oldList){
	var newList = new Array(),top = 0;
	for(var i = 0; i < oldList.length ; i++){
		if(oldList[i].program_name == cur_program){
			top = oldList[i].rank;
			break;
		}
	}
	
	var start = (top - 9  > 0) ? top - 9 : 1;
	var end = (top + 10 > oldList.length) ? oldList.length : top + 10;
	if(end - start + 1 < 20){
		start = start - (20 - 1 - end + start);
	}
	
	for(var i = 0,j = 0;i < oldList.length; i++){
		if(oldList[i].rank >= start && oldList[i].rank <= end){
			newList[j] = oldList[i];
			j ++;
		}
	}
	return newList;
}


function changeTagName(){
	$("span[name='program_tag']").html("《" + cur_program + "》");
	$("span[name='type_tag']").html(cur_type.toString().decode(1,"综艺节目",2,"栏目",3,"电视剧",4,"电影",""));
	$("span[name='group_title1']").html(cur_type.toString().decode(1,"电视受众人群构成",2,"电视受众人群构成",3,"电视受众人群构成",4,"网络视频男女比例",""));
	$("span[name='group_title2']").html(cur_type.toString().decode(1,"网络视频人群构成",2,"网络视频人群构成",3,"网络视频人群构成",4,"网络视频年龄比例",""));
	$("span[name='net_title1']").html(cur_type.toString().decode(1,"电视台综艺节目收视排名",2,"电视台栏目收视排名",3,"电视剧收视率排名",4,"电影票房排名",""));
	$("span[name='net_title2']").html(cur_type.toString().decode(1,"视频网站综艺节目排名",2,"视频网站栏目排名",3,"电视剧点击量排名",4,"电影视频网站点击量排名",""));
}