// JavaScript Document
var url = window.location.href;
var intPos = url.indexOf("="); 
var psiid = url.substr(intPos + 1);
var string = psiid.split("_");
var newPsiId;

var ENGLISH = 0;
var CHINESE = 1;

var PAT = 0;
var CAT = 1;
var BAT = 2;
var SDTo = 3;
var NITo = 4;
var NITa = 5;
var PMT = 6;
var SDTa = 7;

var psiName = ["PAT", "CAT", "BAT", "SDTo", "NITo", "NITa", "PMT", "SDTa"];

var cardArray = ["Card", "卡"];
var gbeArray = ["GbE", "网口"];
var portArray = ["Port", "端口"];

function getBreadcrumb()
{
	var slotno = string[1];
	var port = string[2];
	if(slotno == 7)
	{
		if(port <= 256)
		{
			$("#menuBar").html(" > "+ cardArray[language] + slotno + gbeArray[language] + "1" + portArray[language] + port + " > " + psiName[psiType]);
		}
		else
		{
			$("#menuBar").html(" > "+ cardArray[language] + slotno + gbeArray[language] + "2" + portArray[language] + (port-256) + " > " +psiName[psiType]);
		}
	}
	else
	{
		$("#menuBar").html(" > "+ cardArray[language] + slotno +  portArray[language] + port +" > " + psiName[psiType]);
	}
}

var submitcnt=0;
function GetRow(evt,idx)
{
	var img_obj;
	var td_obj;
	var tr_obj;
	var tb_obj;
	if(document.all)
	{
		img_obj = window.event.srcElement;
		td_obj = img_obj.parentElement;
		tr_obj = td_obj.parentElement;
		return tr_obj.cells[idx].outerText;
	}
	else
	{
		img_obj = evt.target;
		td_obj = img_obj.parentNode;
		tr_obj = td_obj.parentNode;
		return tr_obj.cells[idx].textContent;
	}
}
function jump() 
{
	var str = psiid.split("_");
	var str0 = "_";
	var str1 = str[0].concat(str0,str[1],str0,str[2]);
	top.mainFrame.location.href ="../psiedit.asp?ID="+str1;
}
function CreateHiddenFormElem(name,value)
{
	var tempform = document.getElementById("myform");
	var newInput = document.createElement("input");		//create new element 
	newInput.type = "hidden";	
	newInput.name = name;		
	newInput.value = value;			
	tempform.appendChild(newInput);	//Add new element to form
	return;
}
<!-- type1:descriotor type; type2:specific descriptor type;type3:operation:0,add;1,modify-->
function sendRequest(type2,type3)
{	
	$.ajaxSetup({cache:false});
	var ID = parseInt(type2,10);	
	switch(ID){
		case 2:
			$("#cur_desc_tag").val(2);
			$.get("video_stream_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		case 3:
			$("#cur_desc_tag").val(3);
			$.get("audio_stream_desc.asp",null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}					
			});
			break;
		case 5:
			$("#cur_desc_tag").val(5);
			$.get("regist_desc.asp",null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}					
			});
			break;
		case 6:
			$("#cur_desc_tag").val(6);
			$.get("video_align_desc.asp",null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}					
			});
			break;
		/*--special handling to distinguish video and audio.600 is defined by myself --*/
		case 600:
			$("#cur_desc_tag").val(6);
			$.get("audio_align_desc.asp",null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}					
			});
			break;
		case 9:
			$("#cur_desc_tag").val(9);
			$.get("ca_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		case 10:
			$("#cur_desc_tag").val(10);
			$.get("ISO_639_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- system clock descriptor -- */
		case 11:
			$("#cur_desc_tag").val(11);
			$.get("sys_clock_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- 多路复用缓冲描述符 -- */
		case 12:
			$("#cur_desc_tag").val(12);
			$.get("multi_buffer_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- maximum bitrate descriptor -- */
		case 14:
			$("#cur_desc_tag").val(14);
			$.get("max_bitrate_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- private_data_indicator_descriptor -- */
		case 15:
			$("#cur_desc_tag").val(15);
			$.get("private_indicate_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- smoothing buffer_descriptor -- */
		case 16:
			$("#cur_desc_tag").val(16);
			$.get("smooth_buffer_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*--network descriptor -- */
		case 64:
			$("#cur_desc_tag").val(64);
			$.get("net_name_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- service list descriptor -- */
		case 65:
			$("#cur_desc_tag").val(65);
			$.get("service_list_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- stuff descriptor -- */
		case 66:
			$("#cur_desc_tag").val(66);
			$.get("stuff_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- Satellite_Delivery_System_Descriptor -- */
		case 67:
			$("#cur_desc_tag").val(67);
			$.get("satellite_delivery_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- cable_delivery_system_descriptor -- */
		case 68:
			$("#cur_desc_tag").val(68);
			$.get("cable_delivery_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- bouquet_name_descriptor -- */
		case 71:
			$("#cur_desc_tag").val(71);
			$.get("bouquet_name_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- 业务描述符 -- */
		case 72:
			$("#cur_desc_tag").val(72);
			$.get("service_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- country_availability_descriptor -- */
		case 73:
			$("#cur_desc_tag").val(73);
			$.get("available_country_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- 链接描述符 -- */
		case 74:
			$("#cur_desc_tag").val(74);
			$.get("link_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- stream_identifier_descriptor -- */
		case 82:
			$("#cur_desc_tag").val(82);
			$.get("stream_identifier_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- CA_identifier_descriptor -- */
		case 83:
			$("#cur_desc_tag").val(83);
			$.get("ca_identifier_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- teletext_descriptor -- */
		case 86:
			$("#cur_desc_tag").val(86);
			$.get("teletext_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- telephone_descriptor -- */
		case 87:
			$("#cur_desc_tag").val(87);
			$.get("telephone_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- subtitling_descriptor -- */
		case 89:
			$("#cur_desc_tag").val(89);
			$.get("subtitle_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- terrestrial_delivery_system_descriptor -- */
		case 90:
			$("#cur_desc_tag").val(90);
			$.get("terrestrial_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- multilingual_network_name_descriptor -- */
		case 91:
			$("#cur_desc_tag").val(91);
			$.get("multi_net_name_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- multilingual_bouquet_name_descriptor -- */
		case 92:
			$("#cur_desc_tag").val(92);
			$.get("multi_bouq_name_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- 多语种业务名称描述符 -- */
		case 93:
			$("#cur_desc_tag").val(93);
			$.get("multi_serv_name_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- 专用数据说明描述符 -- */
		case 95:
			$("#cur_desc_tag").val(95);
			$.get("private_data_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- frequency_list_descriptor -- */
		case 98:
			$("#cur_desc_tag").val(98);
			$.get("freq_list_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- data_broadcast_descriptor -- */
		case 100:
			$("#cur_desc_tag").val(100);
			$.get("data_broadcast_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- AC-3_descriptor -- */
		case 106:
			$("#cur_desc_tag").val(106);
			$.get("ac3_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- AC-3_descriptor -- */
		case 122:
			$("#cur_desc_tag").val(122);
			$.get("ac3_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- LCN描述符 -- */
		case 131:
			$("#cur_desc_tag").val(131);
			$.get("lcn_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		/*-- custom descriptor -- */
		default:
			$("#cur_desc_tag").val(ID);
			$.get("custom_desc.asp", null, function (data, textStatus)
			{
				$("#container").html(data);
				if(type3 == 1)
				{
					GetDescInfo();
				}
			});
			break;
		}
	$.modal.close();
	$("#container").modal();
}
function modifydesc()//Modify descriptor
{
	var str="_";
	var rightclick_node = zTree.getSelectedNodes();
	var tempnodeid = rightclick_node[0].getParentNode().ID;
	var temppos = rightclick_node[0].POS;
	var finaldescid = tempnodeid.concat(str,temppos);//final desc_id	
	$("#CurDescId").val(finaldescid);	
	if(rightclick_node[0].level==2)//Modify Program descriptor
	{
		$("#Desc_OperateType").val("2");
	}
	else
	{
		$("#Desc_OperateType").val("4");
		if(rightclick_node[0].SDTSD==1)
		{
			$("#Desc_OperateType").val("5");
		}
	}
	var curdesctag = parseInt(rightclick_node[0].TAG);
	switch(curdesctag) {
		/* video stream descriptor*/
		case 2:
			sendRequest(2,1);
			break;
		/* audio stream descriptor*/
		case 3:
			sendRequest(3,1);
			break;
		/* registration descriptor*/
		case 5:
			sendRequest(5,1);
			break;
		/* video align descriptor*/
		case 6:
			var temptype = rightclick_node[0].getParentNode().eleType;
			if(temptype ==0)
			{
				sendRequest(6,1);
			}
			else
			{
				sendRequest(600,1);	
			}
			break;
		/* CA descriptor*/
		case 9:
			sendRequest(9,1);
			break;
		/* ISO-639 language descriptor*/
		case 10:
			sendRequest(10,1);
			break;
		/* system clock descriptor*/
		case 11:
			sendRequest(11,1);
			break;
		/* multi buffer descriptor*/
		case 12:
			sendRequest(12,1);
			break;
		/* maximum bitrate descriptor*/
		case 14:
			sendRequest(14,1);
			break;
		/* private data indicator descriptor*/
		case 15:
			sendRequest(15,1);
			break;
		/* smooth buffer descriptor*/
		case 16:
			sendRequest(16,1);
			break;
		/* network name descriptor*/
		case 64:
			sendRequest(64,1);
			break;
		/* service list descriptor*/
		case 65:
			sendRequest(65,1);
			break;
		/* stuffing descriptor*/
		case 66:
			sendRequest(66,1);
			break;
		/* satellite delivery system descriptor*/
		case 67:
			sendRequest(67,1);
			break;
		/* cable delivery system descriptor*/
		case 68:
			sendRequest(68,1);
			break;
		/* bouquet_name_descriptor*/
		case 71:
			sendRequest(71,1);
			break;
		/* service descriptor*/
		case 72:
			sendRequest(72,1);
			break;
		/* country_availability_descriptor*/
		case 73:
			sendRequest(73,1);
			break;
		/* linkage descriptor*/
		case 74:
			sendRequest(74,1);
			break;
		/* stream identifier descriptor*/
		case 82:
			sendRequest(82,1);
			break;
		/* CA_identifier_descriptor*/
		case 83:
			sendRequest(83,1);
			break;
		/* teletext descriptor*/
		case 86:
			sendRequest(86,1);
			break;
		/* telephone_descriptor*/
		case 87:
			sendRequest(87,1);
			break;
		/* subtitling descriptor*/
		case 89:
			sendRequest(89,1);
			break;
		/* terrestrial delivery system descriptor*/
		case 90:
			sendRequest(90,1);
			break;
		/* multilingual_network_name_descriptor*/
		case 91:
			sendRequest(91,1);
			break;
		/* multilingual_bouquet_name_descriptor*/
		case 92:
			sendRequest(92,1);
			break;
		/* multi language service name descriptor*/
		case 93:
			sendRequest(93,1);
			break;
		/* private data specifier descriptor*/
		case 95:
			sendRequest(95,1);
			break;
		/* frequency list descriptor*/
		case 98:
			sendRequest(98,1);
			break;
		/* data_broadcast_descriptor*/
		case 100:
			sendRequest(100,1);
			break;
		/* AC-3_descriptor*/
		case 106:
			sendRequest(106,1);
			break;
		/* Enhanced AC-3_descriptor*/
		case 122:
			sendRequest(122,1);
			break;
		/* LCN descriptor */
		case 131:
			sendRequest(131,1);
			break;
		/* custom descriptor(128...)*/
		default:
			sendRequest(curdesctag,1);
			break;
		}
}
function Assignment(language,response_array)
{
	if(response_array.length == 1)
	{
		return;
	}
	switch(parseInt(response_array[0]))
	{
		case 2:
			if(response_array[1] == 1)
			{
				$("#multi_frame_rate_flag").attr("checked",true);
			}
			else
			{
				$("#multi_frame_rate_flag").attr("checked",false);
			}
			$("#frame_rate_code").val(response_array[2]);
			if(response_array[3] == 1)
			{
				$("#mpeg_flag").attr("checked",true);
			}
			else
			{
				$("#mpeg_flag").attr("checked",false);	
			}
			if(response_array[4] == 1)
			{
				$("#con_param_flag").attr("checked",true);
			}
			else
			{
				$("#con_param_flag").attr("checked",false);	
			}
			if(response_array[5] == 1)
			{
				$("#still_pict_flag").attr("checked",true);
			}
			else
			{
				$("#still_pict_flag").attr("checked",false);	
			}
			if(response_array[3] == "1")
			{
				$("#profile").attr("disabled" ,false);
				$("#level").attr("disabled" ,false);
				$("#chroma_format").attr("disabled" ,false);
				$("#frame_rate_ex_flag").attr("disabled" ,false);
				$("#profile").val(response_array[6]);
				$("#level").val(response_array[7]);
				$("#chroma_format").val(response_array[8]);
				if(response_array[9] == 1)
				{
					$("#frame_rate_ex_flag").attr("checked",true);
				}
				else
				{
					$("#frame_rate_ex_flag").attr("checked",false);	
				}
			}
			else
			{
				$("#profile").attr("disabled" ,true);
				$("#level").attr("disabled" ,true);
				$("#chroma_format").attr("disabled" ,true);
				$("#frame_rate_ex_flag").attr("disabled" ,true);
			}			
			break;

		case 3:
			if(response_array[1] == 1)
			{
				$("#free_format_flag").attr("checked",true);
			}
			else
			{
				$("#free_format_flag").attr("checked",false);
			}
			$("#audio_id").val(response_array[2]);
			$("#layer").val(response_array[3]);
			break;
		case 5:
			$("#format_identifier").val(response_array[1]);
			$("#addition_ident_info").val(response_array[2]);
			break;
		case 6:
			$("#alignment_type").val(response_array[1]);
			break;
		case 9:
			$("#ca_system_id").val(response_array[1]);
			$("#ca_pid").val(response_array[2]);
			$("#private_data").val(response_array[3]);
			break;
		case 10:
			$("#audio_type").val(response_array[1]);
			$("#line").val(response_array[2]);
			for(var i=0;i<response_array[2];i++)
			{
				var codeList = document.getElementById("detail_edit_table");
				row = document.createElement("tr");
				col = document.createElement("td");
					col.innerHTML = response_array[3+i];
				row.appendChild(col);
				col= document.createElement("td");
					col.innerHTML = operateDel2;
				row.appendChild(col);
				codeList.appendChild(row);
			}
			break;
		case 11:
			if(response_array[1] == 1)
			{
				$("#exter_clk_refer_flag").attr("checked",true);
			}
			else
			{
				$("#exter_clk_refer_flag").attr("checked",false);
			}
			$("#clk_accuracy_inter").val(response_array[2]);
			$("#clk_accuracy_exp").val(response_array[3]);
			break;
		case 12:
			if(response_array[1] == 1)
			{
				$("#mdv_valid_flag").attr("checked",true);
				$("#multi_delay_vatiation").attr("disabled" ,false);
			}
			else
			{
				$("#mdv_valid_flag").attr("checked",false);
				$("#multi_delay_vatiation").attr("disabled" ,true);
			}
			$("#multi_delay_vatiation").val(response_array[2]);
			$("#strategy").val(response_array[3]);
			break;
		case 14:
			$("#max_bitrate").val(response_array[1]);
			break;
		case 15:
			$("#private_data_indicator").val(response_array[1]);
			break;
		case 16:
			$("#sb_leak_rate").val(response_array[1]);
			$("#sb_size").val(response_array[2]);
			break;
		case 64:
			$("#service_name").val(response_array[1]);
			break;
		case 65:
			var j = 0;
			$("#line").val(response_array[1]);
			for(var i=0;i<response_array[1];i++)
			{				
				var MultiLangList = document.getElementById("detail_edit_table");
				row = document.createElement("tr");
				col = document.createElement("td");
					col.innerHTML = response_array[2+j];
				row.appendChild(col);
				col = document.createElement("td");
					col.innerHTML = response_array[3+j];
				row.appendChild(col);
				col= document.createElement("td");
					col.innerHTML = operateDel2;
				row.appendChild(col);
				MultiLangList.appendChild(row);
				j=j+2;
			}
			break;
		case 66:
			$("#stuff_length").val(response_array[1]);
			$("#stuff_byte").val(response_array[2]);
			break;
		case 67:
			$("#frequency1").val(response_array[1]);
			$("#orbital_position1").val(response_array[2]);
			$("#west_east_flag").val(response_array[3]);
			$("#polarization").val(response_array[4]);
			$("#modulation").val(response_array[5]);
			$("#symbolrate1").val(response_array[6]);
			$("#fec_inner").val(response_array[7]);
			break;
		case 68:
			$("#frequency1").val(response_array[1]);
			$("#fec_outer").val(response_array[2]);
			$("#modulation").val(response_array[3]);
			$("#symbolrate1").val(response_array[4]);
			$("#fec_inner").val(response_array[5]);
			break;
		case 71:
			$("#bouquet_name").val(response_array[1]);
			break;
		case 72:
			$("#desc_service_name").val(response_array[1]);
			$("#desc_provider_name").val(response_array[2]);
			if(response_array[3]>=17)
			{
				$("#desc_service_type").val(17);
				$("#desc_custom").val(response_array[3]);
				$("#desc_custom").attr("disabled",false);
			}
			else
			{
				$("#desc_service_type").val(response_array[3]);
			}
			
			break;
		case 73:
			if(response_array[2] == 1)
			{
				$("#country_flag").attr("checked",true);
			}
			else
			{
				$("#country_flag").attr("checked",false);
			}
			for(var i=0;i<response_array[1];i++)
			{
				var countryList = document.getElementById("detail_edit_table");
				row = document.createElement("tr");
				col = document.createElement("td");
					col.innerHTML = response_array[3+i];
				row.appendChild(col);
				col= document.createElement("td");
					col.innerHTML = operateDel2;
				row.appendChild(col);
				countryList.appendChild(row);
			}
			break;
		case 74:
			$("#trans_stream_id").val(response_array[1]);
			$("#original_net_id").val(response_array[2]);
			$("#service_id").val(response_array[3]);
			$("#link_type").val(response_array[4]);
			$("#private_data").val(response_array[5]);			
			break;
		case 82:
			$("#component_tag").val(response_array[1]);
			break;
		case 83:
			$("#line").val(response_array[1]);
			for(var i=0;i<response_array[1];i++)
			{
				var caidList = document.getElementById("detail_edit_table");
				row = document.createElement("tr");
				col = document.createElement("td");
					col.innerHTML = response_array[2+i];
				row.appendChild(col);
				col= document.createElement("td");
					col.innerHTML = operateDel2;
				row.appendChild(col);
				caidList.appendChild(row);
			}
			break;
		case 86:
			var j = 0;
			$("#line").val(response_array[1]);
			for(var i=0;i<response_array[1];i++)
			{				
				var ttList = document.getElementById("detail_edit_table");
				row = document.createElement("tr");
				col = document.createElement("td");
					col.innerHTML = response_array[2+j];
				row.appendChild(col);
				col = document.createElement("td");
					col.innerHTML = response_array[3+j];
				row.appendChild(col);
				col = document.createElement("td");
					col.innerHTML = response_array[4+j];
				row.appendChild(col);
				col = document.createElement("td");
					col.innerHTML = response_array[5+j];
				row.appendChild(col);
				col= document.createElement("td");
					col.innerHTML = operateDel2;
				row.appendChild(col);
				ttList .appendChild(row);
				j=j+4;
			}
			break;
		case 87:
			if(response_array[1] == 1)
			{
				$("#foreign_availability").attr("checked",true);
			}
			else
			{
				$("#foreign_availability").attr("checked",false);
			}
			$("#connection_type").val(response_array[2]);
			$("#country_prefix_char").val(response_array[3]);
			$("#internal_area_code_char").val(response_array[4]);
			$("#operator_code_char").val(response_array[5]);
			$("#national_area_code_char").val(response_array[6]);
			$("#core_number_char").val(response_array[7]);
			break;
		case 89:
			var j = 0;
			$("#line").val(response_array[1]);
			for(var i=0;i<response_array[1];i++)
			{				
				var ttList = document.getElementById("detail_edit_table");
				row = document.createElement("tr");
				col = document.createElement("td");
					col.innerHTML = response_array[2+j];
				row.appendChild(col);
				col = document.createElement("td");
					col.innerHTML = response_array[3+j];
				row.appendChild(col);
				col = document.createElement("td");
					col.innerHTML = response_array[4+j];
				row.appendChild(col);
				col = document.createElement("td");
					col.innerHTML = response_array[5+j];
				row.appendChild(col);
				col= document.createElement("td");
					col.innerHTML = operateDel2;
				row.appendChild(col);
				ttList .appendChild(row);
				j=j+4;
			}
			break;
		case 90:
			$("#frequency").val(response_array[1]);
			$("#bandwidth").val(response_array[2]);
			$("#constellation").val(response_array[3]);
			$("#hierarchy_information").val(response_array[4]);
			$("#code_rate_h").val(response_array[5]);
			$("#code_rate_l").val(response_array[6]);
			$("#guard_interval").val(response_array[7]);
			$("#trans_mode").val(response_array[8]);
			$("#other_freq_flag").val(response_array[9]);
			break;
		case 91:
			var j = 0;
			$("#line").val(response_array[1]);
			for(var i=0;i<response_array[1];i++)
			{				
				var MultiLangList = document.getElementById("detail_edit_table");
				row = document.createElement("tr");
				col = document.createElement("td");
					col.innerHTML = response_array[2+j];
				row.appendChild(col);
				col = document.createElement("td");
					col.innerHTML = response_array[3+j];
				row.appendChild(col);
				col= document.createElement("td");
					col.innerHTML = operateDel2;
				row.appendChild(col);
				MultiLangList.appendChild(row);
				j=j+2;
			}
			break;
		case 92:
			var j = 0;
			$("#line").val(response_array[1]);
			for(var i=0;i<response_array[1];i++)
			{				
				var MultiLangList = document.getElementById("detail_edit_table");
				row = document.createElement("tr");
				col = document.createElement("td");
					col.innerHTML = response_array[2+j];
				row.appendChild(col);
				col = document.createElement("td");
					col.innerHTML = response_array[3+j];
				row.appendChild(col);
				col= document.createElement("td");
					col.innerHTML = operateDel2;
				row.appendChild(col);
				MultiLangList.appendChild(row);
				j=j+2;
			}
			break;
		case 93:
			var j = 0;
			$("#line").val(response_array[1]);
			for(var i=0;i<response_array[1];i++)
			{				
				var MultiLangList = document.getElementById("detail_edit_table");
				row = document.createElement("tr");
				col = document.createElement("td");
					col.innerHTML = response_array[2+j];
				row.appendChild(col);
				col = document.createElement("td");
					col.innerHTML = response_array[3+j];
				row.appendChild(col);
				col = document.createElement("td");
					col.innerHTML = response_array[4+j];
				row.appendChild(col);
				col= document.createElement("td");
					col.innerHTML = operateDel2;
				row.appendChild(col);
				MultiLangList.appendChild(row);
				j=j+3;
			}
			break;
		case 95:
			$("#private_data_specifier").val(response_array[1]);
			break;
		case 98:
			$("#coding_type").val(response_array[1]);
			$("#line").val(response_array[2]);
			if(response_array[2] != 0)
			{
				$("#coding_type").attr("disabled",true);
			}
			for(var i=0;i<response_array[2];i++)
			{
				var freqList = document.getElementById("detail_edit_table");
				row = document.createElement("tr");
				col = document.createElement("td");
					col.innerHTML = response_array[3+i];
				row.appendChild(col);
				col= document.createElement("td");
					col.innerHTML = operateDel2;
				row.appendChild(col);
				freqList.appendChild(row);
			}
			break;
		case 100:
			$("#data_broadcast_id").val(response_array[1]);
			$("#component_tag").val(response_array[2]);
			$("#language_code").val(response_array[3]);
			$("#selector").val(response_array[4]);
			$("#text_char").val(response_array[5]);			
			break;
		case 106:
			if(response_array[1] == 1)
			{
				$("#component_type").attr("checked",true);
			}
			else
			{
				$("#component_type").attr("checked",false);
			}
			if(response_array[2] == 1)
			{
				$("#full_service0").attr("checked",true);
			}
			else
			{
				$("#full_service0").attr("checked",false);
			}
			$("#sound_track_id0").val(response_array[3]);
			$("#service_type0").val(response_array[4]);
			if(response_array[5] == 1)
			{
				$("#bsid").attr("checked",true);
				$("#version_id").attr("disabled",false);
				$("#version_id").val(response_array[6]);
				
			}
			else
			{
				$("#bsid").attr("checked",false);
				$("#version_id").attr("disabled",true);
			}
			if(response_array[7] == 1)
			{
				$("#mainid").attr("checked",true);
				$("#main_id").attr("disabled",false);
				$("#main_id").val(response_array[8]);
				
			}
			else
			{
				$("#mainid").attr("checked",false);
				$("#main_id").attr("disabled",true);
			}
			if(response_array[9] == 1)
			{
				$("#avsc").attr("checked",true);
				for(i=0;i<8;i++)
				{
					if(response_array[10+i] == 1)
					{
						$("#bit"+i).attr("checked",true);
					}
					else
					{
						$("#bit"+i).attr("checked",false);
					}
					$("#bit"+i).attr("disabled",false);
				}				
			}
			else
			{
				$("#avsc").attr("checked",false);
				for(i=0;i<8;i++)
				{
					$("#bit"+i).attr("disabled",true);
				}	
			}
			$("#text_char").val(response_array[18]);
			break;
		case 122:
			$("#enhanced_desc").attr("checked",true);
			$("#enhanced_desc").attr("disabled",true);
			$("#stream1").attr("disabled",false);
			$("#stream2").attr("disabled",false);
			$("#stream3").attr("disabled",false);
			$("#mix_info_id").attr("disabled",false);
			if(response_array[1] == 1)
			{
				$("#component_type").attr("checked",true);
			}
			else
			{
				$("#component_type").attr("checked",false);
			}
			if(response_array[2] == 1)
			{
				$("#full_service0").attr("checked",true);
				if(language == 1)
				{
					changegray(7);
				}
				else
				{
					changegray(11);
				}		
			}
			else
			{
				$("#full_service0").attr("checked",false);
			}
			$("#sound_track_id0").val(response_array[3]);
			$("#service_type0").val(response_array[4]);
			if(response_array[5] == 1)
			{
				$("#bsid").attr("checked",true);
				$("#version_id").attr("disabled",false);
				$("#version_id").val(response_array[6]);
				
			}
			else
			{
				$("#bsid").attr("checked",false);
				$("#version_id").attr("disabled",true);
			}
			if(response_array[7] == 1)
			{
				$("#mainid").attr("checked",true);
				$("#main_id").attr("disabled",false);
				$("#main_id").val(response_array[8]);
				
			}
			else
			{
				$("#mainid").attr("checked",false);
				$("#main_id").attr("disabled",true);
			}
			if(response_array[9] == 1)
			{
				$("#avsc").attr("checked",true);
				for(i=0;i<8;i++)
				{
					if(response_array[10+i] == 1)
					{
						$("#bit"+i).attr("checked",true);
					}
					else
					{
						$("#bit"+i).attr("checked",false);
					}
					$("#bit"+i).attr("disabled",false);
				}				
			}
			else
			{
				$("#avsc").attr("checked",false);
				for(i=0;i<8;i++)
				{
					$("#bit"+i).attr("disabled",false);
				}	
			}
			var j=0;
			for(i=1;i<4;i++)
			{
				if(response_array[18+j] == 1)
				{
					$("#stream"+i).attr("checked",true);
					$("#sound_mix"+i).attr("disabled",false);
					$("#full_service"+i).attr("disabled",false);
					$("#sound_track_id"+i).attr("disabled",false);
					$("#service_type"+i).attr("disabled",false);
				}
				else
				{
					$("#stream"+i).attr("checked",false);
				}
				if(response_array[19+j] == 1)
				{
					$("#sound_mix"+i).attr("checked",true);
				}
				else
				{
					$("#sound_mix"+i).attr("checked",false);
				}
				if(response_array[20+j] == 1)
				{
					$("#full_service"+i).attr("checked",true);
					if(language == 1)
					{
						$("#service_type"+i).empty();
						$("#service_type"+i).append("<option value='0'>完全重要的(CM)</option>");
						$("#service_type"+i).append("<option value='2'>视觉障碍的(VI)</option>");
						$("#service_type"+i).append("<option value='3'>听觉障碍的(HI)</option>");
						$("#service_type"+i).append("<option value='5'>评论(C)</option>");
						$("#service_type"+i).append("<option value='6'>紧急(E)</option>");
						$("#service_type"+i).append("<option value='7'>卡拉OK(单声道和“1+1”禁止)</option>");	
					}
					else
					{
						$("#service_type"+i).empty();
						$("#service_type"+i).append("<option value='0'>Complete Main (CM)</option>");
						$("#service_type"+i).append("<option value='2'>Visually Impaired (VI)</option>");
						$("#service_type"+i).append("<option value='3'>Hearing Impaired (HI)</option>");
						$("#service_type"+i).append("<option value='5'>Commentary (C)</option>");
						$("#service_type"+i).append("<option value='6'>Emergency (E)</option>");
						$("#service_type"+i).append("<option value='7'>Karaoke</option>");
					}
				}
				else
				{
					$("#full_service"+i).attr("checked",false);
				}
				$("#sound_track_id"+i).val(response_array[21+j]);
				$("#service_type"+i).val(response_array[22+j]);
				j=j+5;
			}
			if(response_array[33] == 1)
			{
				$("#mix_info_id").attr("checked",true);
				$("#mix_info_id").attr("disabled",false);
			}
			$("#text_char").val(response_array[34]);
			break;
		case 131:
			var j=0;
			$("#line").val(response_array[1]);
			for(var i=0;i<response_array[1];i++)
			{				
				var LcnList = document.getElementById("detail_edit_table");
				row = document.createElement("tr");
				col = document.createElement("td");
					col.innerHTML = response_array[2+j];
				row.appendChild(col);
				col = document.createElement("td");
					col.innerHTML = response_array[4+j];
				row.appendChild(col);
				col = document.createElement("td");
				if(response_array[3+j] == 0)
				{
					if(language == 1)
					{						
						col.innerHTML = "否";
					}
					else
					{
						col.innerHTML = "No";
					}
				}
				else
				{
					if(language == 1)
					{	
						col.innerHTML = "是";
					}
					else
					{
						col.innerHTML = "Yes";
					}
				}
				row.appendChild(col);
				col= document.createElement("td");
					col.innerHTML = operateDel2;
				row.appendChild(col);
				LcnList.appendChild(row);
				j = j+3;
			}
			break;
		default:
			$("#custom_desc_tag").val(response_array[0]);
			$("#custom_desc_data").val(response_array[1]);
			break;
	}	
}
function descsubmit_ch(tag)
{
	var returnnum;
	var psitype=$("#PsiType").val();
	var symbol = "_"
	var edittype = $("#Desc_OperateType").val();
	if(tag == 0)
	{
		var curdesctag = $("#cur_desc_tag").val();
	}
	else
	{
		var curdesctag = 255;
	}
	//alert(curdesctag);
	var curdesctype = psitype.concat(symbol,edittype,symbol,curdesctag);
	$("#desc_type").val(curdesctype);
	$("#desc_id").val($("#CurDescId").val());
	switch(parseInt(curdesctag)){
		case 2:
			break;
		case 3:
			break;
		case 5:
			break;
		case 6:
			break;
		case 9:
			returnnum = ValidateParam($("#ca_system_id"),"VALI_COM_DATA",0,65535,"<CA 系统ID>",1);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#ca_pid"),"VALI_COM_DATA",0,8191,"<CA PID>",1);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#private_data"),"VAL_HEX0",0,0,"<私有数据>",1);
			if(returnnum == false)
			{
				return;
			}
			else
			{
				returnnum = ValidateParam($("#private_data"),"LENGTH",0,502,"<私有数据>",1);
				if(returnnum == false)
				{
					return;
				}
			}
			break;
		case 10:
			submitdata();
			break;
		case 11:
			returnnum = ValidateParam($("#clk_accuracy_inter"),"VALI_COM_DATA",0,63,"<时钟精确度整数>",1);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#clk_accuracy_exp"),"VALI_COM_DATA",0,7,"<时钟精确度指数>",1);
			if(returnnum == false)
			{
				return;
			}
			break;
		case 12:
			if($("#mdv_valid_flag").is(":checked"))
			{
				returnnum = ValidateParam($("#multi_delay_vatiation"),"VALI_COM_DATA",0,32767,"<复用延时变量>",1);
				if(returnnum == false)
				{
					return;
				}
			}
			break;
		case 14:
			returnnum = ValidateParam($("#max_bitrate"),"VALI_COM_DATA",0,4194303,"<最大比特率>",1);
			if(returnnum == false)
			{
				return;
			}
			break;
		case 15:
			returnnum = ValidateParam($("#private_data_indicator"),"VALI_COM_DATA",0,4294967295,"<私用数据指示器>",1);
			if(returnnum == false)
			{
				return;
			}
			break;
		case 16:
			returnnum = ValidateParam($("#sb_leak_rate"),"VALI_COM_DATA",0,4194303,"<泄露码率>",1);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#sb_size"),"VALI_COM_DATA",0,4194303,"<长度>",1);
			if(returnnum == false)
			{
				return;
			}
			break;
		case 64:
			returnnum = ValidateParam($("#service_name"),"LENGTH",1,32,"<网络名称>",1);
			if(returnnum == false)
			{
				return;
			}
			break;
		case 65:
			submitlist();
			break;
		case 66:
			returnnum = ValidateParam($("#stuff_length"),"VALI_COM_DATA",1,255,"<填充长度>",1);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#stuff_byte"),"VAL_HEX0",0,0,"<填充字节>",1);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#stuff_byte"),"LENGTH",2,2,"<填充字节>",1);
			if(returnnum == false)
			{
				return;
			}
			break;
		case 67:
			returnnum = ValidateParam($("#frequency1"),"DECIMALS",0,999.99999,"<频率>",1);
			if(returnnum == false)
			{
				return;
			}
			else
			{
				var tempval = parseFloat($("#frequency1").val());
				$("#frequency").val(tempval.toFixed(5));
			}
			returnnum = ValidateParam($("#orbital_position1"),"DECIMALS",0,179.9,"<轨道位置>",1);
			if(returnnum == false)
			{
				return;
			}
			else
			{
				var tempval = parseFloat($("#orbital_position1").val());
				$("#orbital_position").val(tempval.toFixed(1));
			}
			returnnum = ValidateParam($("#symbolrate1"),"DECIMALS",0,999.9999,"<符号率>",1);
			if(returnnum == false)
			{
				return;
			}
			else
			{
				var tempval = parseFloat($("#symbolrate1").val());
				$("#symbolrate").val(tempval.toFixed(4));
			}
			break;
		case 68:
			returnnum = ValidateParam($("#frequency1"),"DECIMALS",0,9999.9999,"<频率>",1);
			if(returnnum == false)
			{
				return;
			}
			else
			{
				var tempval = parseFloat($("#frequency1").val());
				$("#frequency").val(tempval.toFixed(4));
			}
			returnnum = ValidateParam($("#symbolrate1"),"DECIMALS",0,999.9999,"<符号率>",1);
			if(returnnum == false)
			{
				return;
			}
			else
			{
				var tempval = parseFloat($("#symbolrate1").val());
				$("#symbolrate").val(tempval.toFixed(4));
			}
			break;
		case 71:
			returnnum = ValidateParam($("#bouquet_name"),"LENGTH",1,32,"<业务群名称>",1);
			if(returnnum == false)
			{
				return;
			}
			break;
		case 72:
			returnnum = ValidateParam($("#desc_service_name"),"LENGTH",1,31,"<业务名称>",1);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#desc_provider_name"),"LENGTH",1,31,"<业务提供商>",1);
			if(returnnum == false)
			{
				return;
			}
			if($("#desc_service_type").val() == "17")
			{
				returnnum = ValidateParam($("#desc_custom"),"VALI_COM_DATA",17,255,"<自定义类型>",1);
				if(returnnum == false)
				{
					return;
				}
			}
			break;
		case 73:
			submitcountry();
			break;
		case 74:
			returnnum = ValidateParam($("#trans_stream_id"),"VALI_COM_DATA",0,65535,"<传送流ID>",1);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#original_net_id"),"VALI_COM_DATA",0,65535,"<原始网络ID>",1);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#service_id"),"VALI_COM_DATA",0,65535,"<业务标识符>",1);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#private_data"),"VAL_HEX0",0,0,"<私有数据>",1);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#private_data"),"LENGTH",0,496,"<私有数据>",1);
			if(returnnum == false)
			{
				return;
			}
			break;
		case 82:
			returnnum = ValidateParam($("#component_tag"),"VALI_COM_DATA",0,255,"<组件标签>",1);
			if(returnnum == false)
			{
				return;
			}
			break;
		case 83:
			submitcaid();
			break;
		case 86:
			submitttinfo();
			break;
		case 87:
			returnnum = ValidateParam($("#connection_type"),"VALI_COM_DATA",1,31,"<连接类型>",1);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#country_prefix_char"),"LENGTH",0,3,"<国家前缀字符>",1);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#internal_area_code_char"),"LENGTH",0,7,"<国际区域代码字符:>",1);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#operator_code_char"),"LENGTH",0,3,"<接线员代码字符>",1);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#national_area_code_char"),"LENGTH",0,7,"<国内区域代码字符>",1);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#core_number_char"),"LENGTH",0,15,"<中心号码字符>",1);
			if(returnnum == false)
			{
				return;
			}
			break;
		case 89:
			submitsubtitle();
			break;
		case 90:
			returnnum = ValidateParam($("#frequency"),"VALI_COM_DATA",1,4294967295,"<中心频率>",1);
			if(returnnum == false)
			{
				return;
			}
			break;
		case 91:
			submitmulticode();
			break;
		case 92:
			submitmulticodeb();
			break;
		case 93:
			submitmulticodes();
			break;
		case 95:
			returnnum = ValidateParam($("#private_data_specifier"),"VALI_COM_DATA",0,4294967295,"<专用数据说符明>",1);
			if(returnnum == false)
			{
				return;
			}
			break;
		case 98:
			submitfreqlist();
			break;
		case 100:
			returnnum = ValidateParam($("#data_broadcast_id"),"VALI_COM_DATA",1,65535,"<数据广播标识符>",1);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#component_tag"),"VALI_COM_DATA",0,255,"<组件标签>",1);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#language_code"),"LENGTH",3,3,"<语言代码>",1);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#selector"),"VAL_HEX0",0,0,"<选数器>",1);
			if(returnnum == false)
			{
				return;
			}
			else
			{
				var tempselector = $("#selector").val();
				var temptextchar = $("#text_char").val();
				if(tempselector.length*2+temptextchar.length >490)
				{
					alert("描述符长度不能超过250!");
				}
			}
			break;
		case 106:
			if($("#bsid").is(":checked"))
			{
				returnnum = ValidateParam($("#version_id"),"VALI_COM_DATA",0,31,"<AC-3版本>",1);
				if(returnnum == false)
				{
					return;
				}
			}
			break;
		case 122:
			break;
		case 131:
			submitlcndesc();
			break;
		default:
			returnnum = ValidateParam($("#custom_desc_tag"),"VALI_COM_DATA",0,254,"<描述符标识>",1);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#custom_desc_data"),"VAL_HEX1",0,0,"<描述符数据>",1);
			if(returnnum == false)
			{
				return;
			}
			else
			{
				returnnum = ValidateParam($("#custom_desc_data"),"LENGTH",0,510,"<描述符数据>",1);
				if(returnnum == false)
				{
					return;
				}
			}
			break;
	}
	$("#subbtn").css("display","none");
	$("#paramform").submit();
	setTimeout("self.location.reload(true)",1000);
}
function descsubmit_en(tag)
{
	var returnnum;
	var psitype=$("#PsiType").val();
	var symbol = "_"
	var edittype = $("#Desc_OperateType").val();
	if(tag == 0)
	{
		var curdesctag = $("#cur_desc_tag").val();
	}
	else
	{
		var curdesctag = 255;
	}
	var curdesctype = psitype.concat(symbol,edittype,symbol,curdesctag);
	$("#desc_type").val(curdesctype);
	$("#desc_id").val($("#CurDescId").val());
	switch(parseInt(curdesctag)){
		case 2:
			break;
		case 3:
			break;
		case 5:
			break;
		case 6:
			break;
		case 9:
			returnnum = ValidateParam($("#ca_system_id"),"VALI_COM_DATA",0,65535,"<CA System ID>",2);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#ca_pid"),"VALI_COM_DATA",0,8191,"<CA PID>",2);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#private_data"),"VAL_HEX0",0,0,"<Private Data>",2);
			if(returnnum == false)
			{
				return;
			}
			else
			{
				returnnum = ValidateParam($("#private_data"),"LENGTH",0,502,"<Private Data>",2);
				if(returnnum == false)
				{
					return;
				}
			}
			break;
		case 10:
			submitdata();
			break;
		case 11:
			returnnum = ValidateParam($("#clk_accuracy_inter"),"VALI_COM_DATA",0,63,"<Clock Accuracy_Integer>",2);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#clk_accuracy_exp"),"VALI_COM_DATA",0,7,"<Clock Accuracy_Exponent>",2);
			if(returnnum == false)
			{
				return;
			}
			break;
		case 12:
			if($("#mdv_valid_flag").is(":checked"))
			{
				returnnum = ValidateParam($("#multi_delay_vatiation"),"VALI_COM_DATA",0,32767,"<Multiplex_Delay_Variation>",2);
				if(returnnum == false)
				{
					return;
				}
			}
			break;
		case 14:
			returnnum = ValidateParam($("#max_bitrate"),"VALI_COM_DATA",0,4194303,"<Maximum Bitrate>",2);
			if(returnnum == false)
			{
				return;
			}
			break;
		case 15:
			returnnum = ValidateParam($("#private_data_indicator"),"VALI_COM_DATA",0,4294967295,"<Private Data Indicator>",2);
			if(returnnum == false)
			{
				return;
			}
			break;
		case 16:
			returnnum = ValidateParam($("#sb_leak_rate"),"VALI_COM_DATA",0,4194303,"<Leak Rate>",2);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#sb_size"),"VALI_COM_DATA",0,4194303,"<Size>",2);
			if(returnnum == false)
			{
				return;
			}
			break;
		case 64:
			returnnum = ValidateParam($("#service_name"),"LENGTH",1,32,"<Network Name>",2);
			if(returnnum == false)
			{
				return;
			}
			break;
		case 65:
			submitlist();
			break;
		case 66:
			returnnum = ValidateParam($("#stuff_length"),"VALI_COM_DATA",1,255,"<Stuffing Length>",2);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#stuff_byte"),"VAL_HEX0",0,0,"<Stuffing Bytes>",2);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#stuff_byte"),"LENGTH",2,2,"<Stuffing Bytes>",2);
			if(returnnum == false)
			{
				return;
			}
			break;
		case 67:
			returnnum = ValidateParam($("#frequency1"),"DECIMALS",0,999.99999,"<Frequency>",2);
			if(returnnum == false)
			{
				return;
			}
			else
			{
				var tempval = parseFloat($("#frequency1").val());
				$("#frequency").val(tempval.toFixed(5));
			}
			returnnum = ValidateParam($("#orbital_position1"),"DECIMALS",0,179.9,"<Orbital Position>",2);
			if(returnnum == false)
			{
				return;
			}
			else
			{
				var tempval = parseFloat($("#orbital_position1").val());
				$("#orbital_position").val(tempval.toFixed(1));
			}
			returnnum = ValidateParam($("#symbolrate1"),"DECIMALS",0,999.9999,"<Symbol Rate>",2);
			if(returnnum == false)
			{
				return;
			}
			else
			{
				var tempval = parseFloat($("#symbolrate1").val());
				$("#symbolrate").val(tempval.toFixed(4));
			}
			break;
		case 68:
			returnnum = ValidateParam($("#frequency1"),"DECIMALS",0,9999.9999,"<Frequency>",2);
			if(returnnum == false)
			{
				return;
			}
			else
			{
				var tempval = parseFloat($("#frequency1").val());
				$("#frequency").val(tempval.toFixed(4));
			}
			returnnum = ValidateParam($("#symbolrate1"),"DECIMALS",0,999.9999,"<Symbol Rate>",2);
			if(returnnum == false)
			{
				return;
			}
			else
			{
				var tempval = parseFloat($("#symbolrate1").val());
				$("#symbolrate").val(tempval.toFixed(4));
			}
			break;
		case 71:
			returnnum = ValidateParam($("#bouquet_name"),"LENGTH",1,32,"<Bouquet Name>",2);
			if(returnnum == false)
			{
				return;
			}
			break;
		case 72:
			returnnum = ValidateParam($("#desc_service_name"),"LENGTH",1,31,"<Service Name>",2);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#desc_provider_name"),"LENGTH",1,31,"<Provider Name>",2);
			if(returnnum == false)
			{
				return;
			}
			if($("#desc_service_type").val() == "17")
			{
				returnnum = ValidateParam($("#desc_custom"),"VALI_COM_DATA",17,255,"<Custom Type>",2);
				if(returnnum == false)
				{
					return;
				}
			}
			break;
		case 73:
			submitcountry();
			break;
		case 74:
			returnnum = ValidateParam($("#trans_stream_id"),"VALI_COM_DATA",0,65535,"<Transport Stream ID>",2);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#original_net_id"),"VALI_COM_DATA",0,65535,"<Original Network ID>",2);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#service_id"),"VALI_COM_DATA",0,65535,"<Service ID>",2);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#private_data"),"VAL_HEX0",0,0,"<Private Data>",2);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#private_data"),"LENGTH",0,496,"<Private Data>",2);
			if(returnnum == false)
			{
				return;
			}
			break;
		case 82:
			returnnum = ValidateParam($("#component_tag"),"VALI_COM_DATA",0,255,"<Component Tag>",2);
			if(returnnum == false)
			{
				return;
			}
			break;
			break;
		case 83:
			submitcaid();
			break;
		case 86:
			submitttinfo();
			break;
		case 87:
			returnnum = ValidateParam($("#connection_type"),"VALI_COM_DATA",1,31,"<Connection Type>",2);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#country_prefix_char"),"LENGTH",0,3,"<Country Prefix>",2);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#internal_area_code_char"),"LENGTH",0,7,"<International Area Code>",2);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#operator_code_char"),"LENGTH",0,3,"<Operator Code>",2);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#national_area_code_char"),"LENGTH",0,7,"<National Area Code>",2);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#core_number_char"),"LENGTH",0,15,"<Core Number>",2);
			if(returnnum == false)
			{
				return;
			}
			break;		
		case 89:
			submitsubtitle();
			break;
		case 90:
			returnnum = ValidateParam($("#frequency"),"VALI_COM_DATA",1,4294967295,"<Centre Frequency>",2);
			if(returnnum == false)
			{
				return;
			}
			break;
		case 91:
			submitmulticode();
			break;
		case 92:
			submitmulticodeb();
			break;
		case 93:
			submitmulticodes();
			break;
		case 95:
			returnnum = ValidateParam($("#private_data_specifier"),"VALI_COM_DATA",0,4294967295,"<Private Data Specifier>",2);
			if(returnnum == false)
			{
				return;
			}
			break;
		case 98:
			submitfreqlist();
			break;
		case 100:
			returnnum = ValidateParam($("#data_broadcast_id"),"VALI_COM_DATA",1,65535,"<Data Broadcast Identifier>",2);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#component_tag"),"VALI_COM_DATA",0,255,"<Component Tag>",2);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#language_code"),"LENGTH",3,3,"<Language Code>",2);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#selector"),"VAL_HEX0",0,0,"<Selector>",2);
			if(returnnum == false)
			{
				return;
			}
			else
			{
				var tempselector = $("#selector").val();
				var temptextchar = $("#text_char").val();
				if(tempselector.length*2+temptextchar.length >490)
				{
					alert("The length of descriptor cannot exceed 250!");
				}
			}
			break;
		case 106:
			if($("#bsid").is(":checked"))
			{
				returnnum = ValidateParam($("#version_id"),"VALI_COM_DATA",0,31,"<AC-3 Version ID>",2);
				if(returnnum == false)
				{
					return;
				}
			}
			break;
		case 122:
			break;
		case 131:
			submitlcndesc();
			break;
		default:
			returnnum = ValidateParam($("#custom_desc_tag"),"VALI_COM_DATA",0,254,"<Descriptor Tag>",2);
			if(returnnum == false)
			{
				return;
			}
			returnnum = ValidateParam($("#custom_desc_data"),"VAL_HEX1",0,0,"<Descriptor Data>",2);
			if(returnnum == false)
			{
				return;
			}
			else
			{
				returnnum = ValidateParam($("#custom_desc_data"),"LENGTH",0,510,"<Descriptor Data>",2);
				if(returnnum == false)
				{
					return;
				}
			}
			break;
	}
	$("#subbtn").css("display","none");
	$("#paramform").submit();
	setTimeout("self.location.reload(true)",1000);
}
function getHTTPObject()
{
	var xmlhttp = false;
	try
	{
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(E)
		{
			xmlhttp = false;
		}
	}
	if ((!xmlhttp) && (typeof XMLHttpRequest != "undefined"))
	{
		try
		{
			xmlhttp = new XMLHttpRequest();
		}
		catch(e)
		{
			xmlhttp = false;
		}
	}
	return xmlhttp;
}
function CreateHiddenFormDesc(name,id,value)
{
	var tempform = document.getElementById("paramform");
	var newInput = document.createElement("input");		
	newInput.type = "hidden";	
	newInput.name = name;
	newInput.id = id;
	newInput.value = value;
	tempform.appendChild(newInput);
	return;
}
function changelist(id)
{
	switch(id) {
		case 2://for video stream descriptor page
			if($("#mpeg_flag").is(":checked"))
			{
				$("#profile").attr("disabled" ,false);
				$("#level").attr("disabled" ,false);
				$("#chroma_format").attr("disabled" ,false);
				$("#frame_rate_ex_flag").attr("disabled" ,false);
			}
			else
			{
				$("#profile").attr("disabled" ,true);
				$("#level").attr("disabled" ,true);
				$("#chroma_format").attr("disabled" ,true);
				$("#frame_rate_ex_flag").attr("disabled" ,true);
			}
			break;
		case 12:
			if($("#mdv_valid_flag").is(":checked"))
			{
				$("#multi_delay_vatiation").attr("disabled" ,false);
			}
			else
			{
				$("#multi_delay_vatiation").attr("disabled" ,true);
			}
			break;
	}	
}
function  deleteCurrentRow(obj,pagelanguage)//delete for subpage
{
	var i=0;
	if(pagelanguage == 1)
	{
		var confirm_prompt = "确定要删除?";
	}
	else
	{
		var confirm_prompt = "Are you sure you want to delete?";
	}
	if(window.confirm(confirm_prompt))
	{ 
		var tr=obj.parentNode.parentNode;
		var tbody=tr.parentNode;   
		tbody.removeChild(tr);
		var templine = $("#detail_edit_table").find("tr").length-1;
		$("#line").val(templine);
		if(parseInt($("#cur_desc_tag").val(),10) == 98)
		{
			if(templine == 0)
			{
				$("#coding_type").attr("disabled" ,false);
			}
		}
	}  
}
function changetype()
{
	var tempvalue=parseInt($("#desc_service_type").val(),10);
	if(tempvalue == 17)
	{			
		$("#desc_custom").attr("disabled",false);
	}
	else
	{
		$("#desc_custom").attr("disabled",true);
	}
}
/*-------------------------------------------------------------------------   ISO-639 language code create submit form element  ----------------------------------------------------------*/
function submitdata()
{
	var totalline = $("#detail_edit_table").find("tr").length-1;
	$("#line").val(totalline);
	var i=0;
	$("#detail_edit_table tr").each(function ()
	{                
		var s="language_code"+i;
		CreateHiddenFormDesc(s,s,$(this).children("td:first").text());
		i++;
	});	
}
function addcode(pagelanguage)
{	
	if($("#language_code").val().length != 3)
	{
		if(pagelanguage == 1)
		{
			alert("语言代码的长度必须是3!");
			return;
		}
		else
		{
			alert("Language code's length must be 3!");
			return;
		}
	}
	var totalline0 = $("#detail_edit_table").find("tr").length-1;
	if(totalline0 == 84)
	{
		if(pagelanguage == 1)
		{
			alert("最大允许的代码个数为84!");
			return;
		}
		else
		{
			alert("The maximum allowed number is 84!");
			return;
		}
	}
	var codeList = document.getElementById("detail_edit_table");
	row = document.createElement("tr");
	col = document.createElement("td");
		col.innerHTML = $("#language_code").val();
	row.appendChild(col);
	col= document.createElement("td");
		col.innerHTML = operateDel2;
	row.appendChild(col);
	codeList.appendChild(row);
	var totalline = $("#detail_edit_table").find("tr").length-1;
	$("#line").val(totalline);
	$("#language_code").val("");
}
/*-------------------------------------------------------------------------   available country descriptor ------------------ -----------------------------------------------------------*/
function submitcountry()
{
	var totalline = $("#detail_edit_table").find("tr").length-1;
	$("#line").val(totalline);
	var i=0;
	$("#detail_edit_table tr").each(function ()
	{                
		var s="country_code"+i;
		CreateHiddenFormDesc(s,s,$(this).children("td:first").text());
		i++;
	});	
}
function addcountrycode(pagelanguage)
{	
	if($("#country_code").val().length != 3)
	{
		if(pagelanguage == 1)
		{
			alert("语言代码的长度必须是3!");
			return;
		}
		else
		{
			alert("Language code's length must be 3!");
			return;
		}
	}
	var totalline0 = $("#detail_edit_table").find("tr").length-1;
	if(totalline0 == 84)
	{
		if(pagelanguage == 1)
		{
			alert("最大允许的代码个数为84!");
			return;
		}
		else
		{
			alert("The maximum allowed number is 84!");
			return;
		}
	}
	var codeList = document.getElementById("detail_edit_table");
	row = document.createElement("tr");
	col = document.createElement("td");
		col.innerHTML = $("#country_code").val();
	row.appendChild(col);
	col= document.createElement("td");
		col.innerHTML = operateDel2;
	row.appendChild(col);
	codeList.appendChild(row);
	var totalline = $("#detail_edit_table").find("tr").length-1;
	$("#line").val(totalline);
	$("#country_code").val("");
}
/*--------------------------------------------------------------------------- service list descriptor --------------------------------------------------------------*/
function addList(pagelanguage)
{	
	var totalline = $("#detail_edit_table").find("tr").length-1;
	if(totalline == 84)
	{
		if(pagelanguage == 1)
		{
			alert("最大允许的个数为84!");
			return;
		}
		else
		{
			alert("The maximum allowed number is 84!");
			return;
		}
	}
	$("#line").val(totalline);
	var returnnum;
	if(pagelanguage == 1)
	{
		returnnum = ValidateParam($("#service_id"),"VALI_INTEGER",0,65535,"<业务标识符>",1);
		if(returnnum == false)
		{
			return;
		}
		if(parseInt($("#desc_service_type").val(),10)>16)
		{
			returnnum = ValidateParam($("#desc_custom"),"VALI_COM_DATA",17,255,"<自定义类型>",1);
			if(returnnum == false)
			{
				return;
			}
		}
	}
	else
	{
		returnnum = ValidateParam($("#service_id"),"VALI_INTEGER",0,65535,"<Service ID>",2);
		if(returnnum == false)
		{
			return;
		}
		if(parseInt($("#desc_service_type").val(),10)>16)
		{
			returnnum = ValidateParam($("#desc_custom"),"VALI_COM_DATA",17,255,"<Custom Type>",2);
			if(returnnum == false)
			{
				return;
			}
		}
	}
	var sreviceList = document.getElementById("detail_edit_table");
	row = document.createElement("tr");
	col = document.createElement("td");
		col.innerHTML = $("#service_id").val();
	row.appendChild(col);
	col = document.createElement("td");
	if(parseInt($("#desc_service_type").val(),10)<17)
	{
		col.innerHTML = $("#desc_service_type").val();
	}
	else
	{
		col.innerHTML = $("#desc_custom").val();
	}
	row.appendChild(col);
	col= document.createElement("td");
		col.innerHTML = operateDel2;
	row.appendChild(col);
	sreviceList.appendChild(row);
	var totalline = $("#detail_edit_table").find("tr").length-1;
	$("#line").val(totalline);
	$("#service_id").val("");
	$("#desc_service_type").val("1");
	$("#desc_custom").attr("disabled",true);
}
function submitlist()
{
	var totalline = $("#detail_edit_table").find("tr").length-1;
	$("#line").val(totalline);
	var i=0;
	$("#detail_edit_table tr").each(function ()
	{                
		var s1="service_id"+i;
		var s2="desc_service_type"+i;
		CreateHiddenFormDesc(s1,s1,$(this).children("td:first").text());
		CreateHiddenFormDesc(s2,s2,$(this).children("td:eq(1)").text());
		i++;
	});	
}
/*----------------------------------------------------------------------------- CA_identifier_descriptor -------------------------------------------------------------------*/
function addcaid(pagelanguage)
{	
	var totalline = $("#detail_edit_table").find("tr").length-1;
	if(totalline == 127)
	{
		if(pagelanguage == 1)
		{
			alert("最大允许的个数为127!");
			return;
		}
		else
		{
			alert("The maximum allowed number is 127!");
			return;
		}
	}
	$("#line").val(totalline);
	var returnnum;
	if(pagelanguage == 1)
	{
		returnnum = ValidateParam($("#ca_system_id"),"VALI_COM_DATA",1,65535,"<CA系统标识符>",1);
		if(returnnum == false)
		{
			return;
		}
	}
	else
	{
		returnnum = ValidateParam($("#ca_system_id"),"VALI_COM_DATA",1,65535,"<CA System ID>",2);
		if(returnnum == false)
		{
			return;
		}
	}
	var caidList = document.getElementById("detail_edit_table");
	row = document.createElement("tr");
	col = document.createElement("td");
		col.innerHTML = $("#ca_system_id").val();
	row.appendChild(col);
	col= document.createElement("td");
		col.innerHTML = operateDel2;
	row.appendChild(col);
	caidList.appendChild(row);
	var totalline = $("#detail_edit_table").find("tr").length-1;
	$("#line").val(totalline);
	$("#ca_system_id").val("");
}
function submitcaid()
{
	var totalline = $("#detail_edit_table").find("tr").length-1;
	$("#line").val(totalline);
	var i=0;
	$("#detail_edit_table tr").each(function ()
	{                
		var s1="ca_system_id"+i;
		CreateHiddenFormDesc(s1,s1,$(this).children("td:first").text());
		i++;
	});	
}
/*------------------------------------------------------------------------------ teletext descriptor -----------------------------------------------------------------------------*/
function addttinfo(pagelanguage)
{	
	if($("#language_code").val().length != 3)
	{
		if(pagelanguage == 1)
		{
			alert("语言代码的长度必须是3!");
			return;
		}
		else
		{
			alert("Language code's length must be 3!");
			return;
		}
	}
	var totalline0 = $("#detail_edit_table").find("tr").length-1;
	if(totalline0 == 50)
	{
		if(pagelanguage == 1)
		{
			alert("最大允许的个数为50!");
			return;
		}
		else
		{
			alert("The maximum allowed number is 50!");
			return;
		}
	}
	var rerurnnum;
	if(pagelanguage == 1)
	{
		returnnum = ValidateParam($("#tt_magazine_num"),"VALI_COM_DATA",0,7,"<图文杂志号>",1);
		if(returnnum == false)
		{
			return;
		}
		returnnum = ValidateParam($("#tt_page_num"),"VALI_COM_DATA",0,255,"<图文页面号>",1);
		if(returnnum == false)
		{
			return;
		}
	}
	else
	{
		returnnum = ValidateParam($("#tt_magazine_num"),"VALI_COM_DATA",0,7,"<Teletext Magazine Number>",2);
		if(returnnum == false)
		{
			return;
		}
		returnnum = ValidateParam($("#tt_page_num"),"VALI_COM_DATA",0,255,"<Teletext Page Number>",2);
		if(returnnum == false)
		{
			return;
		}
	}
	var ttList = document.getElementById("detail_edit_table");
	row = document.createElement("tr");
	col = document.createElement("td");
		col.innerHTML = $("#language_code").val();
	row.appendChild(col);
	col = document.createElement("td");
		col.innerHTML = $("#tt_type").val();
	row.appendChild(col);
	col = document.createElement("td");
		col.innerHTML = $("#tt_magazine_num").val();
	row.appendChild(col);
	col = document.createElement("td");
		col.innerHTML = $("#tt_page_num").val();
	row.appendChild(col);
	col= document.createElement("td");
		col.innerHTML = operateDel2;
	row.appendChild(col);
	ttList.appendChild(row);
	var totalline = $("#detail_edit_table").find("tr").length-1;
	$("#line").val(totalline);
	$("#language_code").val("");
	$("#tt_type").val("");
	$("#tt_magazine_num").val("");
	$("#tt_page_num").val("");
}
function submitttinfo()
{
	var totalline = $("#detail_edit_table").find("tr").length-1;
	$("#line").val(totalline);
	var i=0;
	$("#detail_edit_table tr").each(function ()
	{                
		var s1="language_code"+i;
		var s2="tt_type"+i;
		var s3="tt_magazine_num"+i;
		var s4="tt_page_num"+i;
		CreateHiddenFormDesc(s1,s1,$(this).children("td:first").text());
		CreateHiddenFormDesc(s2,s2,$(this).children("td:eq(1)").text());
		CreateHiddenFormDesc(s3,s3,$(this).children("td:eq(2)").text());
		CreateHiddenFormDesc(s4,s4,$(this).children("td:eq(3)").text());
		i++;
	});	
}
/*-------------------------------------------------------------------------------- subtitling_descriptor ---------------------------------------------------------------------------*/
function addsubtitle(pagelanguage)
{	
	if($("#language_code").val().length != 3)
	{
		if(pagelanguage == 1)
		{
			alert("语言代码的长度必须是3!");
			return;
		}
		else
		{
			alert("Language code's length must be 3!");
			return;
		}
	}
	var totalline0 = $("#detail_edit_table").find("tr").length-1;
	if(totalline0 == 31)
	{
		if(pagelanguage == 1)
		{
			alert("最大允许的个数为31!");
			return;
		}
		else
		{
			alert("The maximum allowed number is 31!");
			return;
		}
	}
	var returnnum;
	if(pagelanguage == 1)
	{
		returnnum = ValidateParam($("#composition_page_id"),"VALI_COM_DATA",0,65535,"<构图页面标识>",1);
		if(returnnum == false)
		{
			return;
		}
		returnnum = ValidateParam($("#ancillary_page_id"),"VALI_COM_DATA",0,65535,"<辅助页面标识>",1);
		if(returnnum == false)
		{
			return;
		}
	}
	else
	{
		returnnum = ValidateParam($("#composition_page_id"),"VALI_COM_DATA",0,65535,"<Composition Page ID>",2);
		if(returnnum == false)
		{
			return;
		}
		returnnum = ValidateParam($("#ancillary_page_id"),"VALI_COM_DATA",0,65535,"<Ancillary Page ID>",2);
		if(returnnum == false)
		{
			return;
		}
	}
	var ttList = document.getElementById("detail_edit_table");
	row = document.createElement("tr");
	col = document.createElement("td");
		col.innerHTML = $("#language_code").val();
	row.appendChild(col);
	col = document.createElement("td");
		col.innerHTML = $("#subtitle_type").val();
	row.appendChild(col);
	col = document.createElement("td");
		col.innerHTML = $("#composition_page_id").val();
	row.appendChild(col);
	col = document.createElement("td");
		col.innerHTML = $("#ancillary_page_id").val();
	row.appendChild(col);
	col= document.createElement("td");
		col.innerHTML = operateDel2;
	row.appendChild(col);
	ttList.appendChild(row);
	var totalline = $("#detail_edit_table").find("tr").length-1;
	$("#line").val(totalline);
	$("#language_code").val("");
	$("#subtitle_type").val("");
	$("#composition_page_id").val("");
	$("#ancillary_page_id").val("");
}
function submitsubtitle()
{
	var totalline = $("#detail_edit_table").find("tr").length-1;
	$("#line").val(totalline);
	var i=0;
	$("#detail_edit_table tr").each(function ()
	{                
		var s1="language_code"+i;
		var s2="subtitle_type"+i;
		var s3="composition_page_id"+i;
		var s4="ancillary_page_id"+i;
		CreateHiddenFormDesc(s1,s1,$(this).children("td:first").text());
		CreateHiddenFormDesc(s2,s2,$(this).children("td:eq(1)").text());
		CreateHiddenFormDesc(s3,s3,$(this).children("td:eq(2)").text());
		CreateHiddenFormDesc(s4,s4,$(this).children("td:eq(3)").text());
		i++;
	});	
}
/*-- ---------------------------------------------------multilingual_bouquet_name_descriptor------------------------------------------ ----------------------------------------------*/
function addmulticodeb(pagelanguage)
{
	var totalline0 = $("#detail_edit_table").find("tr").length-1;
	if(totalline0 == 7)
	{
		if(pagelanguage == 1)
		{
			alert("最大允许的个数为7!");
			return;
		}
		else
		{
			alert("The maximum allowed number is 7!");
			return;
		}
	}
	if($("#language_code").val().length != 3)
	{
		if(pagelanguage == 1)
		{
			alert("语言代码的长度必须是3!");
			return;
		}
		else
		{
			alert("Language code's length must be 3!");
			return;
		}
	}
	var returnmum;
	if(pagelanguage == 1)
	{
		returnnum = ValidateParam($("#language_name"),"LENGTH",1,32,"<群名称>",1);
		if(returnnum == false)
		{
			return;
		}
	}
	else
	{
		returnnum = ValidateParam($("#language_name"),"LENGTH",1,32,"<Bouquet Name>",2);
		if(returnnum == false)
		{
			return;
		}
	}
	var sreviceList = document.getElementById("detail_edit_table");
	row = document.createElement("tr");
	col = document.createElement("td");
		col.innerHTML = $("#language_code").val();
	row.appendChild(col);
	col = document.createElement("td");
		col.innerHTML = $("#language_name").val();
	row.appendChild(col);
	col= document.createElement("td");
		col.innerHTML = operateDel2;
	row.appendChild(col);
	sreviceList.appendChild(row);
	var totalline = $("#detail_edit_table").find("tr").length-1;
	$("#line").val(totalline);
	$("#language_code").val("");
	$("#language_name").val("");
}
function submitmulticodeb()
{
	var totalline = $("#detail_edit_table").find("tr").length-1;
	$("#line").val(totalline);
	var i=0;
	$("#detail_edit_table tr").each(function ()
	{                
		var s1="language_code"+i;
		var s2="language_name"+i;
		CreateHiddenFormDesc(s1,s1,$(this).children("td:first").text());
		CreateHiddenFormDesc(s2,s2,$(this).children("td:eq(1)").text());
		i++;
	});	
}
/*-- ---------------------------------------------------multilingual_Network_name_descriptor------------------------------------- ----------------------------------------------*/
function addmulticode(pagelanguage)
{
	var totalline0 = $("#detail_edit_table").find("tr").length-1;
	if(totalline0 == 7)
	{
		if(pagelanguage == 1)
		{
			alert("最大允许的个数为7!");
			return;
		}
		else
		{
			alert("The maximum allowed number is 7!");
			return;
		}
	}
	if($("#language_code").val().length != 3)
	{
		if(pagelanguage == 1)
		{
			alert("语言代码的长度必须是3!");
			return;
		}
		else
		{
			alert("Language code's length must be 3!");
			return;
		}
	}
	var returnmum;
	if(pagelanguage == 1)
	{
		returnnum = ValidateParam($("#language_name"),"LENGTH",1,32,"<网络名称>",1);
		if(returnnum == false)
		{
			return;
		}
	}
	else
	{
		returnnum = ValidateParam($("#language_name"),"LENGTH",1,32,"<Network Name>",2);
		if(returnnum == false)
		{
			return;
		}
	}
	var sreviceList = document.getElementById("detail_edit_table");
	row = document.createElement("tr");
	col = document.createElement("td");
		col.innerHTML = $("#language_code").val();
	row.appendChild(col);
	col = document.createElement("td");
		col.innerHTML = $("#language_name").val();
	row.appendChild(col);
	col= document.createElement("td");
		col.innerHTML = operateDel2;
	row.appendChild(col);
	sreviceList.appendChild(row);
	var totalline = $("#detail_edit_table").find("tr").length-1;
	$("#line").val(totalline);
	$("#language_code").val("");
	$("#language_name").val("");
}
function submitmulticode()
{
	var totalline = $("#detail_edit_table").find("tr").length-1;
	$("#line").val(totalline);
	var i=0;
	$("#detail_edit_table tr").each(function ()
	{                
		var s1="language_code"+i;
		var s2="language_name"+i;
		CreateHiddenFormDesc(s1,s1,$(this).children("td:first").text());
		CreateHiddenFormDesc(s2,s2,$(this).children("td:eq(1)").text());
		i++;
	});	
}
/*-- ---------------------------------------------------------------multilingual_service_name_descriptor--------------------------------------------------------------------------*/
function addmulticodes(pagelanguage)
{
	var totalline0 = $("#detail_edit_table").find("tr").length-1;
	if(totalline0 == 7)
	{
		if(pagelanguage == 1)
		{
			alert("最大允许的个数为7!");
			return;
		}
		else
		{
			alert("The maximum allowed number is 7!");
			return;
		}
	}
	if($("#language_code").val().length != 3)
	{
		if(pagelanguage == 1)
		{
			alert("语言代码的长度必须是3!");
			return;
		}
		else
		{
			alert("Language code's length must be 3!");
			return;
		}
	}
	var returnmum;
	if(pagelanguage == 1)
	{
		returnnum = ValidateParam($("#provider_name"),"LENGTH",1,32,"<业务提供商>",1);
		if(returnnum == false)
		{
			return;
		}
		returnnum = ValidateParam($("#language_name"),"LENGTH",1,32,"<业务名称>",1);
		if(returnnum == false)
		{
			return;
		}
	}
	else
	{
		returnnum = ValidateParam($("#provider_name"),"LENGTH",1,32,"<Service Provider Name>",2);
		if(returnnum == false)
		{
			return;
		}
		returnnum = ValidateParam($("#language_name"),"LENGTH",1,32,"<Service Name>",2);
		if(returnnum == false)
		{
			return;
		}
	}
	var sreviceList = document.getElementById("detail_edit_table");
	row = document.createElement("tr");
	col = document.createElement("td");
		col.innerHTML = $("#language_code").val();
	row.appendChild(col);
	col = document.createElement("td");
		col.innerHTML = $("#provider_name").val();
	row.appendChild(col);
	col = document.createElement("td");
		col.innerHTML = $("#language_name").val();
	row.appendChild(col);
	col= document.createElement("td");
		col.innerHTML = operateDel2;
	row.appendChild(col);
	sreviceList.appendChild(row);
	var totalline = $("#detail_edit_table").find("tr").length-1;
	$("#line").val(totalline);
	$("#language_code").val("");
	$("#provider_name").val("");
	$("#language_name").val("");
}
function submitmulticodes()
{
	var totalline = $("#detail_edit_table").find("tr").length-1;
	$("#line").val(totalline);
	var i=0;
	$("#detail_edit_table tr").each(function ()
	{                
		var s1="language_code"+i;
		var s2="provider_name"+i;
		var s3="language_name"+i;
		CreateHiddenFormDesc(s1,s1,$(this).children("td:first").text());
		CreateHiddenFormDesc(s2,s2,$(this).children("td:eq(1)").text());
		CreateHiddenFormDesc(s3,s3,$(this).children("td:eq(2)").text());
		i++;
	});	
}
/* ------------------------------------------------------------------------------ frequency_list_descriptor ----------------------------------------------------------------------*/
function submitfreqlist()
{
	var totalline = $("#detail_edit_table").find("tr").length-1;
	$("#line").val(totalline);
	$("#coding_type1").val(parseInt($("#coding_type").val(),10));
	var i=0;
	$("#detail_edit_table tr").each(function ()
	{                
		var s="center_frequency"+i;
		CreateHiddenFormDesc(s,s,($(this).children("td:first").text())*1000000);
		i++;
	});	
}
function addfreqlist(pagelanguage)
{	
	var returnnum;
	if(pagelanguage == 1)
	{
		if(parseInt($("#coding_type").val(),10) == 1)
		{
			returnnum = ValidateParam($("#center_frequency"),"DECIMALS",0,999999.99,"<中心频率>",1);
			if(returnnum == false)
			{
				return;
			}
			else
			{
				var tempval = parseFloat($("#center_frequency").val());
			}
		}
		else if(parseInt($("#coding_type").val(),10) == 2)
		{
			returnnum = ValidateParam($("#center_frequency"),"DECIMALS",0,9999.9999,"<中心频率>",1);
			if(returnnum == false)
			{
				return;
			}
			else
			{
				var tempval = parseFloat($("#center_frequency").val());
			}
		}
		else if(parseInt($("#coding_type").val(),10) == 3)
		{
			returnnum = ValidateParam($("#center_frequency"),"DECIMALS",0,42949.67295,"<中心频率>",1);
			if(returnnum == false)
			{
				return;
			}
			else
			{
				var tempval = parseFloat($("#center_frequency").val());
			}
		}
		else
		{
			returnnum = ValidateParam($("#center_frequency"),"DECIMALS",0,4294.967295,"<中心频率>",1);
			if(returnnum == false)
			{
				return;
			}
			else
			{
				var tempval = parseFloat($("#center_frequency").val());
			}
		}
	}
	else
	{
		if(parseInt($("#coding_type").val(),10) == 1)
		{
			returnnum = ValidateParam($("#center_frequency"),"DECIMALS",0,999999.99,"<Centre Frequency>",2);
			if(returnnum == false)
			{
				return;
			}
			else
			{
				var tempval = parseFloat($("#center_frequency").val());
			}
		}
		else if(parseInt($("#coding_type").val(),10) == 2)
		{
			returnnum = ValidateParam($("#center_frequency"),"DECIMALS",0,9999.9999,"<Centre Frequency>",2);
			if(returnnum == false)
			{
				return;
			}
			else
			{
				var tempval = parseFloat($("#center_frequency").val());
			}
		}
		else if(parseInt($("#coding_type").val(),10) == 3)
		{
			returnnum = ValidateParam($("#center_frequency"),"DECIMALS",0,42949.67295,"<Centre Frequency>",2);
			if(returnnum == false)
			{
				return;
			}
			else
			{
				var tempval = parseFloat($("#center_frequency").val());
			}
		}
		else
		{
			returnnum = ValidateParam($("#center_frequency"),"DECIMALS",0,4294.967295,"<Centre Frequency>",2);
			if(returnnum == false)
			{
				return;
			}
			else
			{
				var tempval = parseFloat($("#center_frequency").val());
			}
		}
	}
	var freqList = document.getElementById("detail_edit_table");
	row = document.createElement("tr");
	col = document.createElement("td");
		col.innerHTML = tempval.toFixed(6);
	row.appendChild(col);
	col= document.createElement("td");
		col.innerHTML = operateDel2;
	row.appendChild(col);
	freqList.appendChild(row);
	var totalline = $("#detail_edit_table").find("tr").length-1;
	$("#line").val(totalline);
	if(totalline > 0)
	{
		$("#coding_type").attr("disabled" ,true);	
	}
	$("#center_frequency").val("");
}
function changegray(id)
{
	switch(id){
		case 0:
			if($("#enhanced_desc").is(":checked"))
			{
				$("#cur_desc_tag").val(122);
				$("#stream1").attr("disabled",false);
				$("#stream2").attr("disabled",false);
				$("#stream3").attr("disabled",false);
				$("#mix_info_id").attr("disabled",false);
				$("#component_type").attr("disabled",true);
			}
			else
			{
				$("#cur_desc_tag").val(106);
				$("#stream1").attr("disabled",true);
				$("#stream2").attr("disabled",true);
				$("#stream3").attr("disabled",true);
				$("#mix_info_id").attr("disabled",true);
				$("#component_type").attr("disabled",false);
			}
			break;
		case 1:
			if($("#bsid").is(":checked"))
			{
				$("#version_id").attr("disabled",false);
			}
			else
			{
				$("#version_id").attr("disabled",true);
			}
			break;
		case 2:
			if($("#mainid").is(":checked"))
			{
				$("#main_id").attr("disabled",false);
			}
			else
			{
				$("#main_id").attr("disabled",true);
			}
			break;
		case 3:
			if($("#avsc").is(":checked"))
			{
				$("#bit0").attr("disabled",false);
				$("#bit1").attr("disabled",false);
				$("#bit2").attr("disabled",false);
				$("#bit3").attr("disabled",false);
				$("#bit4").attr("disabled",false);
				$("#bit5").attr("disabled",false);
				$("#bit6").attr("disabled",false);
				$("#bit7").attr("disabled",false);
			}
			else
			{
				$("#bit0").attr("disabled",true);
				$("#bit1").attr("disabled",true);
				$("#bit2").attr("disabled",true);
				$("#bit3").attr("disabled",true);
				$("#bit4").attr("disabled",true);
				$("#bit5").attr("disabled",true);
				$("#bit6").attr("disabled",true);
				$("#bit7").attr("disabled",true);
			}
			break;
		case 4:
			if($("#stream1").is(":checked"))
			{
				$("#sound_mix1").attr("disabled",false);
				$("#full_service1").attr("disabled",false);
				$("#sound_track_id1").attr("disabled",false);
				$("#service_type1").attr("disabled",false);
			}
			else
			{
				$("#sound_mix1").attr("disabled",true);
				$("#full_service1").attr("disabled",true);
				$("#sound_track_id1").attr("disabled",true);
				$("#service_type1").attr("disabled",true);
			}
			break;
		case 5:
			if($("#stream2").is(":checked"))
			{
				$("#sound_mix2").attr("disabled",false);
				$("#full_service2").attr("disabled",false);
				$("#sound_track_id2").attr("disabled",false);
				$("#service_type2").attr("disabled",false);
			}
			else
			{
				$("#sound_mix2").attr("disabled",true);
				$("#full_service2").attr("disabled",true);
				$("#sound_track_id2").attr("disabled",true);
				$("#service_type2").attr("disabled",true);
			}
			break;
		case 6:
			if($("#stream3").is(":checked"))
			{
				$("#sound_mix3").attr("disabled",false);
				$("#full_service3").attr("disabled",false);
				$("#sound_track_id3").attr("disabled",false);
				$("#service_type3").attr("disabled",false);
			}
			else
			{
				$("#sound_mix3").attr("disabled",true);
				$("#full_service3").attr("disabled",true);
				$("#sound_track_id3").attr("disabled",true);
				$("#service_type3").attr("disabled",true);
			}
			break;
		/* -- chinese:7 8 9 10;english:11 12 13 14--*/
		case 7:
			if($("#full_service0").is(":checked"))
			{
				$("#service_type0").empty();
				$("#service_type0").append("<option value='0'>完全重要的(CM)</option>");
				$("#service_type0").append("<option value='2'>视觉障碍的(VI)</option>");
				$("#service_type0").append("<option value='3'>听觉障碍的(HI)</option>");
				$("#service_type0").append("<option value='5'>评论(C)</option>");
				$("#service_type0").append("<option value='6'>紧急(E)</option>");
				$("#service_type0").append("<option value='7'>卡拉OK(单声道和“1+1”禁止)</option>");
			}
			else
			{
				$("#service_type0").empty();
				$("#service_type0").append("<option value='1'>音效(ME)</option>");
				$("#service_type0").append("<option value='2'>视觉障碍的(VI)</option>");
				$("#service_type0").append("<option value='3'>听觉障碍的(HI)</option>");
				$("#service_type0").append("<option value='4'>对话(D)</option>");
				$("#service_type0").append("<option value='5'>评论(C)</option>");
				$("#service_type0").append("<option value='7'>画外音(VO)</option>");
			}
			break;
		case 8:
			if($("#full_service1").is(":checked"))
			{
				$("#service_type1").empty();
				$("#service_type1").append("<option value='0'>完全重要的(CM)</option>");
				$("#service_type1").append("<option value='2'>视觉障碍的(VI)</option>");
				$("#service_type1").append("<option value='3'>听觉障碍的(HI)</option>");
				$("#service_type1").append("<option value='5'>评论(C)</option>");
				$("#service_type1").append("<option value='6'>紧急(E)</option>");
				$("#service_type1").append("<option value='7'>卡拉OK(单声道和“1+1”禁止)</option>");
			}
			else
			{
				$("#service_type1").empty();
				$("#service_type1").append("<option value='1'>音效(ME)</option>");
				$("#service_type1").append("<option value='2'>视觉障碍的(VI)</option>");
				$("#service_type1").append("<option value='3'>听觉障碍的(HI)</option>");
				$("#service_type1").append("<option value='4'>对话(D)</option>");
				$("#service_type1").append("<option value='5'>评论(C)</option>");
				$("#service_type1").append("<option value='7'>画外音(VO)</option>");
			}
			break;
		case 9:
			if($("#full_service2").is(":checked"))
			{
				$("#service_type2").empty();
				$("#service_type2").append("<option value='0'>完全重要的(CM)</option>");
				$("#service_type2").append("<option value='2'>视觉障碍的(VI)</option>");
				$("#service_type2").append("<option value='3'>听觉障碍的(HI)</option>");
				$("#service_type2").append("<option value='5'>评论(C)</option>");
				$("#service_type2").append("<option value='6'>紧急(E)</option>");
				$("#service_type2").append("<option value='7'>卡拉OK(单声道和“1+1”禁止)</option>");
			}
			else
			{
				$("#service_type2").empty();
				$("#service_type2").append("<option value='1'>音效(ME)</option>");
				$("#service_type2").append("<option value='2'>视觉障碍的(VI)</option>");
				$("#service_type2").append("<option value='3'>听觉障碍的(HI)</option>");
				$("#service_type2").append("<option value='4'>对话(D)</option>");
				$("#service_type2").append("<option value='5'>评论(C)</option>");
				$("#service_type2").append("<option value='7'>画外音(VO)</option>");
			}
			break;
		case 10:
			if($("#full_service3").is(":checked"))
			{
				$("#service_type3").empty();
				$("#service_type3").append("<option value='0'>完全重要的(CM)</option>");
				$("#service_type3").append("<option value='2'>视觉障碍的(VI)</option>");
				$("#service_type3").append("<option value='3'>听觉障碍的(HI)</option>");
				$("#service_type3").append("<option value='5'>评论(C)</option>");
				$("#service_type3").append("<option value='6'>紧急(E)</option>");
				$("#service_type3").append("<option value='7'>卡拉OK(单声道和“1+1”禁止)</option>");
			}
			else
			{
				$("#service_type3").empty();
				$("#service_type3").append("<option value='1'>音效(ME)</option>");
				$("#service_type3").append("<option value='2'>视觉障碍的(VI)</option>");
				$("#service_type3").append("<option value='3'>听觉障碍的(HI)</option>");
				$("#service_type3").append("<option value='4'>对话(D)</option>");
				$("#service_type3").append("<option value='5'>评论(C)</option>");
				$("#service_type3").append("<option value='7'>画外音(VO)</option>");
			}
			break;
		case 11:
			if($("#full_service0").is(":checked"))
			{
				$("#service_type0").empty();
				$("#service_type0").append("<option value='0'>Complete Main (CM)</option>");
				$("#service_type0").append("<option value='2'>Visually Impaired (VI)</option>");
				$("#service_type0").append("<option value='3'>Hearing Impaired (HI)</option>");
				$("#service_type0").append("<option value='5'>Commentary (C)</option>");
				$("#service_type0").append("<option value='6'>Emergency (E)</option>");
				$("#service_type0").append("<option value='7'>Karaoke</option>");
			}
			else
			{
				$("#service_type0").empty();
				$("#service_type0").append("<option value='1'>Music and Effects (ME)</option>");
				$("#service_type0").append("<option value='2'>Visually Impaired (VI)</option>");
				$("#service_type0").append("<option value='3'>Hearing Impaired (HI)</option>");
				$("#service_type0").append("<option value='4'>Dialogue (D)</option>");
				$("#service_type0").append("<option value='5'>Commentary (C)</option>");
				$("#service_type0").append("<option value='7'>Voiceover (VO)</option>");
			}
			break;
		case 12:
			if($("#full_service1").is(":checked"))
			{
				$("#service_type1").empty();
				$("#service_type1").append("<option value='0'>Complete Main (CM)</option>");
				$("#service_type1").append("<option value='2'>Visually Impaired (VI)</option>");
				$("#service_type1").append("<option value='3'>Hearing Impaired (HI)</option>");
				$("#service_type1").append("<option value='5'>Commentary (C)</option>");
				$("#service_type1").append("<option value='6'>Emergency (E)</option>");
				$("#service_type1").append("<option value='7'>Karaoke</option>");
			}
			else
			{
				$("#service_type1").empty();
				$("#service_type1").append("<option value='1'>Music and Effects (ME)</option>");
				$("#service_type1").append("<option value='2'>Visually Impaired (VI)</option>");
				$("#service_type1").append("<option value='3'>Hearing Impaired (HI)</option>");
				$("#service_type1").append("<option value='4'>Dialogue (D)</option>");
				$("#service_type1").append("<option value='5'>Commentary (C)</option>");
				$("#service_type1").append("<option value='7'>Voiceover (VO)</option>");
			}
			break;
		case 13:
			if($("#full_service2").is(":checked"))
			{
				$("#service_type2").empty();
				$("#service_type2").append("<option value='0'>Complete Main (CM)</option>");
				$("#service_type2").append("<option value='2'>Visually Impaired (VI)</option>");
				$("#service_type2").append("<option value='3'>Hearing Impaired (HI)</option>");
				$("#service_type2").append("<option value='5'>Commentary (C)</option>");
				$("#service_type2").append("<option value='6'>Emergency (E)</option>");
				$("#service_type2").append("<option value='7'>Karaoke</option>");
			}
			else
			{
				$("#service_type2").empty();
				$("#service_type2").append("<option value='1'>Music and Effects (ME)</option>");
				$("#service_type2").append("<option value='2'>Visually Impaired (VI)</option>");
				$("#service_type2").append("<option value='3'>Hearing Impaired (HI)</option>");
				$("#service_type2").append("<option value='4'>Dialogue (D)</option>");
				$("#service_type2").append("<option value='5'>Commentary (C)</option>");
				$("#service_type2").append("<option value='7'>Voiceover (VO)</option>");
			}
			break;
		case 14:
			if($("#full_service3").is(":checked"))
			{
				$("#service_type3").empty();
				$("#service_type3").append("<option value='0'>Complete Main (CM)</option>");
				$("#service_type3").append("<option value='2'>Visually Impaired (VI)</option>");
				$("#service_type3").append("<option value='3'>Hearing Impaired (HI)</option>");
				$("#service_type3").append("<option value='5'>Commentary (C)</option>");
				$("#service_type3").append("<option value='6'>Emergency (E)</option>");
				$("#service_type3").append("<option value='7'>Karaoke</option>");
			}
			else
			{
				$("#service_type3").empty();
				$("#service_type3").append("<option value='1'>Music and Effects (ME)</option>");
				$("#service_type3").append("<option value='2'>Visually Impaired (VI)</option>");
				$("#service_type3").append("<option value='3'>Hearing Impaired (HI)</option>");
				$("#service_type3").append("<option value='4'>Dialogue (D)</option>");
				$("#service_type3").append("<option value='5'>Commentary (C)</option>");
				$("#service_type3").append("<option value='7'>Voiceover (VO)</option>");
			}
			break;
		default:
			break;
	}
}

