//检测参数设置
function ValidateNum(item,type,str)
{
	var returnVal = 0;
	var intVal;
	var strVal = new String(item.val());
	var ch;
	var i;
	var j;
	//---------------------------------------------------------------------------------------网络参数相关-----------------------------------------------------------------------------------//
	if(type == "LOCAL_IP_ADDR")//0.0.0.0~223.255.255.255(not include boundary value)
	{
		var ZeroNum = 0;
		var InvalidNum = 0;
		ipaddr = strVal.split(".");
		if(ipaddr.length != 4)
		{
			alert("Please input valid "+str+" address!");
			item.focus();
			return false;
		}
		if(parseInt(ipaddr[0], 10) == 127)//127.x.x.x is not valid
		{
			alert("Please input valid "+str+" address!");
			item.focus();
			return false; 
		}
		if(parseInt(ipaddr[0], 10) > 223)
		{
			alert(str+" can only be a unicast address!");
			item.focus();
			return false; 
		}
		/*if(parseInt(ipaddr[3], 10) == 0)//remain to be discussed
		{
			alert("Please input valid "+str+" address!");
			item.focus();
			return false; 
		}*/
		for(j = 0; j < 4; j++)
		{
			strVal = ipaddr[j];			
			if(strVal.length>3)
			{
				alert("Please input valid "+str+" address!");
				item.focus();
				return false; 
			}
			for ( i = 0 ; i < strVal.length ; i++ )
			{      
				ch = strVal.charAt(i);
				if(ch < '0' || ch > '9')
				{
					alert("Please input valid "+str+" address!");
					item.focus();
					return false;
				}
			}
			if(strVal=="")
			{
				alert("Please input valid "+str+" address!");
				item.focus();
				return false; 
			}	
			intVal= parseInt(strVal, 10);
			if(intVal > 255)
			{
				alert("Please input valid "+str+" address!");
				item.focus();
				return false; 
			}
			if(intVal == 0)
			{
				ZeroNum++;
			}
			if(intVal == 255)
			{
				InvalidNum++;
			}								
		}
		if(ZeroNum == 4)//0.0.0.0 is not valid
		{
			alert("Please input valid "+str+" address!");
			item.focus();
			return false; 
		}
		if(parseInt(ipaddr[0], 10) == 223)//223.255.255.255 is not valid
		{
			if(InvalidNum == 3)
			{
				alert("Please input valid "+str+" address!");
				item.focus();
				return false; 
			}
		}
	}
	if(type == "GATEWAY")//0.0.0.0(include)~223.255.255.255(not include)
	{
		var InvalidNum = 0;
		ipaddr = strVal.split(".");
		if(ipaddr.length != 4)
		{
			alert("Please input valid "+str+" address!");
			item.focus();
			return false;
		}
		if(parseInt(ipaddr[0], 10) > 223)
		{
			alert(str+" can only be a unicast address!");
			item.focus();
			return false; 
		}
		for(j = 0; j < 4; j++)
		{
			strVal = ipaddr[j];			
			if(strVal.length>3)
			{
				alert("Please input valid "+str+" address!");
				item.focus();
				return false; 
			}
			for ( i = 0 ; i < strVal.length ; i++ )
			{      
				ch = strVal.charAt(i);
				if(ch < '0' || ch > '9')
				{
					alert("Please input valid "+str+" address!");
					item.focus();
					return false;
				}
			}
			if(strVal=="")
			{
				alert("Please input valid "+str+" address!");
				item.focus();
				return false; 
			}	
			intVal= parseInt(strVal, 10);
			if(intVal > 255)
			{
				alert("Please input valid "+str+" address!");
				item.focus();
				return false; 
			}
			if(intVal == 255)
			{
				InvalidNum++;
			}								
		}
		if(parseInt(ipaddr[0], 10) == 223)//223.255.255.255 is not valid
		{
			if(InvalidNum == 3)
			{
				alert("Please input valid "+str+" address!");
				item.focus();
				return false; 
			}
		}
	}
	if(type == "SOURCEIP")//0.0.0.0(include)~223.255.255.255(not include)
	{
		var InvalidNum = 0;
		ipaddr = strVal.split(".");
		if(ipaddr.length != 4)
		{
			alert("Please input valid "+str+" address!");
			item.focus();
			return false;
		}
		if(parseInt(ipaddr[0], 10) > 223)
		{
			alert(str+" can only be a unicast address!");
			item.focus();
			return false; 
		}
		for(j = 0; j < 4; j++)
		{
			strVal = ipaddr[j];			
			if(strVal.length>3)
			{
				alert("Please input valid "+str+" address!");
				item.focus();
				return false; 
			}
			for ( i = 0 ; i < strVal.length ; i++ )
			{      
				ch = strVal.charAt(i);
				if(ch < '0' || ch > '9')
				{
					alert("Please input valid "+str+" address!");
					item.focus();
					return false;
				}
			}
			if(strVal=="")
			{
				alert("Please input valid "+str+" address!");
				item.focus();
				return false; 
			}	
			intVal= parseInt(strVal, 10);
			if(intVal > 255)
			{
				alert("Please input valid "+str+" address!");
				item.focus();
				return false; 
			}
			if(intVal == 255)
			{
				InvalidNum++;
			}								
		}
		if(parseInt(ipaddr[0], 10) == 223)//223.255.255.255 is not valid
		{
			if(InvalidNum == 3)
			{
				alert("Please input valid "+str+" address!");
				item.focus();
				return false; 
			}
		}
	}
	if(type == "PORTIP")//0.0.0.0(not include)~255.255.255.255(include)
	{
		var ZeroNum = 0;
		var InvalidNum = 0;
		ipaddr = strVal.split(".");
		if(ipaddr.length != 4)
		{
			alert("Please input valid "+str+" address!");
			item.focus();
			return false;
		}
		if(parseInt(ipaddr[0], 10) == 127)//127.x.x.x is not valid
		{
			alert("Please input valid "+str+" address!");
			item.focus();
			return false; 
		}
		for(j = 0; j < 4; j++)
		{
			strVal = ipaddr[j];			
			if(strVal.length>3)
			{
				alert("Please input valid "+str+" address!");
				item.focus();
				return false; 
			}
			for ( i = 0 ; i < strVal.length ; i++ )
			{      
				ch = strVal.charAt(i);
				if(ch < '0' || ch > '9')
				{
					alert("Please input valid "+str+" address!");
					item.focus();
					return false;
				}
			}
			if(strVal=="")
			{
				alert("Please input valid "+str+" address!");
				item.focus();
				return false; 
			}	
			intVal= parseInt(strVal, 10);
			if(intVal > 255)
			{
				alert("Please input valid "+str+" address!");
				item.focus();
				return false; 
			}
			if(intVal == 0)
			{
				ZeroNum++;
			}							
		}
		if(ZeroNum == 4)//0.0.0.0 is not valid
		{
			alert("Please input valid "+str+" address!");
			item.focus();
			return false; 
		}
	}
	else if(type == "IP_ADDR_SINGLE")//单播IP地址
	{
		ipaddr = strVal.split(".");
		if(ipaddr.length != 4)
		{
			alert("Please input valid "+str+" address!");
			item.focus();
			return false;
		}
		tempVal = ipaddr[0];
		intVal= parseInt(tempVal, 10);
		if(intVal > 223)
		{
			alert(str+" can only be a unicast address!");
			item.focus();
			return false; 
		}
		for(j = 0; j < 4; j++)
		{
			strVal = ipaddr[j];
			if(strVal=="")
			{
				alert("Please input valid "+str+" address!");
				item.focus();
				return false; 
			}
			for ( i = 0 ; i < strVal.length ; i++ )
			{      
				ch = strVal.charAt(i);
				if(ch < '0' || ch > '9')
				{
					alert("Please input valid "+str+" address!");
					item.focus();
					return false;
				}
			}
			intVal= parseInt(strVal, 10);
			if(intVal > 255)
			{
				alert("Please input valid "+str+" address!");
				item.focus();
				return false; 
			}
		}
	}
	else if(type == "SUBMASK")//子网掩码
	{
		var pre_sign = 0;
		var AllOneCnt = 0;
		var OneEndSign = 0;
		var cursubmask = strVal.split(".");
		if(cursubmask.length != 4)
		{
			alert("Please input valid "+str+" address!");
			item.focus();
			return false;
		}
		for(j = 0; j < 4; j++)
		{
			strVal = cursubmask[j];
			if(strVal.length>3)
			{
				alert("Please input valid "+str+" address!");
				item.focus();
				return false; 
			}
			for ( i = 0 ; i < strVal.length ; i++ )
			{      
				ch = strVal.charAt(i);
				if(ch < '0' || ch > '9')
				{
					alert("Please input valid "+str+" address!");
					item.focus();
					return false;
				}
			}
			MaskValue= parseInt(strVal, 10);
			if(MaskValue == 0)
			{
				if(j == 0)//the first of the mask is 0,is not valid.(0.x.x.x)
				{
					alert("Please input valid "+str+" address!");
					item.focus();
					return false;
				}
				else//record has already exist 0,later 1 is not allowed
				{
					pre_sign = 1;
				}
			}
			else if((MaskValue == 128)||(MaskValue == 192)||(MaskValue == 224)||(MaskValue == 240)||(MaskValue == 248)||(MaskValue == 252)||(MaskValue == 254))
			{
				if(OneEndSign == 0)
				{
					if(pre_sign == 1)
					{
						alert("Please input valid "+str+" address!");
						item.focus();
						return false;
					}
					else
					{
						OneEndSign = 1;
					}
				}
				else
				{
					alert("Please input valid "+str+" address!");
					item.focus();
					return false;
				}
			}
			else if(MaskValue == 255)
			{
				if((OneEndSign == 1)||(pre_sign == 1))//before this has already exist discontinuous 1.
				{
					alert("Please input valid "+str+" address!");
					item.focus();
					return false;
				}
				AllOneCnt++;
			}
			else
			{			
				alert("Please input valid "+str+" address!");
				item.focus();
				return false; 
			}
		}
		if(AllOneCnt == 4)
		{
			alert("Please input valid "+str+" address!");
			item.focus();
			return false; 
		}
	}
	else if(type == "GBEMAC")//主千兆卡MAC
	{
		if(strVal=="")
		{
			alert("Please input valid "+str+" address!");
			item.focus();
			return false; 
		}
		if(strVal.length!=2)
		{
			alert("Please input valid "+str+" address!");
			item.focus();
			return false; 
		}
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9'&& ch < 'A' || ch > 'F' && ch < 'a' || ch > 'f')
			{
				alert(str+"Please input valid hexadecimal number");
				item.focus();
		        return false; 
			}
		}
	}
	else if(type == "MAC")//MAC
	{
		if(strVal=="")
		{
			alert("Please input"+str);
			item.focus();
			return false; 
		}
	    if(strVal.length!=3)
	    {
		   alert(str+"'length must be three!");
		   item.focus();
		   return false; 
	    }
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
			if(ch < '0' || ch > '9'&& ch < 'A' || ch > 'F' && ch < 'a' || ch > 'f')
			{
				alert(str+"Please input valid hexadecimal number!");
				item.focus();
			   return false;
			}
		}
	}
	else if(type == "PID")//PID
	{
		if(strVal=="")//不能为空
	   	{
			alert("Please input"+str);
			item.focus();
			return false; 
	    }
		if(strVal.length == 1)//如果输入一位数，那么必须为1~9的十进制数
		{
			ch0 = strVal.charAt(0);
			if(ch0 < '0' || ch0 > '9')
			{
				alert(str+"Please input valid number!");
				item.focus();
				return false;
			}
		}
		else//长度大于1的情况 
		{	
			ch0 = strVal.charAt(0);
			ch1 = strVal.charAt(1);
			if(((ch0 == '0')&&(ch1 == 'x'))||((ch0 == '0')&&(ch1 == 'X')))//如果是0x开头，默认为输入十六进制数据
			{
				if(strVal.length == 2)
				{
					alert(str+"Please input valid number!");
					item.focus();
					return false;
				}
				for ( i = 0 ; i < strVal.length-2; i++ )
				{      
					ch = strVal.charAt(i+2);
					if(ch < '0' || ch > '9'&& ch < 'A' || ch > 'F' && ch < 'a' || ch > 'f')
					{
						alert(str+"Please input valid number!");
						item.focus();
						return false;
					}
				}
				intVal= parseInt(item.val(),16);
				if((intVal <0)||(intVal > 8191))
				{
					alert(str+"must be between 0x0000 and 0x1fff!");
					item.focus();
					return false;
				}
			}
			else if((ch0 == '0')&&(parseInt(item.val())!=0))//否则的话不能以0作为开头
			{
				alert(str+"Please input valid number!");
				item.focus();
				return false;
			}
			else//认为输入十进制数
			{
				for ( i = 0 ; i < strVal.length ; i++ )
				{      
					ch = strVal.charAt(i);
					if(ch < '0' || ch > '9')
					{
						alert(str+"Please input valid number!");
						item.focus();
						return false;
					}
				}
				intVal= parseInt(item.val(),10);
				if((intVal <0)||(intVal > 8191))
				{
					alert(str+"must be between 0 and 8191!");
					item.focus();
					return false;
				}
			}
		} 
	}
	else if(type == "TTL")
	{
		if(strVal=="")
	   {
			alert("Please input"+str);
		item.focus();
		return false; 
	   }
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
	       		return false; 
			}
		}
		intVal= parseInt(item.val(),10);
		if((intVal <1)||(intVal > 255))
		{
			alert(str+"must be between 1 and 255!");
			item.focus();
			return false; 
		}
	}
	else if(type == "PORT")//端口
	{
	 	if(strVal=="")
	    {
			alert("Please input"+str);
			item.focus();
			return false; 
	    }
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
	       		return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if((intVal <1)||(intVal >65535))
		{
			alert(str+" must be between 1 and 65535!");
			item.focus();
			return false; 
		}
	}
	else if(type == "PORTNUM")//添加的端口的个数
	{
		if(strVal=="")
	    {
			 alert("Please input"+str);
			 item.focus();
			 return false; 
	    }
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
	       		return false; 
			}
		}
		intVal= parseInt(item.val(),10);
		if(intVal < 1)
		{
			alert(str+" must be larger than 0!");
			item.focus();
			return false; 
		}
	} 
	else if(type == "STEP")//步进值
	{
		if(strVal=="")
	   	{
			alert("Please input"+str);
			item.focus();
			return false; 
	    }
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
	       	    return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if((intVal <1)||(intVal > 65535))
		{
			alert(str+" must be between 1 and 65535!");
			item.focus();
			return false;
		}
	}  
	//------------------------------------------------------------------------------调制解调类相关参数-------------------------------------------------------------------------------//
	else if(type == "FREQ")//本振频率，下行频率
	{
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
	       		return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if(intVal > 99999999 || intVal <1)
		{
			alert(str+" must be between 1 and 99999999!");
			item.focus();
			return false; 
		}
	}
	else if(type == "OUTFREQU")//QAM卡输出频率
	{
		if(strVal=="")
	    {
			alert("Please input"+str);
			item.focus();
			return false;
	    }
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
			 return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if((intVal <52000)||(intVal > 940000))
		{
			alert(str+" must be between 52000 and 940000!");
			item.focus();
			return false;
		}
	}
	else if(type == "SN")//信噪比
	{
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
	       		return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if(intVal > 10 || intVal <1)
		{
			alert(str+" must be between 1 and 10!");
			item.focus();
			return false; 
		}
	}
	else if(type == "SYMBOLRATE")//QPSK符号率
	{
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
	       		return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if(intVal > 999999000 || intVal <1)
		{
			alert(str+" must be between 1 and 999999000!");
			item.focus();
			return false; 
		}
	}
	else if(type == "OUTLEVEL")//输出电平
	{
		if(strVal=="")
		{
			alert("Please input valid "+ str);
			item.focus();
			return false;
		}
		for ( i = 0 ; i < strVal.length ; i++ )
		{
			ch = strVal.charAt(i);
			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid number between 95.0 and 115.0!");
				item.focus();
				return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if(intVal > 1150 || intVal <950)
		{
			alert(str+"must be between 95.0 and 115.0!");
			item.focus();
			return false;
		}
		if(intVal%5!=0)
		{
			alert(str+"must be a multiple of 0.5!");
			item.focus();
			return false;
		}
	}
	else if(type == "QAMSYMBOLRATE")//QAM符号率
	{
		if(strVal=="")
	   {
		alert("Please input"+str);
		item.focus();
		return false; 
	   }
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
	       		return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if((intVal <5000)||(intVal > 7000))
		{
			alert(str+" must be between 5000 and 7000!");
			item.focus();
			return false;
		}
	}	
	
	//------------------------------------------------------------------------------------------码率系列-------------------------------------------------------------------------------//
	else if(type == "RFRATE")//主千兆卡端口基准码率
	{
		if(strVal=="")
	   	{
			alert("Please input"+str);
			item.focus();
			return false; 
		}
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
	       		return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if(intVal > 200000000)
		{
			alert(str+" must be smaller than 200000000bps!");
			item.focus();
			return false;
		}
	}
	else if(type == "BKUPRATE")//备份页面网口下的码率阈值
	{
	   if(strVal=="")
	   {
			alert("Please input"+str);
			item.focus();
			return false; 
	   }
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
			    return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if(intVal > 1000000000)
		{
			alert(str+" must be smaller than 1000000000bps!");
			item.focus();
			return false;
		}
	}
	else if(type == "BITRATE")//主千兆卡系统码率
	{
	   if(strVal=="")
	   {
			alert("Please input"+str);
			item.focus();
			return false; 
	   }
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
			    return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if(intVal > 200000000)
		{
			alert(str+" must be smaller than 200000000bps!");
			item.focus();
			return false;
		}
	}
	else if(type == "OUTBITRATE")//4输出卡输出系统码率
	{
		if(strVal=="")
		{
		alert("Please input"+str);
		item.focus();
		return false; 
		}
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
				return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if(intVal > 213000000)
		{
			alert(str+" must be smaller than 213000000bps!");
			item.focus();
			return false;
		}
	}
	else if(type == "COUTBITRATE")//355卡输出系统码率和基准码率
	{
		if(strVal=="")
		{
		alert("Please input"+str);
		item.focus();
		return false; 
		}
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
	       		return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if((intVal > 205000000)|| (intVal<500000))
		{
			alert(str+" must be between 500000 and 205000000bps!");
			item.focus();
			return false;
		}
	}
	else if(type == "OUTDELAYTIME")//355卡输出复用延时
	{
		if(strVal=="")
		{
		alert("Please input"+str);
		item.focus();
		return false; 
		}
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
	       		return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if((intVal > 19418) || (intVal<0))
		{
			alert(str+" must be between 1 and 19148us!");
			item.focus();
			return false;
		}
	}
  	else if(type == "PROG")//节目号
	{
   		if(strVal=="")//不能为空
	   	{
			alert("Please input"+str);
			item.focus();
			return false; 
	    }
		if(strVal.length == 1)//如果输入一位数，那么必须为1~9的十进制数
		{
			ch0 = strVal.charAt(0);
			if(ch0 < '1' || ch0 > '9')
			{
				alert(str+"Please input valid number!");
				item.focus();
				return false;
			}
		}
		else//长度大于1的情况 
		{	
			ch0 = strVal.charAt(0);
			ch1 = strVal.charAt(1);
			if(((ch0 == '0')&&(ch1 == 'x'))||((ch0 == '0')&&(ch1 == 'X')))//如果是0x开头，默认为输入十六进制数据
			{
				if(strVal.length == 2)
				{
					alert(str+"Please input valid number!");
					item.focus();
					return false;
				}
				for ( i = 0 ; i < strVal.length-2; i++ )
				{      
					ch = strVal.charAt(i+2);
					if(ch < '0' || ch > '9'&& ch < 'A' || ch > 'F' && ch < 'a' || ch > 'f')
					{
						alert(str+"Please input valid number!");
						item.focus();
						return false;
					}
				}
				intVal= parseInt(item.val(),16);
				if((intVal <1)||(intVal > 65535))
				{
					alert(str+"must be between 0x0001 and 0xffff!");
					item.focus();
					return false;
				}
			}
			else if(ch0 == '0')//否则的话不能以0作为开头
			{
				alert(str+"Please input valid number!");
				item.focus();
				return false;
			}
			else//认为输入十进制数
			{
				for ( i = 0 ; i < strVal.length ; i++ )
				{      
					ch = strVal.charAt(i);
					if(ch < '0' || ch > '9')
					{
						alert(str+"Please input valid number!");
						item.focus();
						return false;
					}
				}
				intVal= parseInt(item.val(),10);
				if((intVal <1)||(intVal > 65535))
				{
					alert(str+"must be between 1 and 65535!");
					item.focus();
					return false;
				}
			}
		} 
 	 }
	else if(type == "INTERVAL")//发表间隔
	{
		if(strVal=="")
	   {
			alert("Please input"+str);
			item.focus();
			return false; 
	   }
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
	       		return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if((intVal > 0)&&(intVal < 50))
		{
			alert(str+"cann't be between 1 and 49!");
			item.focus();
			return false;
		}
		if(intVal > 65535)
		{
			alert(str+"cannot be larger than 65535!");
			item.focus();
			return false;
		}
	}
	else if(type == "NAME")
	{
		if(strVal=="")
		{
			alert("Please input"+str);
			item.focus();
			return false; 
		}
		if(strVal.replace(/[^\x00-\xff]/g,'**').length > 31)
		{
			alert("The length of " + str + " cann't be larger than 31!");
			item.focus();
			return false; 
		}
	}
	else if(type == "SWTIME")//主千兆卡通信超时时间
	{
		if(strVal=="")
	    {
			alert("Please input"+str);
			item.focus();
			return false; 
	    }
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
	       		return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if((intVal <100)||(intVal > 65535))
		{
			alert(str+"must be between 100 and 65535!");
			item.focus();
			return false;
		}
	}
//------------------------------------------------------------------**表编辑相关参数合法性验证**------------------------------------------------------------------------------------//////
  else if(type == "IDENTIFIER")//标识符
	{
		if(strVal=="")
	    {
			alert("Please input"+str);
			item.focus();
			return false; 
	    }
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
	       		return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if((intVal <0)||(intVal > 65535))
		{
			alert(str+"must be between 0 and 65535!");
			item.focus();
			return false;
		}
	}
	else if(type == "CHPID")//音视频PID
	{
		if(strVal=="")//不能为空
	   	{
			alert("Please input"+str);
			item.focus();
			return false; 
	    }
		if(strVal.length == 1)//如果输入一位数制数
		{
			ch0 = strVal.charAt(0);
			if(ch0 < '1' || ch0 > '9')
			{
				alert(str+"Please input valid number!");
				item.focus();
				return false;
			}
			else
			{
				alert(str+"must be between 32 and 8190!");
				item.focus();
				return false;
			}
		}
		else//长度大于1的情况 
		{	
			ch0 = strVal.charAt(0);
			ch1 = strVal.charAt(1);
			if(((ch0 == '0')&&(ch1 == 'x'))||((ch0 == '0')&&(ch1 == 'X')))//如果是0x开头，默认为输入十六进制数据
			{
				if(strVal.length == 2)
				{
					alert(str+"Please input valid number!");
					item.focus();
					return false;
				}
				for ( i = 0 ; i < strVal.length-2; i++ )
				{      
					ch = strVal.charAt(i+2);
					if(ch < '0' || ch > '9'&& ch < 'A' || ch > 'F' && ch < 'a' || ch > 'f')
					{
						alert(str+"Please input valid number!");
						item.focus();
						return false;
					}
				}
				intVal= parseInt(item.val(),16);
				if((intVal <32)||(intVal > 8190))
				{
					alert(str+"must be between 0x20 and 0x1ffe!");
					item.focus();
					return false;
				}
			}
			else if(ch0 == '0')//否则的话不能以0作为开头
			{
				alert(str+"Please input valid number!");
				item.focus();
				return false;
			}
			else//认为输入十进制数
			{
				for ( i = 0 ; i < strVal.length ; i++ )
				{      
					ch = strVal.charAt(i);
					if(ch < '0' || ch > '9')
					{
						alert(str+"Please input valid number!");
						item.focus();
						return false;
					}
				}
				intVal= parseInt(item.val(),10);
				if((intVal <32)||(intVal > 8190))
				{
					alert(str+"must be between 32 and 8190!");
					item.focus();
					return false;
				}
			}
		} 
	}
	else if(type == "PROGIDENTIFIER")//节目标识符
	{
		if(strVal=="")//不能为空
	   	{
			alert("Please input"+str);
			item.focus();
			return false; 
	    }
		if(strVal.length == 1)//如果输入一位数，那么必须为1~9的十进制数
		{
			ch0 = strVal.charAt(0);
			if(ch0 < '1' || ch0 > '9')
			{
				alert(str+"Please input valid number!");
				item.focus();
				return false;
			}
		}
		else//长度大于1的情况 
		{	
			ch0 = strVal.charAt(0);
			ch1 = strVal.charAt(1);
			if(((ch0 == '0')&&(ch1 == 'x'))||((ch0 == '0')&&(ch1 == 'X')))//如果是0x开头，默认为输入十六进制数据
			{
				if(strVal.length == 2)
				{
					alert(str+"Please input valid number!");
					item.focus();
					return false;
				}
				for ( i = 0 ; i < strVal.length-2; i++ )
				{      
					ch = strVal.charAt(i+2);
					if(ch < '0' || ch > '9'&& ch < 'A' || ch > 'F' && ch < 'a' || ch > 'f')
					{
						alert(str+"Please input valid number!");
						item.focus();
						return false;
					}
				}
				intVal= parseInt(item.val(),16);
				if((intVal <1)||(intVal > 65535))
				{
					alert(str+"must be between 0x0001 and 0xffff!");
					item.focus();
					return false;
				}
			}
			else if(ch0 == '0')//否则的话不能以0作为开头
			{
				alert(str+"Please input valid number!");
				item.focus();
				return false;
			}
			else//认为输入十进制数
			{
				for ( i = 0 ; i < strVal.length ; i++ )
				{      
					ch = strVal.charAt(i);
					if(ch < '0' || ch > '9')
					{
						alert(str+"Please input valid number!");
						item.focus();
						return false;
					}
				}
				intVal= parseInt(item.val(),10);
				if((intVal <1)||(intVal > 65535))
				{
					alert(str+"must be between 1 and 65535!");
					item.focus();
					return false;
				}
			}
		} 
	}
	else if(type == "BISS_PROGNO")//节目标识符，业务标识符
	{
		if(strVal=="")//不能为空
	   	{
			alert("Please input"+str);
			item.focus();
			return false; 
	    }
		if(strVal.length == 1)//如果输入一位数，那么必须为1~9的十进制数
		{
			ch0 = strVal.charAt(0);
			if(ch0 < '0' || ch0 > '9')
			{
				alert(str+"Please input valid number!");
				item.focus();
				return false;
			}
		}
		else//长度大于1的情况 
		{	
			ch0 = strVal.charAt(0);
			ch1 = strVal.charAt(1);
			if(((ch0 == '0')&&(ch1 == 'x'))||((ch0 == '0')&&(ch1 == 'X')))//如果是0x开头，默认为输入十六进制数据
			{
				if(strVal.length == 2)
				{
					alert(str+"Please input valid number!");
					item.focus();
					return false;
				}
				for ( i = 0 ; i < strVal.length-2; i++ )
				{      
					ch = strVal.charAt(i+2);
					if(ch < '0' || ch > '9'&& ch < 'A' || ch > 'F' && ch < 'a' || ch > 'f')
					{
						alert(str+"Please input valid number!");
						item.focus();
						return false;
					}
				}
				intVal= parseInt(item.val(),16);
				if((intVal <0)||(intVal > 65535))
				{
					alert(str+"must be between 0x0000 and 0xffff!");
					item.focus();
					return false;
				}
			}
			else if((ch0 == '0')&&(parseInt(item.val())!=0))//否则的话不能以0作为开头
			{
				alert(str+"Please input valid number!");
				item.focus();
				return false;
			}
			else//认为输入十进制数
			{
				for ( i = 0 ; i < strVal.length ; i++ )
				{      
					ch = strVal.charAt(i);
					if(ch < '0' || ch > '9')
					{
						alert(str+"Please input valid number!");
						item.focus();
						return false;
					}
				}
				intVal= parseInt(item.val(),10);
				if((intVal <0)||(intVal > 65535))
				{
					alert(str+"must be between 0 and 65535!");
					item.focus();
					return false;
				}
			}
		} 
	}
	else if(type == "ID")//流ID,原始网络ID
	{
		if(strVal=="")
	    {
			alert("Please input"+str);
			item.focus();
			return false; 
	    }
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
	       		return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if((intVal <0)||(intVal > 65535))
		{
			alert(str+"must be between 0 and 65535!");
			item.focus();
			return false;
		}
	}
	else if(type == "ELAMENTTYPE")//单元类型
	{
		if(strVal=="")
	    {
			alert("Please input"+str);
			item.focus();
			return false; 
	    }
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
	       		return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if((intVal <0)||(intVal > 255))
		{
			alert(str+"must be between 0 and 255!");
			item.focus();
			return false;
		}
	}
	else if(type == "DESC_TAG")//描述符标识
	{
		if(strVal=="")//不能为空
	   	{
			alert("Please input"+str);
			item.focus();
			return false; 
	    }
		if(strVal.length == 1)//如果输入一位数，那么必须为1~9的十进制数
		{
			ch0 = strVal.charAt(0);
			if(ch0 < '1' || ch0 > '9')
			{
				alert(str+"Please input valid number!");
				item.focus();
				return false;
			}
		}
		else//长度大于1的情况 
		{	
			ch0 = strVal.charAt(0);
			ch1 = strVal.charAt(1);
			if(((ch0 == '0')&&(ch1 == 'x'))||((ch0 == '0')&&(ch1 == 'X')))//如果是0x开头，默认为输入十六进制数据
			{
				if(strVal.length == 2)
				{
					alert(str+"Please input valid number!");
					item.focus();
					return false;
				}
				for ( i = 0 ; i < strVal.length-2; i++ )
				{      
					ch = strVal.charAt(i+2);
					if(ch < '0' || ch > '9'&& ch < 'A' || ch > 'F' && ch < 'a' || ch > 'f')
					{
						alert(str+"Please input valid number!");
						item.focus();
						return false;
					}
				}
				intVal= parseInt(item.val(),16);
				if((intVal <1)||(intVal > 254))
				{
					alert(str+"must be between 0x01 and 0xfe!");
					item.focus();
					return false;
				}
			}
			else if(ch0 == '0')//否则的话不能以0作为开头
			{
				alert(str+"Please input valid number!");
				item.focus();
				return false;
			}
			else//认为输入十进制数
			{
				for ( i = 0 ; i < strVal.length ; i++ )
				{      
					ch = strVal.charAt(i);
					if(ch < '0' || ch > '9')
					{
						alert(str+"Please input valid number!");
						item.focus();
						return false;
					}
				}
				intVal= parseInt(item.val(),10);
				if((intVal <1)||(intVal > 254))
				{
					alert(str+"must be between 1 and 254!");
					item.focus();
					return false;
				}
			}
		} 
	}
	else if(type == "DESC_DATA")//描述符数据（由于数据很长，可以暂时不对长度做限制）
	{
		if(strVal=="")
	    {
			alert("Please input"+str);
			item.focus();
			return false; 
	    }
		if(strVal.length >510)
		{
			alert("Has exceeded the maximum length of data, can not be added!");
			item.focus();
			return false; 
		}
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9'&& ch < 'A' || ch > 'F' && ch < 'a' || ch > 'f')
			{
				alert(str+"Please input valid hexadecimal number");
				item.focus();
	       		return false;
			}
		}
	}
	else if(type == "MAJCHAN")//ATSC Maj_channel
	{
		if(strVal=="")
	    {
			alert("Please input"+str);
			item.focus();
			return false; 
	    }
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
	       		return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if((intVal < 1)||(intVal > 99))
		{
			alert(str+"must be between 1 and 99!");
			item.focus();
			return false;
		}
	}
	else if(type == "MINCHAN")//ATSC Min_channel
	{
		if(strVal=="")
	    {
			alert("Please input"+str);
			item.focus();
			return false; 
	    }
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
	       		return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if((intVal < 0)||(intVal > 999))
		{
			alert(str+"must be between 0 and 999!");
			item.focus();
			return false;
		}
	}
	else if(type == "CHANID")//ATSC Channel_TSID
	{
		if(strVal=="")
	    {
			alert("Please input"+str);
			item.focus();
			return false; 
	    }
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
	       		return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if((intVal < 0)||(intVal > 65535))
		{
			alert(str+"must be between 0 and 65535!");
			item.focus();
			return false;
		}
	}
	else if(type == "SRCID")//ATSC SRC ID
	{
		if(strVal=="")
	    {
			alert("Please input"+str);
			item.focus();
			return false; 
	    }
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
	       		return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if((intVal < 1)||(intVal > 4095))
		{
			alert(str+"must be between 1 and 4095!");
			item.focus();
			return false;
		}
	}
	else if(type == "VERSIONNUM")//版本号
	{
		if(strVal=="")
	    {
			alert("Please input"+str);
			item.focus();
			return false; 
	    }
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
	       		return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if((intVal <0)||(intVal > 31))
		{
			alert(str+"must be between 0 and 31!");
			item.focus();
			return false;
		}
	}
	else if(type == "TRAPINTERVAL")//告警间隔
	{
		if(strVal=="")
	    {
			alert("Please input"+str);
			item.focus();
			return false; 
	    }
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
	       		return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if((intVal <0)||(intVal > 65535))
		{
			alert(str+"must be between 0 and 65535!");
			item.focus();
			return false;
		}
	}
	else if(type == "SEARCHTIME")//搜表超时
	{
		if(strVal=="")
	    {
			alert("Please input"+str);
			item.focus();
			return false; 
	    }
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
	       		return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if((intVal <0)||(intVal > 50))
		{
			alert(str+"must be between 0 and 50!");
			item.focus();
			return false;
		}
	}
	else if(type == "CUSTOMTYPE")
	{
		if(strVal=="")
	    {
			alert("Please input"+str);
			item.focus();
			return false; 
	    }
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
	       		return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if((intVal <17)||(intVal > 255))
		{
			alert(str+"must be between 17 and 255!");
			item.focus();
			return false;
		}
	}
	else if(type == "GROUPDELAY")//
	{
		if(strVal=="")
	    {
			alert("Please input"+str);
			item.focus();
			return false; 
	    }
		for ( i = 0 ; i < strVal.length ; i++ )
		{      
			ch = strVal.charAt(i);
 			if(ch < '0' || ch > '9')
			{
				alert(str+"Please input valid decimal integer!");
				item.focus();
	       		return false;
			}
		}
		intVal= parseInt(item.val(),10);
		if((intVal <0)||(intVal > 65535))
		{
			alert(str+"must be between 0 and 65535!");
			item.focus();
			return false;
		}
	}
  return true;
}
function ChgMenu(tablemenu,Num) 
{ 
	hiddenform=parent.frames[0].document.hiddenform;
	if (tablemenu.style.display == "none") 
	{
		tablemenu.style.display = ""; 
		if(Num == 0)
		{
			hiddenform.TableStyle0.value = "1";
		}
		else if(Num == 1)
		{
			hiddenform.TableStyle1.value = "1";
		}
	}
	else 
	{
		tablemenu.style.display = "none"; 
		if(Num == 0)
		{
			hiddenform.TableStyle0.value = "0";
		}
		else if(Num == 1)
		{
			hiddenform.TableStyle1.value = "0";
		}
		//if(hiddenform.TableStyle6.value >= 2*Num && hiddenform.TableStyle6.value <= 2*Num-1)
		  //SysSet.color= #CA00CA;
	}
}
function confirm_reset()
{
	 var iWidth=500; //窗口宽度
     var iHeight=400;//窗口高度
     var iTop=(window.screen.height-iHeight)/2;
     var iLeft=(window.screen.width-iWidth)/2;
	var ret=confirm("Reboot the systerm？");
	if(ret==true)
	{
		window.open("reset.asp","Message","Scrollbars=no,Toolbar=no,Location=no,Direction=no,Resizeable=no,Width="+iWidth+" ,Height="+iHeight+",top="+iTop+",left="+iLeft);
		document.form2.submit();
	}
}
function confirm_defalt()
{
	 var iWidth=500; //窗口宽度
     var iHeight=400;//窗口高度
     var iTop=(window.screen.height-iHeight)/2;
     var iLeft=(window.screen.width-iWidth)/2;
	var ret=confirm("Restore factory?");
	if(ret==true)
	{
		window.open("defalt.asp","Message","Scrollbars=no,Toolbar=no,Location=no,Direction=no,Resizeable=no,Width="+iWidth+" ,Height="+iHeight+",top="+iTop+",left="+iLeft);
		document.form3.submit();
	}
}
function ipcompare(str1,str2)
{
	var arr1 = str1.split(".");
	var arr2 = str2.split(".");
	if((parseInt(arr1[0],10) == parseInt(arr2[0],10))&&
		(parseInt(arr1[1],10) == parseInt(arr2[1],10))&&
		(parseInt(arr1[2],10) == parseInt(arr2[2],10))&&
		(parseInt(arr1[3],10) == parseInt(arr2[3],10)))
	{
		return true;
	}
	else
	{
		return false;
	}	
}
