<?php
/*********************************************************      
 程序说明：         
    功能说明：E1参数配置
    调用关系：调用: header.inc     
              被调用:   
    变量说明：
    返回值：无

作者：   
      
修改注释：      
NO.1      
Name:lilong
Date:2004-7-13
Description:prefix length = 16

Date:2004-7-22
Descripton:insert digits = 15
*********************************************************/  
require("../../inc/header.inc");
$DEBUG = 0;
$sysTypeNo_0 = "111";

if($thisOmcType==10){
	$sysTypeNo_1 = "251";
}else{
	$sysTypeNo_1 = "322";
}

$db_0 = "OBJ_".$sysTypeNo_0;
$db_1 = "OBJ_".$sysTypeNo_1;

$tb_0 = "param_0";
$tb_1 = "param_1";
$tb_2 = "param_99";

$temTb = ${tb_.$sNum};
$subSysNo = floor($pNum/8);
if($DEBUG)echo "<br>subSysNo=$subSysNo";
$portNo = $pNum%8;
if($DEBUG)echo "<br>portNo=$portNo";

$wAnd = " AND level_1 = 2 AND level_2 = 1 AND (level_3 = 1 OR level_3 = 2 OR level_3 = 3) "; 

/************get default value**************/
$defSql = " SELECT initValue,level_3 FROM paramConf WHERE keyId > 0 ".$wAnd." ORDER BY level_3 ";
$defRes = @mysqli_query($pubConn,$defSql);
$defRow = @mysqli_fetch_array($defRes);
do
{
	$leve_3 = $defRow[level_3];
	$defaultValue[$leve_3] = $defRow[initValue];
	//echo "<br>defaultValue[$leve_3]=$defaultValue[$leve_3]";
}while($defRow = @mysqli_fetch_array($defRes));


	$prefixFlagArr=array(
			array('num' => '0',  'remark' => 'N', 'color' => '#FF0000'),
			array('num' => '1',  'remark' => 'Y', 'color' => '#0000FF')
	);
	$inTonArr=array(
			array('num' => '0',  'remark' => 'Spare',		'color' => '#FF0000'),
			array('num' => '1',  'remark' => 'SUB',		'color' => '#0000FF'),
			array('num' => '2',  'remark' => 'UNK',		'color' => '#0000FF'),
			array('num' => '3',  'remark' => 'NDD',			'color' => '#0000FF'),
			array('num' => '4',  'remark' => 'IDD',			'color' => '#0000FF'),
			array('num' => '5',  'remark' => 'Spare',		'color' => '#0000FF')
	);

	$outTonArr=array(
			array('num' => '0',  'remark' => 'Spare',		'color' => '#FF0000'),
			array('num' => '1',  'remark' => 'SUB',		'color' => '#0000FF'),
			array('num' => '2',  'remark' => 'UNK',		'color' => '#0000FF'),
			array('num' => '3',  'remark' => 'NDD',			'color' => '#0000FF'),
			array('num' => '4',  'remark' => 'IDD',			'color' => '#0000FF'),
			array('num' => '5',  'remark' => 'Spare',		'color' => '#0000FF')
	);
	
	$trkDelCArr=array(
			array('num' => '0',  'remark' => 'Delete none',		'color' => '#FF0000'),
			array('num' => '1',  'remark' => 'Delete first one','color' => '#FF0000'),
			array('num' => '2',  'remark' => 'Delete first two','color' => '#FF0000'),
			array('num' => '3',  'remark' => 'Delete first three','color' => '#FF0000'),
			array('num' => '4',  'remark' => 'Delete first four','color' => '#FF0000'),
			array('num' => '5',  'remark' => 'Delete first five','color' => '#FF0000'),
			array('num' => '6',  'remark' => 'Delete first six','color' => '#FF0000'),
			array('num' => '7',  'remark' => 'Delete first seven','color' => '#FF0000'),
			array('num' => '8',  'remark' => 'Delete first eight','color' => '#FF0000'),
			array('num' => '9',  'remark' => 'Delete first nine','color' => '#FF0000'),
			array('num' => '10',  'remark' => 'Delete first ten','color' => '#FF0000'),
			array('num' => '11',  'remark' => 'Delete first eleven','color' => '#FF0000'),
			array('num' => '12',  'remark' => 'Delete first twelve','color' => '#FF0000'),
			array('num' => '13',  'remark' => 'Delete first thirteen','color' => '#FF0000'),
			array('num' => '14',  'remark' => 'Delete first fourteen','color' => '#FF0000'),
			array('num' => '15',  'remark' => 'Delete first fifteen','color' => '#FF0000')
		);

	$trkInsCArr=array(
			array('num' => '0',  'remark' => 'Insert none',		'color' => '#FF0000'),
			array('num' => '1',  'remark' => 'Insert first one','color' => '#FF0000'),
			array('num' => '2',  'remark' => 'Insert first two','color' => '#FF0000'),
			array('num' => '3',  'remark' => 'Insert first three','color' => '#FF0000'),
			array('num' => '4',  'remark' => 'Insert first four','color' => '#FF0000'),
			array('num' => '5',  'remark' => 'Insert first five','color' => '#FF0000'),
			array('num' => '6',  'remark' => 'Insert first six','color' => '#FF0000'),
			array('num' => '7',  'remark' => 'Insert first seven','color' => '#FF0000'),
			array('num' => '8',  'remark' => 'Insert first eight','color' => '#FF0000'),
			array('num' => '9',  'remark' => 'Insert first nine','color' => '#FF0000'),
			array('num' => '10',  'remark' => 'Insert first ten','color' => '#FF0000'),
			array('num' => '11',  'remark' => 'Insert first eleven','color' => '#FF0000'),
			array('num' => '12',  'remark' => 'Insert first twelve','color' => '#FF0000'),
			array('num' => '13',  'remark' => 'Insert first thirteen','color' => '#FF0000'),
			array('num' => '14',  'remark' => 'Insert first fourteen','color' => '#FF0000'),
			array('num' => '15',  'remark' => 'Insert first fifteen','color' => '#FF0000')
	);
	
	$cdrFlagArr=array(
			array('num' => '0',  'remark' => 'Off', 'color' => '#FF0000'),
			array('num' => '1',  'remark' => 'On', 'color' => '#0000FF')
	);


	$proTypeArr=array(
			array('num' => '0',  'remark' => 'Trunk',		'color' => '#FF0000'),
			array('num' => '1',  'remark' => 'MSISDN',		'color' => '#0000FF'),
			array('num' => '2',  'remark' => 'MSRN',		'color' => '#0000FF'),
			array('num' => '3',  'remark' => 'MSC',			'color' => '#0000FF')
	);

	$callTypeArr=array(
			array('num' => '0',  'remark' => 'Normal',		'color' => '#0000FF'),
			array('num' => '1',  'remark' => 'Emergency',	'color' => '#0000FF'),
			array('num' => '2',  'remark' => 'MCT',			'color' => '#0000FF'),
			array('num' => '3',  'remark' => 'VMS',			'color' => '#0000FF'),
			array('num' => '4',  'remark' => 'IN',			'color' => '#0000FF')
	);

	$camelFlagArr=array(
			array('num' => '0',  'remark' => 'N', 'color' => '#FF0000'),
			array('num' => '1',  'remark' => 'Y', 'color' => '#0000FF')
	);

	$eDelCArr=array(
			array('num' => '0',  'remark' => 'Delete none',		'color' => '#FF0000'),
			array('num' => '1',  'remark' => 'Delete first one','color' => '#FF0000'),
			array('num' => '2',  'remark' => 'Delete first two','color' => '#FF0000'),
			array('num' => '3',  'remark' => 'Delete first three','color' => '#FF0000'),
			array('num' => '4',  'remark' => 'Delete first four','color' => '#FF0000'),
			array('num' => '5',  'remark' => 'Delete first five','color' => '#FF0000'),
			array('num' => '6',  'remark' => 'Delete first six','color' => '#FF0000'),
			array('num' => '7',  'remark' => 'Delete first seven','color' => '#FF0000'),
			array('num' => '8',  'remark' => 'Delete first eight','color' => '#FF0000')
	);

	$eInsCArr=array(
			array('num' => '0',  'remark' => 'Insert none',		'color' => '#FF0000'),
			array('num' => '1',  'remark' => 'Insert first one','color' => '#FF0000'),
			array('num' => '2',  'remark' => 'Insert first two','color' => '#FF0000'),
			array('num' => '3',  'remark' => 'Insert first three','color' => '#FF0000'),
			array('num' => '4',  'remark' => 'Insert first four','color' => '#FF0000'),
			array('num' => '5',  'remark' => 'Insert first five','color' => '#FF0000'),
			array('num' => '6',  'remark' => 'Insert first six','color' => '#FF0000'),
			array('num' => '7',  'remark' => 'Insert first seven','color' => '#FF0000'),
			array('num' => '8',  'remark' => 'Insert first eight','color' => '#FF0000')
	);

	$cliTypeArr = array(
		array('num' => '0', 'remark' => 'Sub', 'color' => '#0000FF'),
		array('num' => '1', 'remark' => 'NDD', 'color' => '#0000FF'),
		array('num' => '2', 'remark' => 'IDD', 'color' => '#0000FF'),
		array('num' => '3', 'remark' => 'UNK(local)', 'color' => '#0000FF'),
		array('num' => '4', 'remark' => 'UNK(NDD)', 'color' => '#0000FF'),
		array('num' => '5', 'remark' => 'UNK(IDD)', 'color' => '#0000FF')
	);

	$VoicePromptFlagArr = array(
		array('num' => '0', 'remark' => 'disable', 'color' => '#0000FF'),
		array('num' => '1', 'remark' => 'enable', 'color' => '#0000FF')
	);

	$needMNPArr = array(
		array('num' => '0', 'remark' => 'No'),
		array('num' => '1', 'remark' => 'Yes')
	);


if($set || $add)
{	
	$field_0= omc_keep_length($prefixNum,E,16,0);
	if($DEBUG)echo "<br>field_0=$field_0";

	if($add){
		$prefixFlag = 1;
	}
	if($DEBUG)echo "<br>prefixFlag=$prefixFlag";

	$field_1 = DecHex($outTon).DecHex($inTon);
	$field_1 = omc_keep_length($field_1,0,2);
	if($DEBUG)echo "<br>field_1=$field_1";

	$field_2 = DecHex($trkInsC).DecHex($trkDelC);
	$field_2 = omc_keep_length($field_2,0,2);
	if($DEBUG)echo "<br>field_2=$field_2";

	$field_3 = omc_keep_length($trkInsD,E,16,0);	
	if($DEBUG)echo "<br>field_3=$field_3";

	$field_4 = $prefixFlag.omc_keep_length(DecBin($callType),0,3).omc_keep_length(DecBin($proType),0,2)."0".$cdrFlag;
	$field_4 = omc_keep_length(DecHex(BinDec($field_4)),0,2);
	if($DEBUG)echo "<br>field_4=$field_4";

	$field_5 = omc_keep_length(DecHex($dLen),0,2);
	if($DEBUG)echo "<br>field_5=$field_5";
 
	$field_6 = DecHex($eInsC).DecHex($eDelC);
	$field_6 = omc_keep_length($field_6,0,2);
	if($DEBUG)echo "<br>field_6=$field_6";

	$field_7 = omc_keep_length($eInsD,E,8,0);
	if($DEBUG)echo "<br>field_7=$field_7";

	$field_8 = omc_keep_length(DecHex($tgNum),0,2);
	if($DEBUG)echo "<br>field_8=$field_8";

	$field_9 = omc_keep_length(DecHex($cliType),0,2);
	if($DEBUG)echo "<br>field_9=$field_9";

	$field_10 = omc_keep_length(DecHex($VoicePromptFlag),0,2);
	if($DEBUG)echo "<br>field_10=$field_10";

	$field_11 = omc_keep_length(DecHex($needMNP),0,2);
	if($DEBUG)echo "<br>field_11=$field_11";

	$initValue_1 = strtoupper($field_0);
	$initValue_2 = strtoupper($field_1.$field_2.$field_3.$field_4.$field_5.$field_6.$field_7.$field_9.$field_10.$field_11);
	$initValue_3 = strtoupper($field_8);
	if($DEBUG)echo "<br>initValue_1=$initValue_1";
	if($DEBUG)echo "<br>initValue_2=$initValue_2";
	if($DEBUG)echo "<br>initValue_3=$initValue_3";

	$uSql_1 = " UPDATE $tb_2 set initValue = '$initValue_1' WHERE subSysNo = '99' AND instanceNo = '$tNum' AND level_1 = 2 AND level_2 = 1 AND level_3 = 1 "; 
	if($DEBUG)echo "<br>uSql_1=$uSql_1";
	$uRes_1 = @mysqli_query($pubConn,$uSql_1);
	echo mysqli_error($pubConn);

	$uSql_2 = " UPDATE $tb_2 set initValue = '$initValue_2' WHERE subSysNo = '99' AND instanceNo = '$tNum' AND level_1 = 2 AND level_2 = 1 AND level_3 = 2 "; 
	if($DEBUG)echo "<br>uSql_2=$uSql_2";
	$uRes_2 = @mysqli_query($pubConn,$uSql_2);
	echo mysqli_error($pubConn);
	
	$uSql_3 = " UPDATE $tb_2 set initValue = '$initValue_3' WHERE subSysNo = '99' AND instanceNo = '$tNum' AND level_1 = 2 AND level_2 = 1 AND level_3 = 3 "; 
	if($DEBUG)echo "<br>uSql_3=$uSql_3";
	$uRes_3 = @mysqli_query($pubConn,$uSql_3);
	echo mysqli_error($pubConn);

	echo "<script LANGUAGE=\"JavaScript\">";
	echo "window.opener.location.href='./prefixConf.php?scroll_x=$scroll_x&scroll_y=$scroll_y';";		
	echo "\n window.close();";
	echo "\n </script>";
}

/************select value to see************/
//Attributes of TG
if($oType)
	$andSql = " SELECT level_3,instanceNo,initValue,editValue,readValue FROM $tb_2 WHERE subSysNo = '99'".$wAnd." ORDER BY instanceNo ";
else
	$andSql = " SELECT level_3,instanceNo,initValue,editValue,readValue FROM $tb_2 WHERE subSysNo = '99' AND instanceNo = '$tNum' ".$wAnd; 
if($DEBUG) echo "<br>andSql=$andSql<br>db=$db_1";
$andRes = @mysqli_query($pubConn,$andSql);
$andRow = @mysqli_fetch_array($andRes);
echo mysqli_error($pubConn);

do
{
	$level_3 = $andRow[level_3];
	$instanceNo = $andRow[instanceNo];
	$initValue = $andRow[initValue];
	//echo "<br>initValue=$initValue";
	
	if($initValue == $defaultValue[$level_3]){
		$andShow[$level_3][$instanceNo] = 0;
	}else{
		$andShow[$level_3][$instanceNo] = 1;
	}
	//echo "<br>andShow[$level_3][$instanceNo]={$andShow[$level_3][$instanceNo]}";
	
	if($level_3 == 1){
		$prefixNum = $initValue;
		$pNum = explode("E",$prefixNum);
		$prefixNum = $prefixArr[$instanceNo][1] = $pNum[0];
		//echo "<br>prefixArr[$instanceNo][1]={$prefixArr[$instanceNo][1]}";
	}elseif($level_3 == 2){
		$DEBUG = 0;
		$hex_0 = substr($initValue,0,2);
		if($DEBUG)echo "<br>hex_0=$hex_0";
		$bin_0 = omc_keep_length(DecBin(HexDec($hex_0)),0,8);
		if($DEBUG)echo "<br>bin_0=$bin_0";
		
		$inTon = $prefixArr[$instanceNo][2] = BinDec(substr($bin_0,4,4));
		//echo "<br>inTon=$inTon";
		
		$outTon = $prefixArr[$instanceNo][3] = BinDec(substr($bin_0,0,4));
		//echo "<br>outTon=$outTon";
		
		$hex_1 = substr($initValue,2,2);
		if($DEBUG)echo "<br>hex_1=$hex_1";
		$bin_1 = omc_keep_length(DecBin(HexDec($hex_1)),0,8);
		if($DEBUG)echo "<br>bin_1=$bin_1";
		
		$trkDelC = $prefixArr[$instanceNo][4] = BinDec(substr($bin_1,4,4));
		if($DEBUG)echo "<br>trkDelC=$trkDelC";
		
		$trkInsC = $prefixArr[$instanceNo][5] = BinDec(substr($bin_1,0,4));
		if($DEBUG)echo "<br>trkInsC=$trkInsC";
		
		$trkInsD  = substr($initValue,4,16);
		$pTrk = explode("E",$trkInsD);
		$trkInsD = $prefixArr[$instanceNo][6] = $pTrk[0];
		if($DEBUG)echo "<br>trkInsD=$trkInsD";

		$hex_6 = substr($initValue,20,2);
		if($DEBUG)echo "<br>hex_6=$hex_6";
		$bin_6 = omc_keep_length(DecBin(HexDec($hex_6)),0,8);
		if($DEBUG)echo "<br>bin_6=$bin_6";
		
		$cdrFlag = $prefixArr[$instanceNo][7] = BinDec(substr($bin_6,7,1));
		if($DEBUG)echo "<br>cdrFlag=$cdrFlag";
		
		$proType = $prefixArr[$instanceNo][8] = BinDec(substr($bin_6,4,2));
		if($DEBUG)echo "<br>proType=$proType";

		$callType = $prefixArr[$instanceNo][9] = BinDec(substr($bin_6,1,3));
		if($DEBUG)echo "<br>callType=$callType";

		$prefixFlag = $prefixArr[$instanceNo][0] = BinDec(substr($bin_6,0,1));
		if($DEBUG)echo "<br>prefixFlag=$prefixFlag";

		$dLen = $prefixArr[$instanceNo][10] = HexDec(substr($initValue,22,2));
		if($DEBUG)echo "<br>dLen=$dLen";

		$hex_8 = substr($initValue,24,2);
		if($DEBUG)echo "<br>hex_8=$hex_8";
		$bin_8 = omc_keep_length(DecBin(HexDec($hex_8)),0,8);
		if($DEBUG)echo "<br>bin_8=$bin_8";
		
		$eDelC = $prefixArr[$instanceNo][11] = BinDec(substr($bin_8,4,4));
		if($DEBUG)echo "<br>eDelC=$eDelC";
		
		$eInsC = $prefixArr[$instanceNo][12] = BinDec(substr($bin_8,0,4));
		if($DEBUG)echo "<br>eInsC=$eInsC";

		$eInsD  = substr($initValue,26,8);
		$pTrk = explode("E",$eInsD);
		$eInsD = $prefixArr[$instanceNo][13] = $pTrk[0];
		if($DEBUG)echo "<br>eInsD=$eInsD";

		$cliType	= substr($initValue,34,2);
		if($DEBUG)	echo "cliType = $cliType<br>";

		$VoicePromptFlag	= hexdec(substr($initValue,36,2));
		if($DEBUG)	echo "VoicePromptFlag = $VoicePromptFlag<br>";

		$needMNP	= hexdec(substr($initValue,38,2));
		if($DEBUG)	echo "needMNP = $needMNP<br>";
	}else{
		$tgNum = $prefixArr[$instanceNo][14] = HexDec($initValue);
		//echo "<br>prefixArr[$instanceNo][14]={$prefixArr[$instanceNo][14]}";
	}
}while($andRow = @mysqli_fetch_array($andRes));

echo "<form method=\"POST\" name=\"confForm\" action=\"$PHP_SELF\">";
echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\" width=\"100%\">";

if($oType){
	/*
	$preFlagSql = " SELECT instanceNo,initValue,editValue,readValue FROM $tb_2 WHERE subSysNo = '99' AND level_1 = 2 AND level_2 = 1 AND  level_3 = 2 "." ORDER BY instanceNo "; 
	if($DEBUG)echo "<br>preFlagSql=$preFlagSql";
	$preFlagRes = @mysqli_query($pubConn,$preFlagSql);
	$preFlagRow = @mysqli_fetch_array($preFlagRes);
	echo mysqli_error($pubConn);
	do
	{
		$instanceNo = $preFlagRow[instanceNo];
		$initValue = $preFlagRow[initValue];
		if($DEBUG)echo "<br>initValue=$initValue";

		$hex_6 = substr($initValue,12,2);
		if($DEBUG)echo "<br>hex_6=$hex_6";
		$bin_6 = omc_keep_length(DecBin(HexDec($hex_6)),0,8);
		if($DEBUG)echo "<br>bin_6=$bin_6";

		$prefixFlag = $prefixFlagArr[$instanceNo][0] = BinDec(substr($bin_6,1,1));
		//echo "<br>prefixFlag=$prefixFlag";
	}while($preFlagRow = @mysqli_fetch_array($preFlagRes));
	*/
	
	echo "<tr>";
	echo "<td colspan=\"4\"><b>Add Dailing prefix</b></td>";
	echo "</tr>";

	/*
	echo "<tr>";
	echo "<td width=\"60\" valign=middle><nobr>Prefix no.</nobr></td>";
	echo "<td colspan=\"2\">";
	echo "<select style=\"font-family: Verdana; font-size: 8pt\" size=\"1\" name=\"tNum\" id=\"tNum\">";
	for($i=0;$i<256;$i++)
	{
		if(!$prefixArr[$i][0])
			echo "<option value=\"$i\">$i</option>";
	}
	echo "</select>";
	echo "</td>";
	echo "</tr>";
*/

	echo "<tr>";
	echo "<td width=\"60\" valign=middle><nobr>Prefix no.</nobr></td>";
	echo "<td colspan=\"2\">";
	echo "<select style=\"font-family: Verdana; font-size: 8pt\" size=\"1\" name=\"tNum\" id=\"tNum\">";
	for($i=0;$i<256;$i++)
	{
		if($andShow[1][$i]==0&&$andShow[2][$i]==0&&$andShow[3][$i]==0)
			echo "<option value=\"$i\">$i</option>";
	}
	echo "</select>";
	echo "</td>";
	echo "</tr>";

}else{
	echo "<tr>";
	echo "<td colspan=\"4\"><b>Dailing prefix $tNum</b></td>";
	echo "</tr>";
}
echo "<tr>";
echo "<td width=\"60\" valign=middle><nobr>Flag</nobr></td>";
if($prefixFlag){
	echo "<td width=\"30\" colspan=\"2\"><nobr><input type=\"radio\" value=\"1\" name=\"prefixFlag\" checked>Yes";
	echo "<input type=\"radio\" name=\"prefixFlag\" value=\"0\">No&nbsp;</nobr></td>";
}else{
	echo "<td width=\"30\" colspan=\"2\"><nobr><input type=\"radio\" value=\"1\" name=\"prefixFlag\">Yes";
	echo "<input type=\"radio\" name=\"prefixFlag\" value=\"0\" checked>No&nbsp;</nobr></td>";
}
echo "</tr>";


echo "<tr>";
echo "<td width=\"60\" valign=middle><nobr>Prefix</nobr></td>";
echo "<td colspan=\"2\"><input type=\"text\" name=\"prefixNum\" size=\"16\" value=\"$prefixNum\" maxLength=\"16\"></td>";
echo "</tr>";


echo "<tr>";
echo "<td width=\"60\" valign=middle><nobr>TON incoming call</nobr></td>";
echo "<td colspan=\"2\">";
echo "<select style=\"font-family: Verdana; font-size: 8pt\" size=\"1\" name=\"inTon\" id=\"inTon\">";
for($i=0;$i<6;$i++)
{
	if($inTon == $i)
		echo "<option value=\"$i\" selected>{$inTonArr[$i][remark]}</option>";
	else
		echo "<option value=\"$i\">{$inTonArr[$i][remark]}</option>";
}
echo "</select>";
echo "</td>";
echo "</tr>";

echo "<tr>";
echo "<td width=\"60\" valign=middle><nobr>TON outgoing call</nobr></td>";
echo "<td colspan=\"2\">";
echo "<select style=\"font-family: Verdana; font-size: 8pt\" size=\"1\" name=\"outTon\" id=\"outTon\">";
for($i=0;$i<6;$i++)
{
	if($outTon == $i)
		echo "<option value=\"$i\" selected>{$outTonArr[$i][remark]}</option>";
	else
		echo "<option value=\"$i\">{$outTonArr[$i][remark]}</option>";
}
echo "</select>";
echo "</td>";
echo "</tr>";


echo "<tr>";
echo "<td width=\"60\" valign=middle><nobr>Out trunk deletion count</nobr></td>";
echo "<td colspan=\"2\">";
echo "<select style=\"font-family: Verdana; font-size: 8pt\" size=\"1\" name=\"trkDelC\" id=\"trkDelC\">";
for($i=0;$i<16;$i++)
{
	if($trkDelC == $i)
		echo "<option value=\"$i\" selected>{$trkDelCArr[$i][remark]}</option>";
	else
		echo "<option value=\"$i\">{$trkDelCArr[$i][remark]}</option>";
}
echo "</select>";
echo "</td>";
echo "</tr>";

echo "<tr>";
echo "<td width=\"60\" valign=middle><nobr>Out trunk insertion count</nobr></td>";
echo "<td colspan=\"2\">";
echo "<select style=\"font-family: Verdana; font-size: 8pt\" size=\"1\" name=\"trkInsC\" id=\"trkInsC\">";
for($i=0;$i<16;$i++)
{
	if($trkInsC == $i)
		echo "<option value=\"$i\" selected>{$trkInsCArr[$i][remark]}</option>";
	else
		echo "<option value=\"$i\">{$trkInsCArr[$i][remark]}</option>";
}
echo "</select>";
echo "</td>";
echo "</tr>";


echo "<tr>";
echo "<td width=\"60\" valign=middle><nobr>Out trunk inserted digits</nobr></td>";
echo "<td colspan=\"2\"><input type=\"text\" name=\"trkInsD\" size=\"15\" value=\"$trkInsD\" maxLength=\"15\"></td>";
echo "</tr>";


echo "<tr>";
echo "<td width=\"60\" valign=middle><nobr>CDR</nobr></td>";
if($cdrFlag){
	echo "<td width=\"30\"><nobr><input type=\"radio\" value=\"1\" name=\"cdrFlag\" checked>On&nbsp;";
	echo "<input type=\"radio\" name=\"cdrFlag\" value=\"0\">Off</nobr></td>";
}else{
	echo "<td width=\"30\"><nobr><input type=\"radio\" value=\"1\" name=\"cdrFlag\">On&nbsp;";
	echo "<input type=\"radio\" name=\"cdrFlag\" value=\"0\" checked>Off</nobr></td>";
}
echo "</tr>";

echo "<tr>";
echo "<td width=\"60\" valign=middle><nobr>Properties</nobr></td>";
echo "<td colspan=\"2\">";
echo "<select style=\"font-family: Verdana; font-size: 8pt\" size=\"1\" name=\"proType\" id=\"proType\">";
for($i=0;$i<4;$i++)
{
	if($proType == $i)
		echo "<option value=\"$i\" selected>{$proTypeArr[$i][remark]}</option>";
	else
		echo "<option value=\"$i\">{$proTypeArr[$i][remark]}</option>";
}
echo "</select>";
echo "</td>";
echo "</tr>";

echo "<tr>";
echo "<td width=\"60\" valign=middle><nobr>Call type</nobr></td>";
echo "<td colspan=\"2\">";
echo "<select style=\"font-family: Verdana; font-size: 8pt\" size=\"1\" name=\"callType\" id=\"callType\">";
for($i=0;$i<sizeof($callTypeArr);$i++)
{
	if($callType == $i)
		echo "<option value=\"$i\" selected>{$callTypeArr[$i][remark]}</option>";
	else
		echo "<option value=\"$i\">{$callTypeArr[$i][remark]}</option>";
}
echo "</select>";
echo "</td>";
echo "</tr>";

echo "<tr>";
echo "<td width=\"60\" valign=middle><nobr>Length of dialed number</nobr></td>";
echo "<td colspan=\"2\"><input type=\"text\" name=\"dLen\" size=\"6\" value=\"$dLen\" maxLength=\"6\"></td>";
echo "</tr>";

echo "<tr>";
echo "<td width=\"60\" valign=middle><nobr>E.164 international deletion count</nobr></td>";
echo "<td colspan=\"2\">";
echo "<select style=\"font-family: Verdana; font-size: 8pt\" size=\"1\" name=\"eDelC\" id=\"eDelC\">";
for($i=0;$i<9;$i++)
{
	if($eDelC == $i)
		echo "<option value=\"$i\" selected>{$eDelCArr[$i][remark]}</option>";
	else
		echo "<option value=\"$i\">{$eDelCArr[$i][remark]}</option>";
}
echo "</select>";
echo "</td>";
echo "</tr>";

echo "<tr>";
echo "<td width=\"60\" valign=middle><nobr>E.164 international insertion count</nobr></td>";
echo "<td colspan=\"2\">";
echo "<select style=\"font-family: Verdana; font-size: 8pt\" size=\"1\" name=\"eInsC\" id=\"eInsC\">";
for($i=0;$i<9;$i++)
{
	if($eInsC == $i)
		echo "<option value=\"$i\" selected>{$eInsCArr[$i][remark]}</option>";
	else
		echo "<option value=\"$i\">{$trkInsCArr[$i][remark]}</option>";
}
echo "</select>";
echo "</td>";
echo "</tr>";

echo "<tr>";
echo "<td width=\"60\" valign=middle><nobr>E.164 international inserted digits</nobr></td>";
echo "<td colspan=\"2\"><input type=\"text\" name=\"eInsD\" size=\"8\" value=\"$eInsD\" maxLength=\"8\"></td>";
echo "</tr>";
 
echo "<tr>";
echo "<td width=\"60\" valign=middle><nobr>Trunk group</nobr></td>";
echo "<td colspan=\"2\"><input type=\"text\" name=\"tgNum\" size=\"6\" value=\"$tgNum\" maxLength=\"6\"></td>";
echo "</tr>";

echo "<tr>";
echo "<td width=\"60\" valign=middle><nobr>Cli-type </nobr></td>";
echo "<td colspan=\"2\">";
echo "<select style=\"font-family: Verdana; font-size: 8pt\" size=\"1\" name=\"cliType\" id=\"cliType\">";
for($i=0;$i<6;$i++){
	if($cliType == $i)
		echo "<option value=\"$i\" selected>{$cliTypeArr[$i][remark]}</option>";
	else
		echo "<option value=\"$i\">{$cliTypeArr[$i][remark]}</option>";
}
echo "</select>";
echo "</td>";
echo "</tr>";

echo "<tr>";
echo "<td width=\"60\" valign=middle><nobr>Voice Prompt Flag</nobr></td>";
if($VoicePromptFlag){
	echo "<td width=\"30\" colspan=\"2\"><nobr><input type=\"radio\" value=\"1\" name=\"VoicePromptFlag\" checked>Yes";
	echo "<input type=\"radio\" name=\"VoicePromptFlag\" value=\"0\">No&nbsp;</nobr></td>";
}else{
	echo "<td width=\"30\" colspan=\"2\"><nobr><input type=\"radio\" value=\"1\" name=\"VoicePromptFlag\">Yes";
	echo "<input type=\"radio\" name=\"VoicePromptFlag\" value=\"0\" checked>No&nbsp;</nobr></td>";
}
echo "</tr>";

echo "<tr>";
echo "<td width=\"60\" valign=middle><nobr>Need MNP</nobr></td>";
if($needMNP){
	echo "<td width=\"30\" colspan=\"2\"><nobr><input type=\"radio\" value=\"1\" name=\"needMNP\" checked>Yes";
	echo "<input type=\"radio\" name=\"needMNP\" value=\"0\">No&nbsp;</nobr></td>";
}else{
	echo "<td width=\"30\" colspan=\"2\"><nobr><input type=\"radio\" value=\"1\" name=\"needMNP\">Yes";
	echo "<input type=\"radio\" name=\"needMNP\" value=\"0\" checked>No&nbsp;</nobr></td>";
}
echo "</tr>";

echo "</table>";
//echo "<br><u><b>Remark:</b></u>";
echo "<br>";
if($oType){
	echo "<input type=\"submit\" name=\"add\" value = \"Add\">"; 
}else{
	echo "<input type=\"submit\" name=\"set\" value = \"Set\">"; 
	echo "<input type=\"hidden\" name=\"tNum\" value =\"$tNum\">";
}
echo "<input type=\"reset\" name=\"Reset\" value =\"Reset\">";
echo "<input type=\"hidden\" name=\"scroll_x\" value =\"$scroll_x\">";
echo "<input type=\"hidden\" name=\"scroll_y\" value =\"$scroll_y\">";

echo "</form>";
?>
  <b>Remarks:</b><br><br>
Prefix number: It appears when add a new prefix, ranging from 0 to 255<br><br>
Flag: Y=prefix enable, N=prefix disable<br><br>
TON incoming call (In-TON): Type of number for incoming call, include unknown, MSISDN, NDD and IDD. It is specified by originating node for terminating node to route this call with proper dialed number manipulation. 
For system subscriber dialed prefix, always use unknown for In-TON except the prefix of international prefix beginning with a "+". For this kind of prefix (such as +86755832) we should set the In-TON as IDD to support "+" dialing<br><br>
TON outgoing call (Out-TON): Type of number for outgoing call, include unknown, MSISDN, NDD and IDD. It specifies the type of an outgoing call for terminating node to route this call with proper dialed number manipulation. Generally the MSC uses IDD for outgoing call<br><br>
Out trunk deletion count (T-D-C): Quantity of deleted digit of a dialed number beginning with this prefix. It ranges from 0 to 8. 0=no deletion, 1-8=delete first 1-8 digits<br><br>
Out trunk insertion count (T-I-C): Quantity of inserted digit for a dialed number beginning with this prefix. It ranges from 0 to 8. 0=no insertion, 1-8=insert 1-8 digits from the beginning of this number<br><br>
Out trunk inserted digits (T-I-D): 8 digits ranging from EEEEEEEE to 99999999, E=any decimal number<br><br>
CDR: Turn on/off the CDR of dialed numbers beginning with this prefix<br><br>
Properties: Specify the properties of a prefix. Trunk=to PSTN, MSISDN=to A interface, MSRN=MS roaming number, MSC=to peer MSC<br><br>
Call type: Normal=no verification for MT, Emergency call=no verification for MO (free call), Intelligent peripheral=MT verification via PPS, VMS call=send signaling carried DTMF to VMS<br><br>
Length of dialed number (Digit-L): Length of dialed number (1-32)<br><br>
E.164 international deletion count (E-D-C): Quantity of deleted digit of E164 international number<br><br>
E.164 international insertion count (E-I-C): Quantity of inserted digit of E164 international number<br><br>
E.164 international inserted digits (E-I-D): Inserted digit to the E164 international number, 8 digits ranging from EEEEEEEE to 99999999, E=any decimal number, MSISDN is used to Locate serving HLR, it also specify the country code of called which is necessary to identify IDD call<br><br>
Trunk group (TG): Assign a trunk group for this prefix. Support assigning a single trunk group to multiple prefixes<br><br>
CLI: Calling line identity
Specify the CLI type for opposite node to perform CLIP or CLIR function. This CLI type should be same as the prefix type. e.g. If a prefix is for NDD call, its CLI type should be NDD 
<br>
</body>
</html>