var operateEdit1 = "<img src='../../style/img/xiugai.png' title='Modify'  onClick='editproginfo(GetRow(event,0))'>";
//detete descriptor
function deltsdesc()
{
	var rightclick_node = zTree.getSelectedNodes();
	$("#Pos").val(rightclick_node[0].POS);

	$("#OperateType").val("2");
	var confirm_prompt = "Are you sure to delete this descriptor?";
	if(window.confirm(confirm_prompt))
	{
		submitcheck();
	}
}
//main page form submit
function submitcheck(Type)
{
	if(submitcnt!=0)
	{
		return;
	}
	var returnnum;
	var tempid = $("#Curid").val();
	returnnum=ValidateParam($("#tsid"),"VALI_INTEGER",0,65535,"<TS ID>",2);
	if(returnnum==false)
	{
		return;
	}
	if(parseInt($("#tsid").val(),10)!=parseInt(ts_id,10))
	{
		for(i=0; i<psinum; i++)
		{
			if((PsiType[i] == "SDTa")&&(parseInt(Id_Ext[i],10) == parseInt($("#tsid").val(),10)))
			{
				alert("Already exists the SDT(Current) table which has the same Stream ID!");
				return false;
			}
			if((PsiType[i] == "SDTo")&&(parseInt(Id_Ext[i],10) == parseInt($("#tsid").val(),10)))
			{
				alert("Already exists the SDT(Other) table which has the same Stream ID!");
				return false;
			}
		}
	}
	returnnum=ValidateParam($("#netid"),"VALI_INTEGER",0,65535,"<Network ID>",2);
	if(returnnum==false)
	{
		return;
	}
	returnnum=ValidateParam($("#version_num"),"VALI_INTEGER",0,31,"<Version Num>",2);
	if(returnnum==false)
	{
		return;
	}
	switch(Type)
	{
		case "prog_info":
			returnnum=ValidateParam($("#Service_Id"),"VALI_COM_DATA",1,65535,"<Service ID>",2);
			if(returnnum==false)
			{
				return;
			}
			if($("#OperateType").val() == "1")//Modify
			{
				if(parseInt($("#Service_Id").val(),10) != parseInt(service_id[tempid],10))
				{
					for(i=0;i<service_num;i++)
					{	
						if(parseInt($("#Service_Id").val(),10) == parseInt(service_id[i],10))
						{
							alert("Already exists the same Service ID!");
							return false;
						}
					}
				}
			}
			returnnum=ValidateParam($("#service_name"),"LENGTH",0,32,"<Service name>",2);
			if(returnnum==false)
			{
				return;
			}
			returnnum=ValidateParam($("#provider_name"),"LENGTH",0,32,"<Service provider>",2);
			if(returnnum==false)
			{
				return;
			}
			if($("#service_type").val()==17)
			{
				returnnum=ValidateParam($("#custom"),"VALI_INTEGER",17,255,"<Custom Type>",2);
				if(returnnum==false)
				{
					return;
				}
				CreateHiddenFormElem("service_type", $("#custom").val());
			}
			else
			{
				CreateHiddenFormElem("service_type", $("#service_type").val());
			}
			CreateHiddenFormElem("Service_Id", $("#Service_Id").val());
			CreateHiddenFormElem("char_code", $("#char_code").val());
			CreateHiddenFormElem("service_name", $("#service_name").val());
			CreateHiddenFormElem("provider_name", $("#provider_name").val());			
			CreateHiddenFormElem("Run_Status", $("#Run_Status").val());
			CreateHiddenFormElem("Ca_Mode", $("#Ca_Mode").val());
			CreateHiddenFormElem("EIT_schedule_flag", $("#EIT_schedule_flag").val());
			CreateHiddenFormElem("EIT_pre_follow_flag", $("#EIT_pre_follow_flag").val());
			break;		
		case "Apply":
			$("#Apply_Enable").val("1");
			break;
	}	
	$("#myform").submit();
	submitcnt++;
	setTimeout("self.location.reload(true)",1000);
}