// JavaScript Document
var operateDel2 = "<img src='../../style/img/shanchu1.png' title='删除'  onClick='deleteCurrentRow(this,1)'>";
function addlcn()
{	
	var errornum = 0;
	var returnnum;
	var totalline0 = $("#detail_edit_table").find("tr").length-1;
	if(totalline0 == 63)
	{		
		alert("最大允许的代码个数为63!");
		return;
	}
	returnnum=ValidateParam($("#service_id"),"VALI_INTEGER",0,65535,"<业务标识符>",1);
	if(returnnum==false)
	{
		return;
	}
	returnnum=ValidateParam($("#logic_chan_number"),"VALI_INTEGER",0,1023,"<逻辑频道号>",1);
	if(returnnum==false)
	{
		return;
	}
	$("#detail_edit_table tr").each(function ()
	{                
		if($("#service_id").val() == $(this).children("td:first").text())
		{
			alert("业务标识符重复!");
			errornum++;
			return;
		}
		if($("#logic_chan_number").val() == $(this).children("td:eq(1)").text())
		{
			alert("逻辑频道号重复!");
			errornum++;
			return;
		}		
	});
	if(errornum==0)
	{
		var LcnList = 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");
			col.innerHTML = $("#logic_chan_number").val();
		row.appendChild(col);
		col = document.createElement("td");
		if($("#visibleflag").val() == "0")
		{
			col.innerHTML = "否";
		}
		else
		{
			col.innerHTML = "是";
		}
		row.appendChild(col);
		col= document.createElement("td");
			col.innerHTML = operateDel2;
		row.appendChild(col);
		 LcnList.appendChild(row);
		var totalline = $("#detail_edit_table").find("tr").length-1;
		//清空
		$("#line").val(totalline);
		$("#service_id").val("");
		$("#logic_chan_number").val("");
		$("#visibleflag").val(1);
	}
}
function submitlcndesc()//lcn desc create submit form element
{
	var i=0;
	$("#detail_edit_table tr").each(function ()
	{                
		var s1="service_id"+i;
		var s2="logic_chan_number"+i;
		var s3="visibleflag"+i;
		CreateHiddenFormDesc(s1,s1,$(this).children("td:first").text());
		CreateHiddenFormDesc(s2,s2,$(this).children("td:eq(1)").text());
		if($(this).children("td:eq(2)").text()=="是")
		{
			CreateHiddenFormDesc(s3,s3,1);
		}
		else
		{
			CreateHiddenFormDesc(s3,s3,0);
		}
		i++;
	});	
}
function GetDescInfo()
{
	var psitype=$("#PsiType").val();
	var symbol = "_"
	var edittype = $("#Desc_OperateType").val();
	var curdesctag = $("#cur_desc_tag").val();
	var curdesctype = psitype.concat(symbol,edittype,symbol,curdesctag);
	var DESC_ID=$("#CurDescId").val();
	var sdtsd = $("#SDTSD").val();
	var xmlhttp = getHTTPObject();
	var getParams = "desc_type="+curdesctype+"&desc_id="+DESC_ID+"";
	
	xmlhttp.open("POST", "/goform/mcuGetDescInfo", true);
	xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlhttp.setRequestHeader("Content-length", getParams.length);
	xmlhttp.onreadystatechange = function()
	{
		if(xmlhttp.readyState == 4)
		{
			if((xmlhttp.status>=200&&xmlhttp.status<300)||xmlhttp.status==304)
			{
				var response = xmlhttp.responseText.slice(7, -8);
				var response_array = response.split("&");
				Assignment(1,response_array);
			}
			else
			{
				alert("请求未成功:"+xmlhttp.status);
			}
		}
	}
	xmlhttp.send(getParams);
	return true;
}