<?php 
/*********************************************************      
AAS  configuration.

*********************************************************/

require("../sub_inc/commfunc.php");
$helpId = "1.1.1";
$DEBUG = 0;

//==========================================================
//变量定义
//==========================================================
if(!isset($slctLanguage))
	$slctLanguage=0;
$pubDb	 = 'OMC_PUB';
$backurl_un = "$PHP_SELF?trunkgp=$trunkgp&infoNo=$infoNo&linkset=$linkset&slctLanguage=$slctLanguage&scroll_y=100";
$backurl = urlencode($backurl_un);

//Spname
{
	$tmpobj		= 'OBJ_222';
	$tmpparam = 'param_99';
	$tmpoid = '2.4.1';
	$objWhereStr = getLevelWhere($tmpoid);
	$paramSql = " SELECT initValue,readValue,instanceNo FROM $tmpparam  
				WHERE subSysNo = '99' AND  $objWhereStr AND instanceNo ='$linkset' 
				";
	
	$Result  = mysqli_query($pubConn,$paramSql);				
	$Row	 = mysqli_fetch_array($Result);
	$TypeIn	 = getBitValue($Row[initValue],'4.0-4.7');
	$TypeIn  = hexdec($TypeIn);
	$this_sysNo	 = getBitValue($Row[initValue],'5.0-5.3');
	$this_sysNo  = bindec($this_sysNo);
	if($DEBUG) echo "TypeIn = $TypeIn";
	$Spname = "AAS";
	if($TypeIn !=2)
	{
		$Spname = "Undefined AAS";
	}
	$webname = $Spname;
	$Spname = $Spname."-$this_sysNo";
}

$NetIdConfArr=array('International','International-S','National','National-S');

?>

<script LANGUAGE="JavaScript"> 	
function getLinkSta()
{
	var this_sysNo=<?php echo $this_sysNo;  ?>;
	var ulr="getAASLinkSta.php?subSysNo="+this_sysNo;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer")
	{
		request_o = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		request_o = new XMLHttpRequest();
	}
	//alert(request_o);
	
	//alert(ulr);
	request_o.open("GET",ulr,"false");

	request_o.onreadystatechange = updateLinkSta; 

	request_o.send(null);
}

function updateLinkSta()
{	
	if(request_o.readyState == 4)
	{
		var strResult = request_o.responseText;
		var arrResult = strResult.split("###");
		var link0_st = arrResult[0];
		var link1_st = arrResult[1];	
		
		var linkStaArr = new Array("N","Y","--");
		document.setForm.link0_state.value = linkStaArr[link0_st];
		document.setForm.link1_state.value = linkStaArr[link1_st];
		//alert(strResult);

		if(link0_st==1)
			document.setForm.link0_state.style.color="#0000ff";
		else if(link0_st==2)
			document.setForm.link0_state.style.color="#000000";
		else
			document.setForm.link0_state.style.color="#ff0000";
		
		if(link1_st==1)
			document.setForm.link1_state.style.color="#0000ff";
		else if(link1_st==2)
			document.setForm.link1_state.style.color="#000000";
		else
			document.setForm.link1_state.style.color="#ff0000";
	}
}

function OnSetTimer()
{
	timer = window.setInterval("getLinkSta()",10000);
}

function selectLanguge()
{
	var base_url,url_add,url; 
	y = document.body.scrollTop;
	base_url='<?php echo"$PHP_SELF?trunkgp=$trunkgp&infoNo=$infoNo&linkset=$linkset&slctLanguage=";?>';
	url_add=document.setForm.slctLanguage.options[document.setForm.slctLanguage.selectedIndex].value;
	url=base_url+url_add+'&scroll_y='+y;
	window.location.href=url; 
}

</script>


<?php
$scroll_y = isset($scroll_y) ? $scroll_y : 0;
echo "<body topmargin=\"0\" onLoad=\"OnSetTimer();self.scrollBy(0,$scroll_y);\" leftmargin=\"12\">";

{//parameter define
	$objDB = "OBJ_311";
	$paramTable = 'param_'.$this_sysNo;
	
	$sysId = "311_".$this_sysNo."_0";
	$sccp_sysId = "223_11_".$this_sysNo;
	$iptrans_sysId = "221_11_".$this_sysNo;
	$aasMtp3_sysId = "222_11_".$this_sysNo;
	
	$ppsOid = '2.1.2.1.'.($this_sysNo+1);
	
	$oidsysarr0=array(
		array('oid'=>'2.1.3',		'sysid'=> $sysId,		'selectsysid'=>'-1'), //Point code										
		array('oid'=>'2.1.4',		'sysid'=> $sysId,		'selectsysid'=>'-1'), //Country Code									
		array('oid'=>'2.1.5',		'sysid'=> $sysId,		'selectsysid'=>'-1'), //NDC
		array('oid'=>'2.1.8',		'sysid'=> $sysId,		'selectsysid'=>'-1'), //CIC									
		array('oid'=>'2.1.9',		'sysid'=> $sysId,		'selectsysid'=>'-1'), //Link type									
		array('oid'=>'2.1.10',		'sysid'=> $sysId,		'selectsysid'=>'-1'), //Encode rule										
		array('oid'=>'2.3.1',		'sysid'=> $sysId,		'selectsysid'=>'-1'), //VAS prefix									
		array('oid'=>'2.3.2',		'sysid'=> $sysId,		'selectsysid'=>'-1'), //play times	
		array('oid'=>'2.3.3',		'sysid'=> $sysId,		'selectsysid'=>'-1'), //voice groups						
		
		array('oid'=>'2.1',			'sysid'=> $iptrans_sysId,	'selectsysid'=>'-1'), //MGIP arwean add 2006-03-02
	);
	$oidsysarr=array(
		array('oid'=>'2.2',			'sysid'=>'222_99_99',	'selectsysid'=>'-1'),
		array('oid'=>'2.4.1',		'sysid'=>'222_99_99',	'selectsysid'=>'-1'),
		array('oid'=>'2.3',			'sysid'=>'222_99_99',	'selectsysid'=>'-1'),	//获得wxc2 dpc
		 
		array('oid'=>'2.1.147',		'sysid'=>'223_99_99',	'selectsysid'=>'-1'), //SCF
		array('oid'=>'2.2',			'sysid'=>'223_99_99',	'selectsysid'=>'-1'), //srf msisdn
		array('oid'=> $ppsOid,		'sysid'=>'360_99_99',	'selectsysid'=>'-1'),//pps
		
		array('oid'=>'2.1.1',		'sysid'=>'322_99_99',	'selectsysid'=>'-1'), //Prefix assignment
		array('oid'=>'2.1.2',		'sysid'=>'322_99_99',	'selectsysid'=>'-1'), //Prefix attributes
		array('oid'=>'2.1.3',		'sysid'=>'322_99_99',	'selectsysid'=>'-1'), //Assign TG to prefix
		array('oid'=>'2.1.4',		'sysid'=>'322_99_99',	'selectsysid'=>'-1'), //TG attributes
		array('oid'=>'2.1.6',		'sysid'=>'322_99_99',	'selectsysid'=>'-1')  //Announcement option
	);
	
	$oidAASarr=array(
		array('oid'=>'2.2',			'sysid'=>'222_11_99',	'selectsysid'=> $aasMtp3_sysId), 	
		array('oid'=>'2.3',			'sysid'=>'222_11_99',	'selectsysid'=> $aasMtp3_sysId), //aas dpc		
		array('oid'=>'2.4.1',		'sysid'=>'222_11_99',	'selectsysid'=> $aasMtp3_sysId), //aas linkset			
		array('oid'=>'2.6',			'sysid'=>'222_11_99',	'selectsysid'=> $aasMtp3_sysId), //aas route	
		array('oid'=>'3.1',			'sysid'=>'222_11_99',	'selectsysid'=> $aasMtp3_sysId), //aas link status
						
		array('oid'=>'2.1.8',		'sysid'=>'223_11_99',	'selectsysid'=> $sccp_sysId), //MSC
		array('oid'=>'2.2',			'sysid'=>'223_11_99',	'selectsysid'=> '-1'),  //GTT Table pub
		array('oid'=>'2.2',			'sysid'=>'223_11_99',	'selectsysid'=> $sccp_sysId)  //GTT Table
		
	);
	
	$SaveArr=array(
		array('oidstr'=>'3.1',	'setvalue'=>'00'	,'sysid'=> $sysId,		'selectsysid'=>'-1'),
		array('oidstr'=>'3.7',	'setvalue'=>'02'	,'sysid'=>'222_11_99',	'selectsysid'=> $aasMtp3_sysId),
		array('oidstr'=>'3.2',	'setvalue'=>'02'	,'sysid'=>'223_11_99',	'selectsysid'=> $sccp_sysId),
		array('oidstr'=>'3.2',	'setvalue'=>'B5'	,'sysid'=>'322_99_99',	'selectsysid'=>'-1'),
//		array('oidstr'=>'3.1',	'setvalue'=>'01'	,'sysid'=> $iptrans_sysId,	'selectsysid'=>'-1'),//arwean add 2006-03-02 
	);

}//END parameter define

if($_SERVER['REQUEST_METHOD'] == "POST")
{	
	//保存改动		
	if(isset($CC_save)||isset($setSys))
	{
		$tmp = "CC";		
		$tmp = ${$tmp};
		$tmp = omc_keep_length($tmp,'F',4,0);
		$tmp = strtoupper($tmp);
		$oidstr = "2.1.4";
		$objWhereStr = getLevelWhere($oidstr);
		$updflag = "UPDATE $paramTable SET initValue = '$tmp' 
	        			WHERE $objWhereStr
	        			";

		mysqli_query($pubConn,$updflag);
		echo mysqli_error($pubConn);
		if(isset($CC_save)){
		echo "<script LANGUAGE=\"JavaScript\">";
		echo "\n window.location.href=\"$backurl_un\";";
		echo "\n </script>";
		exit();
		}
	}
	if(isset($NDC_save)||isset($setSys))
	{
		$tmp = "NDC";
		$tmp = ${$tmp};
		$tmp = omc_keep_length($tmp,'F',4,0);
		$tmp = strtoupper($tmp);
		$oidstr = "2.1.5";
		$objWhereStr = getLevelWhere($oidstr);
		$updflag = "UPDATE $paramTable SET initValue = '$tmp' 
	        			WHERE $objWhereStr
	        			";								
	  if($DEBUG) echo "$updflag<br>";
		mysqli_query($pubConn,$updflag);
		echo mysqli_error($pubConn);
		if(isset($NDC_save)){
		echo "<script LANGUAGE=\"JavaScript\">";
		echo "\n window.location.href=\"$backurl_un\";";
		echo "\n </script>";
		exit();		
		}
	}
	if(isset($time_save)||isset($setSys))
	{
		$tmp = "playtimes";
		$tmp = ${$tmp};
		$tmp = dechex($tmp);
		$tmp = omc_keep_length($tmp,'0',2);
		$tmp = strtoupper($tmp);
		$oidstr = "2.3.2";
		$objWhereStr = getLevelWhere($oidstr);
		$updflag = "UPDATE $paramTable SET initValue = '$tmp' 
	        			WHERE $objWhereStr
	        			";								
	  if($DEBUG) echo "$updflag<br>";
		mysqli_query($pubConn,$updflag);
		echo mysqli_error($pubConn);					
		if(isset($time_save)){
		echo "<script LANGUAGE=\"JavaScript\">";
		echo "\n window.location.href=\"$backurl_un\";";
		echo "\n </script>";
		exit();		
		}
	}
	if(isset($MSISDN_save)||isset($setSys))
	{
		{//set param_11 sccp 2.1.8
			$getSysIdSql = "SELECT sysNo,subSysNo,ip FROM sysInfo
						WHERE sysTypeNo='311' AND sysNo='0' AND subSysNo='0'
					";		
			$getSysIdResult= mysqli_query($pubConn,$getSysIdSql);
			$getSysIdRow=mysqli_fetch_array($getSysIdResult);
	//echo "<br>getSysIdRow[ip]:$getSysIdRow[ip]";
			$IP	= explode('.',$getSysIdRow[ip]);	
			$IP[0] = omc_keep_length(dechex($IP[0]),"0","2");
			$IP[1] = omc_keep_length(dechex($IP[1]),"0","2");
			$IP[2] = omc_keep_length(dechex($IP[2]),"0","2");
			$IP[3] = omc_keep_length(dechex($IP[3]),"0","2");
			$AAS0_ip = $IP[0].$IP[1].$IP[2].$IP[3];		
			
			$getSysIdSql = "SELECT sysNo,subSysNo,ip FROM sysInfo
						WHERE sysTypeNo='311' AND sysNo='1' AND subSysNo='0'
					";
			$getSysIdResult= mysqli_query($pubConn,$getSysIdSql);
			$getSysIdRow=mysqli_fetch_array($getSysIdResult);
	
			$IP	= explode('.',$getSysIdRow[ip]);	
			$IP[0] = omc_keep_length(dechex($IP[0]),"0","2");
			$IP[1] = omc_keep_length(dechex($IP[1]),"0","2");
			$IP[2] = omc_keep_length(dechex($IP[2]),"0","2");
			$IP[3] = omc_keep_length(dechex($IP[3]),"0","2");
			$AAS1_ip = $IP[0].$IP[1].$IP[2].$IP[3];		
		
			$sccp_objDB = 'OBJ_223';
			$tmpTable = 'param_11';
			$oidstr = '2.1.8';		
	
			$objWhereStr = getLevelWhere($oidstr);				
			$tmp = omc_keep_length($MSISDN,'F',20,0);		
			$MSISDN_total = setBitValue($MSISDN_total,'01.0-10.7',$tmp);			
			$tmp = omc_keep_length($NetID,'0',2);
			$MSISDN_total = setBitValue($MSISDN_total,'0.0-0.7',$tmp);
			$MSISDN_total = setBitValue($MSISDN_total,'11.0-14.7',$AAS0_ip);		
			$MSISDN_total = setBitValue($MSISDN_total,'15.0-18.7',$AAS1_ip);								
			
			$MSISDN_total = strtoupper($MSISDN_total);
			
			$updflag = "UPDATE $tmpTable SET initValue = '$MSISDN_total' 
		        			WHERE $objWhereStr
		        			";								
		  	if($DEBUG) echo "$updflag<br>";
			mysqli_query($pubConn,$updflag);
			echo mysqli_error($pubConn);					
		}
		if(isset($MSISDN_save))//set pps SRF MSISDN
		{
			$sqltable = 'OBJ_360.param_99';
			$oid = '2.1.2.1.'.($this_sysNo+1);
			$initValue_0 = omc_keep_length(toHex($MSISDN),'0','32',0);
			$objWhereStr = getLevelWhere($oid);
			$setsql = "update $sqltable set initValue = '$initValue_0' where $objWhereStr";
			mysqli_query($pubConn,$setsql);
			echo mysqli_error($pubConn);
			if($DEBUG) echo "<br>$setsql<br>";	
		}
		if(isset($MSISDN_save))//set Dailing prefix
		{
			$msc_objDb = 'OBJ_322';
			$msc_paramTable = 'param_99';
			$AAS_prefix = omc_keep_length($MSISDN_old,'E',16,0);
			
			$objstrset='2.1.1';
			$objWhereStr =getLevelWhere($objstrset);				
			$paramSql = " SELECT initValue,readValue,instanceNo FROM $msc_paramTable  
			WHERE $objWhereStr AND initValue = '$AAS_prefix' ";
			if($DEBUG) echo "paramSql=$paramSql<br>";
			$Result = mysqli_query($pubConn,$paramSql);				
			$objstrset='2.1.2';
			$objWhereStr =getLevelWhere($objstrset);
			$findflag=0;
			while($Row	= mysqli_fetch_array($Result))
			{
				$paramSql = " SELECT initValue,readValue,instanceNo FROM $msc_paramTable  
				WHERE $objWhereStr AND instanceNo = '$Row[instanceNo]'	";
				if($DEBUG) echo "paramSql=$paramSql<br>";
				$Result_2 = mysqli_query($pubConn,$paramSql);				
				$Row_2		= mysqli_fetch_array($Result_2);
				$prefixflag=bindec(getBitValue($Row_2[initValue],'10.7-10.7'));
				$calltype  =bindec(getBitValue($Row_2[initValue],'10.4-10.6'));
				if($prefixflag==1&&$calltype==3)//type = vms
				{
					$Assign_objstrset='2.1.3';
					$Assign_objWhereStr =getLevelWhere($Assign_objstrset);				
					$paramSql = " SELECT initValue,readValue,instanceNo FROM $msc_paramTable  
											WHERE $Assign_objWhereStr AND instanceNo ='$Row_2[instanceNo]'
											";
											
					$Assign_Result = mysqli_query($pubConn,$paramSql);				
					$Assign_Row	= mysqli_fetch_array($Assign_Result);
					$prefixTG = hexdec($Assign_Row[initValue]);		
					if($prefixTG==$trunkgp)
					{
						$prefixinstNo=$Row_2[instanceNo];
						$findflag=1;
						break;
					}
				}
			}
			if($findflag==0)
			{
				$paramSql = " SELECT initValue,readValue,instanceNo FROM $msc_paramTable  
				WHERE $objWhereStr ";
				if($DEBUG) echo "paramSql=$paramSql<br>";
				$Result_2 = mysqli_query($pubConn,$paramSql);				
				while($Row_2 = mysqli_fetch_array($Result_2))
				{					
					$prefixflag=bindec(getBitValue($Row_2[initValue],'10.7-10.7'));
					if($prefixflag==0)
					{
						$findflag=1;
						break;
					}
				}												
			}
	
			if($findflag==1)
			{
				$AAS_prefix = omc_keep_length($MSISDN,'E',16,0);
				$objstrset='2.1.1';
				$objWhereStr =getLevelWhere($objstrset);				
				$updSql = "UPDATE $msc_paramTable SET initValue = '$AAS_prefix'   
				WHERE $objWhereStr AND instanceNo = '$Row_2[instanceNo]'
				";
				if($DEBUG) echo "updSql=$updSql<br>";
				mysqli_query($pubConn,$updSql);
				
				$objstrset='2.1.2';
				$objWhereStr =getLevelWhere($objstrset);				
				$paramSql = " SELECT initValue FROM paramConf  
				WHERE $objWhereStr
				";
				if($DEBUG) echo "paramSql=$paramSql<br>";
				$Result_def = mysqli_query($pubConn,$paramSql);					
				$Row_def	= mysqli_fetch_array($Result_def);
				
				$Row_def[initValue] = setBitValue($Row_def[initValue],'10.7-10.7','1');//flag on
				$Row_def[initValue] = setBitValue($Row_def[initValue],'18.0-18.0','1');//VoicePromptFlag=on
				$Row_def[initValue] = setBitValue($Row_def[initValue],'10.4-10.6','011');//emergency
				$Row_def[initValue] = setBitValue($Row_def[initValue],'10.2-10.3','00');//trunk					
				$Row_def[initValue] = setBitValue($Row_def[initValue],'11.0-11.7','08');//length=8
				
				$setValue = strtoupper($Row_def[initValue]);
				$updSql = "UPDATE $msc_paramTable SET initValue = '$setValue'   
				WHERE $objWhereStr AND instanceNo = '$Row_2[instanceNo]'
				";
				if($DEBUG) echo "updSql=$updSql<br>";
				mysqli_query($pubConn,$updSql);	
	
				$objstrset='2.1.3';
				$objWhereStr =getLevelWhere($objstrset);				
				$paramSql = " SELECT initValue,readValue,instanceNo FROM $msc_paramTable  
										WHERE $objWhereStr AND instanceNo ='$Row_2[instanceNo]'
										";
										
				$Result = mysqli_query($pubConn,$paramSql);				
				$Row	= mysqli_fetch_array($Result);
			
	
				$HEXtrunkgp = omc_keep_length(dechex($trunkgp),0,2);		
				$Row[initValue] = strtoupper($HEXtrunkgp);
				$updSql = "UPDATE $msc_paramTable SET initValue = '$Row[initValue]'   
				WHERE $objWhereStr AND instanceNo = '$Row_2[instanceNo]'
				";
				mysqli_query($pubConn,$updSql);			
			}
		}
		if(isset($MSISDN_save))//SCF-- GTT table param_99
		{
			$sccp_objDB = 'OBJ_223';
			$tmpTable = 'param_99';
			$tmpConf = 'paramConf';
			$oidstr = '2.2';		
			$objWhereStr = getLevelWhere($oidstr);
			$getSql="SELECT instanceNo,initValue FROM $tmpTable WHERE $objWhereStr AND initValue LIKE '01%' ";
			if(0) echo "<BR>getSql=$getSql";
			$result	=mysqli_query($pubConn,$getSql);
			$haveSeted = 0;
			while($rows	=mysqli_fetch_array($result))
			{
				$tmpStartMSISDN = getBitValue($rows[initValue],'03.0-12.7');
				$tmpStartMSISDN = str_replace('F','',$tmpStartMSISDN);
				$tmpDpc = hexdec(getBitValue($rows[initValue],'24.0-26.7'));
				$tmpSSN = hexdec(getBitValue($rows[initValue],'27.0-27.7'));
				if(strcmp($tmpStartMSISDN,$MSISDN_old)==0
					&& $tmpDpc==$DPC
					&& $tmpSSN == 8)
				{
					//echo "<br>$tmpStartMSISDN<br>$MSISDN_old";
					$tmpInstanceNo = $rows[instanceNo];
					$haveSeted = 1;
					break;
				}
				//echo "<br>$tmpStartMSISDN<br>$MSISDN_old<br>";
			}
			//exit;
			if($haveSeted)
			{
				$setInstNo = $tmpInstanceNo;
			}
			else
			{
				$getSql="SELECT instanceNo,initValue FROM $tmpTable WHERE $objWhereStr AND initValue LIKE '00%' ";
				if(0) echo "<BR>getSql=$getSql";
				$result	=mysqli_query($pubConn,$getSql);
				$rows	=mysqli_fetch_array($result);
				$setInstNo = $rows[instanceNo];
			}
			
			$rows[initValue] = setBitValue($rows[initValue],'0.0-0.7','01');//flag
			$rows[initValue] = setBitValue($rows[initValue],'01.0-01.7','01');//MSISDN
			$tmp = omc_keep_length($MSISDN,'F',20,0);
			$rows[initValue] = setBitValue($rows[initValue],'03.0-12.7',$tmp);//
			$rows[initValue] = setBitValue($rows[initValue],'13.0-22.7',$tmp);//
			$tmp = omc_keep_length($NetID,'0',2);
			$rows[initValue] = setBitValue($rows[initValue],'23.0-23.7',$tmp);//NI
			$tmp = omc_keep_length(dechex($DPC),'0',6);
			$rows[initValue] = setBitValue($rows[initValue],'24.0-26.7',$tmp);//DPC WXC2sp		
			$tmp = omc_keep_length(dechex(8),'0',2);
			$rows[initValue] = setBitValue($rows[initValue],'27.0-27.7',$tmp);//SSN=8
			$tmp = omc_keep_length(dechex(7),'0',2);
			$rows[initValue] = setBitValue($rows[initValue],'29.0-29.7',$tmp);//Address indicator
			$rows[initValue] = strtoupper($rows[initValue]);
			//echo "<br>rows[initValue]:{$rows[initValue]}";
			$updflag = "UPDATE $tmpTable SET initValue = '$rows[initValue]' 
		        			WHERE $objWhereStr and instanceNo='$setInstNo'
		        			";								
		  if(0) echo "<br>$updflag<br>";
		  //exit;
			mysqli_query($pubConn,$updflag);
			echo mysqli_error($pubConn);					
		}
	
		if(isset($MSISDN_save))
		{
			echo "<script LANGUAGE=\"JavaScript\">";
			echo "\n window.location.href=\"$backurl_un\";";
			echo "\n </script>";
			exit();
		}
		
	}
	//arwean add 2006-03-01
	if(isset($linkType0_save)||isset($setSys))
	{		
		$tmp = dechex($link0_type);
		$tmp = omc_keep_length($tmp,'0',2);
		$oidstr = "2.1.9";
		$objWhereStr = getLevelWhere($oidstr);
		$updflag = "UPDATE $paramTable SET initValue = '$tmp' 
	        			WHERE $objWhereStr and instanceNo='0'
	        			";								
	  if($DEBUG) echo "$updflag<br>";
		mysqli_query($pubConn,$updflag);
		echo mysqli_error($pubConn);					
		if(isset($linkType0_save)){
		echo "<script LANGUAGE=\"JavaScript\">";
		echo "\n window.location.href=\"$backurl_un\";";
		echo "\n </script>";
		exit();		
		}
	}
	
	if(isset($linkType1_save)||isset($setSys))
	{		
		$tmp = dechex($link1_type);
		$tmp = omc_keep_length($tmp,'0',2);
		$oidstr = "2.1.9";
		$objWhereStr = getLevelWhere($oidstr);
		$updflag = "UPDATE $paramTable SET initValue = '$tmp' 
	        			WHERE $objWhereStr and instanceNo='1'
	        			";								
	  if($DEBUG) echo "$updflag<br>";
		mysqli_query($pubConn,$updflag);
		echo mysqli_error($pubConn);					
		if(isset($linkType1_save)){
		echo "<script LANGUAGE=\"JavaScript\">";
		echo "\n window.location.href=\"$backurl_un\";";
		echo "\n </script>";
		exit();		
		}
	}
	
	if(isset($MG_IP_LK0_save)||isset($setSys))
	{
		$setValue='';
		$ipArr=explode(".",$MG_IP_LK0);
		for($i=0;$i<sizeof($ipArr); $i++)
		{
			$tmp=omc_keep_length(dechex($ipArr[$i]),0,2);
			$setValue .= $tmp;
		}
		$setValue=strtoupper($setValue);
		
		$iptrans_objDB="OBJ_221";
		$iptrans_Table="param_11";		
		$oidstr = "2.1";
		$objWhereStr = getLevelWhere($oidstr);
		$updflag = "UPDATE $iptrans_Table SET initValue = '$setValue' 
	        			WHERE $objWhereStr and subSysNo='$this_sysNo' and instanceNo='0'
	        			";								
	  if($DEBUG) echo "$updflag<br>";
		mysqli_query($pubConn,$updflag);
		echo mysqli_error($pubConn);					
		if(isset($MG_IP_LK0_save)){
		echo "<script LANGUAGE=\"JavaScript\">";
		echo "\n window.location.href=\"$backurl_un\";";
		echo "\n </script>";
		exit();		
		}
		
	}
	
	if(isset($MG_IP_LK1_save)||isset($setSys))
	{
		$setValue='';
		$ipArr=explode(".",$MG_IP_LK1);
		for($i=0;$i<sizeof($ipArr); $i++)
		{
			$tmp=omc_keep_length(dechex($ipArr[$i]),0,2);
			$setValue .= $tmp;
		}
		$setValue=strtoupper($setValue);
		
		$iptrans_objDB="OBJ_221";
		$iptrans_Table="param_11";		
		$oidstr = "2.1";
		$objWhereStr = getLevelWhere($oidstr);
		$updflag = "UPDATE $iptrans_Table SET initValue = '$setValue' 
	        			WHERE $objWhereStr and subSysNo='$this_sysNo' and instanceNo='1'
	        			";								
	  if($DEBUG) echo "$updflag<br>";
		mysqli_query($pubConn,$updflag);
		echo mysqli_error($pubConn);					
		if(isset($MG_IP_LK1_save)){
		echo "<script LANGUAGE=\"JavaScript\">";
		echo "\n window.location.href=\"$backurl_un\";";
		echo "\n </script>";
		exit();		
		}
		
	}
	
	if(isset($encode_rule0_save)||isset($setSys))
	{		
		$tmp = dechex($encode_rule0);
		$tmp = omc_keep_length($tmp,'0',2);
		$oidstr = "2.1.10";
		$objWhereStr = getLevelWhere($oidstr);
		$updflag = "UPDATE $paramTable SET initValue = '$tmp' 
	        			WHERE $objWhereStr and instanceNo='0'
	        			";								
	  if($DEBUG) echo "$updflag<br>";
		mysqli_query($pubConn,$updflag);
		echo mysqli_error($pubConn);					
		if(isset($encode_rule0_save)){
		echo "<script LANGUAGE=\"JavaScript\">";
		echo "\n window.location.href=\"$backurl_un\";";
		echo "\n </script>";
		exit();		
		}
	}
	
	if(isset($encode_rule1_save)||isset($setSys))
	{
		$tmp = dechex($encode_rule1);
		$tmp = omc_keep_length($tmp,'0',2);
		$oidstr = "2.1.10";
		$objWhereStr = getLevelWhere($oidstr);
		$updflag = "UPDATE $paramTable SET initValue = '$tmp' 
	        			WHERE $objWhereStr and instanceNo='1'
	        			";								
	  if($DEBUG) echo "$updflag<br>";
		mysqli_query($pubConn,$updflag);
		echo mysqli_error($pubConn);					
		if(isset($encode_rule1_save)){
		echo "<script LANGUAGE=\"JavaScript\">";
		echo "\n window.location.href=\"$backurl_un\";";
		echo "\n </script>";
		exit();		
		}
	}
	
	if(isset($setSys) || isset($getSys))
	{
		if(isset($setSys))
		{
			echo "<br>Setting parameters<br>";
			SetParam($oidsysarr0);				
			SetParam($oidsysarr);				
			SetParam($oidAASarr);				

			SaveParam($SaveArr);
			
		}
		else
		{ 
			echo "<br>Getting parameters<br>";
			GetParam($oidsysarr0);
			GetParam($oidsysarr);
			GetParam($oidAASarr);
		}
	}
}

if($setSys || $getSys  || $undoSet)
{
	echo "<br><br><h4><font color=\"#0000ff\">Finished!</font></h4>";
	if($DEBUG) exit();
	echo "<script LANGUAGE=\"JavaScript\">";
	echo " location='$PHP_SELF?trunkgp=$trunkgp&infoNo=$infoNo&linkset=$linkset';";
	echo "</script>";
	exit();
}

{//show help and back 
	echo "<form method=\"POST\" name=\"setForm\" action=\"$PHP_SELF?linkset=$linkset&trunkgp=$trunkgp\">";
	echo "<table border=\"0\" width=\"100%\">";
	echo "<tr>";
	echo "<td width=\"50%\">";
	echo "Configuration > <a href=\"../overview/overview.php\">Network</a> > <a href=\"#\">AAS</a>";
	echo "</td>";
	echo "<td width=\"50%\" align=\"right\" title=\"Help\">";
	showHelp($helpId);
	echo "</td>";
	echo "</tr>";
	echo "</table>";
	echo "<br>";
	
	checkDevices(311);
	
	{
		echo "<table width=\"100%\">";
		echo "<tr>";
			echo "<td width=\"70%\">";
				echo "<b>Audio Announcement System</b>&nbsp;&nbsp;$Spname";
			echo "</td>";
			echo "<td width=\"20%\" align=\"right\">";
					echo "<input type=\"submit\" title=\"$strTitleGet\" name=\"getSys\" value=\"$strGet\" class=\"button\" style=\"cursor:pointer; left: 1; top: 2; width: 60; height: 25; position: relative\">";
					echo "&nbsp;&nbsp;&nbsp;";
					echo "<input type=\"submit\" title=\"$strTitleSet\" name=\"setSys\" value=\"$strSet\" class=\"button\" style=\"cursor:pointer; left: 1; top: 2; width: 60; height: 25; position: relative\">";
				echo "</td>";
			echo "<td width=\"10%\">";
				echo "<p align=\"right\"><a href=\"javascript:backpage(0,'../overview/overview.php?scroll_y=$page_top')\"><img align=absBottom border=0 src=\"../../images/left.gif\" width=\"14\" height=\"14\">$strBack</a>";
			echo "</td>";
		echo "</tr>";
		echo "<input type=\"hidden\" name=\"linkset\" value=\"$linkset\">";
		echo "<input type=\"hidden\" name=\"trunkgp\" value=\"$trunkgp\">";
		echo "<input type=\"hidden\" name=\"infoNo\" value=\"$infoNo\">";
		echo "</table>";
		echo "<br>";
	}
}




echo "<table border=\"1\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\">";

{// Signaling/Traffic
	{//DPC
		$DPC_sysId = '222_99_99';
		
		$DPC_sysIdArr	= explode('_',$DPC_sysId);
		$DPC_sysTypeNo	= $DPC_sysIdArr[0];
		$DPC_sysNo		= $DPC_sysIdArr[1];
		$DPC_subSysNo	= $DPC_sysIdArr[2];
		
		$DPC_oidstr = '2.4.1';
		$DPC_objWhereStr= '';	
		$DPC_objWhereStr =getLevelWhere($DPC_oidstr);
		$DPC_objDb		= 'OBJ_'.$DPC_sysTypeNo;
		$DPC_paramTable = 'param_'.$DPC_sysNo;		
		
		$DPC_paramSql = " SELECT initValue,readValue,instanceNo FROM $DPC_paramTable  
					WHERE $DPC_objWhereStr AND instanceNo ='$linkset' 
					";
		if($DEBUG) echo "$DPC_paramSql<br>";
		$DPC_Result = mysqli_query($pubConn,$DPC_paramSql);
		$DPC_Row	= mysqli_fetch_array($DPC_Result);
		$DPC= hexdec(getBitValue($DPC_Row[initValue],'0.0-2.7'));
		$NetID 		= bindec(getBitValue($DPC_Row[initValue],'3.0-3.1'));		
	}

	{//WXC2 OPC
		$oidstr = '2.2';
		$link_Db = 'OBJ_222';	
		$link_Table  = 'param_99';
		
		$subSysNo = 99;
		$objWhereStr= '';
		$objWhereStr =getLevelWhere($oidstr);
		$paramSql = " SELECT initValue,readValue,instanceNo FROM $link_Table  
					WHERE $objWhereStr AND subSysNo = '$subSysNo'
					";
		if($DEBUG) echo "$paramSql<br>";			
		$Result = mysqli_query($pubConn,$paramSql);
		$Row	= mysqli_fetch_array($Result);
									
		$NIbit	= getBitValue($Row[initValue],"0.$NetID");
		$tmp	= $NetID+1+$NIbit*4;
		$oidstr = '2.3.'.$tmp;
		$objWhereStr= '';
		$objWhereStr =getLevelWhere($oidstr);
		$updSql = "SELECT initValue FROM $link_Table
				   WHERE $objWhereStr AND instanceNo = '0' AND subSysNo = '$subSysNo'
								";
		$Result	= mysqli_query($pubConn,$updSql);
		$Row	= mysqli_fetch_array($Result);
		$WXC2PC = hexdec($Row[initValue]);
	}

	{//CC *****************************
		$oidstr = "2.1.4";
		$objWhereStr = getLevelWhere($oidstr);
		$getsql = "select initValue from $paramTable 
							where $objWhereStr
							";
		$result = @mysqli_query($pubConn,$getsql);
		$row = @mysqli_fetch_array($result);
		$CC_value = str_replace('F','',$row[0]);
	}
	{//NDC **************************
		$oidstr = "2.1.5";
		$objWhereStr = getLevelWhere($oidstr);
		$getsql = "select initValue from $paramTable 
							where $objWhereStr
							";
		$result = @mysqli_query($pubConn,$getsql);
		$row = @mysqli_fetch_array($result);
		$NDC_value = str_replace('F','',$row[0]);
	}
	{//Linktype **************************
		//Linktype0
		$oidstr = "2.1.9";
		$objWhereStr = getLevelWhere($oidstr);
		$getsql = "select initValue from $paramTable 
							where $objWhereStr  order by instanceNo
							";
		$result = @mysqli_query($pubConn,$getsql);
		$row = @mysqli_fetch_array($result);
		$link0_type = hexdec($row[initValue]);
		
		//Linktype1		
		$row = @mysqli_fetch_array($result);
		$link1_type = hexdec($row[initValue]);
	}
	{//MG_IP
		//MG_IP_LK0
		$iptrans_objDB="OBJ_221";
		$iptrans_Table="param_11";
		$oidstr = "2.1";
		$objWhereStr = getLevelWhere($oidstr);
		$getsql = "select initValue from $iptrans_Table 
							where $objWhereStr and subSysNo='$this_sysNo' order by instanceNo
							";
		$result = @mysqli_query($pubConn,$getsql);
		$row = @mysqli_fetch_array($result);
		$ip[0]=hexdec(getBitValue($row[initValue],"0.0-0.7"));
		$ip[1]=hexdec(getBitValue($row[initValue],"1.0-1.7"));
		$ip[2]=hexdec(getBitValue($row[initValue],"2.0-2.7"));
		$ip[3]=hexdec(getBitValue($row[initValue],"3.0-3.7"));
		$MG_IP_LK0 = $ip[0].".".$ip[1].".".$ip[2].".".$ip[3];
		
		//MG_IP_LK1		
		$row = @mysqli_fetch_array($result);
		$ip[0]=hexdec(getBitValue($row[initValue],"0.0-0.7"));
		$ip[1]=hexdec(getBitValue($row[initValue],"1.0-1.7"));
		$ip[2]=hexdec(getBitValue($row[initValue],"2.0-2.7"));
		$ip[3]=hexdec(getBitValue($row[initValue],"3.0-3.7"));
		$MG_IP_LK1 = $ip[0].".".$ip[1].".".$ip[2].".".$ip[3];
	}
	{//Encode Rule0
		//Encode Rule0
		$oidstr = "2.1.10";
		$objWhereStr = getLevelWhere($oidstr);
		$getsql = "select initValue from $paramTable 
							where $objWhereStr order by instanceNo
							";
		$result = @mysqli_query($pubConn,$getsql);
		$row = @mysqli_fetch_array($result);
		$encode_rule0 = hexdec($row[initValue]);
		
		// Encode Rule1
		$row = @mysqli_fetch_array($result);
		$encode_rule1 = hexdec($row[initValue]);
	}
	{//get link status
		$db="OMC_PUB";
		$sql = "SELECT detailStat,updateTime FROM sysStat WHERE sysTypeNo='311' AND sysNo='$this_sysNo' AND subSysNo='0'"; 
		//echo "$sql";
		if($DEBUG)echo "<br>sql=$sql";
		$res=mysqli_query($pubConn,$sql);
		$row=@mysqli_fetch_array($res);
		//echo mysqli_error($pubConn);
		
		
		$due_date	= date("Y-m-d H:i:s",mktime(date("H"),date("i"),date("s")-$heatbeat_overtime,date("m"),date("d"),date("Y")));
		$ove_date	= date("Y-m-d H:i:s",mktime(date("H"),date("i"),date("s")+$heatbeat_overtime,date("m"),date("d"),date("Y")));
		
		$hex_mes=$row[detailStat];
		$refresh_time=$row[updateTime];
		//echo $heatbeat_overtime;
	
		$bin_mes='';
		for($i=0;$i<strlen($hex_mes);$i++)
		{
			$sig_hex_mes=substr($hex_mes,$i,1);
			$sig_dec_mes=HexDec($sig_hex_mes);
			$sig_bin_mes=DecBin($sig_dec_mes);
			$sig_bin_mes=omc_keep_length($sig_bin_mes,0,4);
			$bin_mes.=$sig_bin_mes;
		}
		if($DEBUG)echo "<br>bin_mes=$bin_mes";
		$stt_e0		=	21; //E1 #0 status (bit 0: 0/1 not in used / in used; bit 1: 0/1 link not ok / link ok)
		$stt_e1		=	22; //E1 #1 status
			
		//E1#0 status (bit 0: 0/1 not in used / in used; bit 1: 0/1 link not ok / link ok)
		for($i=0;$i<2;$i++){
			$binSttE0=substr($bin_mes,$stt_e0*8+7-$i,1);
			$sttE0[$i]=BinDec($binSttE0);
			if($DEBUG)echo "<br>sttE0[$i]=$sttE0[$i]";
		}
		
		if(!$sttE0[0]){
			$sttE0[1] = 2;
		}
		
		//E1#1 status
		for($i=0;$i<2;$i++){
			$binSttE1=substr($bin_mes,$stt_e1*8+7-$i,1);
			$sttE1[$i]=BinDec($binSttE1);
			if($DEBUG)echo "<br>sttE1[$i]=$sttE1[$i]";
		}
		
		if(!$sttE1[0]){
			$sttE1[1] = 2;
		}
	
	}
	$aasLink0_status=$sttE0[1];
	$aasLink1_status=$sttE1[1];
	
	if($aasLink0_status==1)
		$color_aasLink0_stat='blue';
	elseif($aasLink0_status==0)
		$color_aasLink0_stat='red';
	if($aasLink1_status==1)
		$color_aasLink1_stat='blue';
	elseif($aasLink1_status==0)
		$color_aasLink1_stat='red';
		
	{//SCCP MSC ---AAS MSISDN
		$sccp_objDB = 'OBJ_223';
		$tmpTable = 'param_11';
		$oidstr = '2.1.8';
		$objWhereStr = getLevelWhere($oidstr);
		$getsql = "select initValue from $tmpTable 
							where $objWhereStr
							";
		$result = @mysqli_query($pubConn,$getsql);
		$row = @mysqli_fetch_array($result);
		$MSISDN	= getBitValue($row[initValue],"01.0-10.7");
		$MSISDN = str_replace('F','',$MSISDN);
		echo "<input type=\"hidden\" name=\"MSISDN_total\" value=\"$row[initValue]\">";
		echo "<input type=\"hidden\" name=\"MSISDN_old\" value=\"$MSISDN\">";
	}

	{//SCCP SCF --- MSISDN(SCF_num) arwean
		$sccp_objDB = 'OBJ_223';
		$tmpTable = 'param_99';
		$oidstr = '2.1.147';
		$objWhereStr = getLevelWhere($oidstr);
		$getsql = "select initValue from $tmpTable 
							where $objWhereStr
							";
		$result = @mysqli_query($pubConn,$getsql);
		$row = @mysqli_fetch_array($result);
		$SCF_num	= getBitValue($row[initValue],"01.0-10.7");
		$SCF_num = str_replace('F','',$SCF_num);
		echo "<input type=\"hidden\" name=\"SCF_num\" value=\"$SCF_num\">";
	}

	echo "<tr >";
	echo "<td rowspan=\"10\" width=\"12%\" bgcolor=\"#E6E6E6\" ><b>Signaling/Traffic</b></td>";	
	echo "</tr>";
	
	echo "<tr >";
	echo "<td width=\"18%\" bgcolor=\"#E6E6E6\" >Signaling point code</td>";
	echo "<td colspan=\"8\" width=\"70%\">$DPC&nbsp;</td>";
	echo "<input type=\"hidden\" name=\"DPC\" value=\"$DPC\">";
	echo "</tr >";
		

	echo "<tr >";
	echo "<td bgcolor=\"#E6E6E6\" width=\"18%\" >NetWork indicator</td>";
	echo "<td colspan=\"8\" width=\"70%\">$NetIdConfArr[$NetID]";
	echo "<input type=\"hidden\" name=\"NetID\" value=\"$NetID\">";
	echo "</td>";
	echo "</tr >";
	
	echo "<tr >";
	echo "<td bgcolor=\"#E6E6E6\" >WXC2 Point Code</td>";
	echo "<td colspan=\"8\">$WXC2PC<input type=\"hidden\" name=\"WXC2PC\" value=\"$WXC2PC\">";
	echo "</td>";	
	echo "</tr >";
	
	
	echo "<input type=\"hidden\" name=\"CIC_0\" value=\"0\">";		
	echo "<input type=\"hidden\" name=\"CIC_1\" value=\"32\">";
			
	echo "<tr >";
	echo "<td bgcolor=\"#E6E6E6\" width=\"18%\">Network number</td>";
	
	echo "<td colspan=\"3\" width=\"15%\">CC:&nbsp;";
	if(isset($CC_edit))
	{
		echo "<input type = \"text\" name = \"CC\"	value = \"$CC_value\" size = \"4\" maxlength = \"4\" class=\"text\" onchange = checkInput(this,10,0)>&nbsp;";
		echo "<input type=\"submit\" name=\"CC_save\" value=\"save\" onmouseover=\"this.className='style4'\" 	onmouseout=\"this.className='style3'\" class=\"style3\">";
	}
	else
	{
		echo "<input type=\"hidden\" name = \"CC\"	value = \"$CC_value\">";
		if($CC_value =='')
		{
			$CC_value ='--';
		}
		echo "<a href=\"$PHP_SELF?linkset=$linkset&trunkgp=$trunkgp&infoNo=$infoNo&CC_edit=1\">$CC_value</a>";
	}
	echo "</td>";
	echo "<td colspan=\"2\" width=\"15%\">NDC:&nbsp;";
	if(isset($NDC_edit))
	{
		echo "<input type = \"text\" name = \"NDC\"	value = \"$NDC_value\" size = \"4\" maxlength = \"4\" class=\"text\" onchange = checkInput(this,10,0)>&nbsp;";
		echo "<input type=\"submit\" name=\"NDC_save\" value=\"save\" onmouseover=\"this.className='style4'\" 	onmouseout=\"this.className='style3'\" class=\"style3\">";
	}
	else
	{
		echo "<input type=\"hidden\" name = \"NDC\"	value = \"$NDC_value\">";
		if($NDC_value =='')
		{
			$NDC_value ='--';
		}
		echo "<a href=\"$PHP_SELF?linkset=$linkset&trunkgp=$trunkgp&infoNo=$infoNo&NDC_edit=1\">$NDC_value</a>";
	}
	echo "</td>";
	echo "<td colspan=\"3\" width=\"40%\">MSISDN:&nbsp;";
	if(isset($MSISDN_edit)){
		echo "<input type = \"text\" name = \"MSISDN\"	value = \"$MSISDN\" size = \"20\" maxlength = \"20\" class=\"text\" onchange = checkInput(this,10,0)>&nbsp;";
		echo "<input type=\"submit\" name=\"MSISDN_save\" value=\"save\" onmouseover=\"this.className='style4'\" 	onmouseout=\"this.className='style3'\" class=\"style3\">";
	}else{
		echo "<input type=\"hidden\" name=\"MSISDN\" value=\"$MSISDN\">";
		if($MSISDN ==''){
			$MSISDN ='--';
		}
		echo "<a href=\"$PHP_SELF?linkset=$linkset&trunkgp=$trunkgp&infoNo=$infoNo&MSISDN_edit=1\">$MSISDN</a>";		
	}
	echo "</tr >";
	
	echo "<tr >";
	echo "<td bgcolor=\"#E6E6E6\">SCF number</td>";
	if($SCF_num ==''){
		echo "<td colspan=\"8\">--</td>";
	}else{
		echo "<td colspan=\"8\">$SCF_num</td>";	
	}	
	echo "</tr >";
	$linkTypeArr=array("E1","T1");
	$linkStaArr=array("N","Y","--");
	$encodeRuleArr=array("A Law","Mu Law");
	{//add by arwean 20060301
	echo "<tr >";
	echo "<td rowspan=\"4\" bgcolor=\"#E6E6E6\">Link</td>";	
	echo "</tr >";
	
	echo "<tr>";
	echo "<td colspan=\"1\" width=\"4%\"><b>No</b></td>"; 
	echo "<td colspan=\"1\" width=\"14%\"><b>Link type</b></td>"; 
	echo "<td colspan=\"2\" width=\"30%\"><b>MG Ip</b></td>";
	echo "<td colspan=\"3\" width=\"14%\"><b>Encode rule</b></td>";
	echo "<td colspan=\"1\" width=\"8%\"><b>Status</b></td>";
	echo "</tr>";
	
	{//link0
		echo "<tr>";
		echo "<td colspan=\"1\">0</td>"; 
		echo "<td colspan=\"1\">";	
			if(isset($linkType0_edit))
			{
				echo "<select size=\"1\" value=\"$link0_type\" name=\"link0_type\">";
				for($i=0; $i<sizeof($linkTypeArr); $i++)
				{
					echo "<option value=\"$i\" ";
					if($i == $link0_type)
						echo "selected";
					echo ">{$linkTypeArr[$i]}</option>";
				}
				echo "</select>";		
				echo "<input type=\"submit\" name=\"linkType0_save\" value=\"save\" onmouseover=\"this.className='style4'\" 	onmouseout=\"this.className='style3'\" class=\"style3\">";
			}
			else
			{
				echo "<input type=\"hidden\" name=\"link0_type\" value=\"$link0_type\">";
				echo "<a href=\"$PHP_SELF?linkset=$linkset&trunkgp=$trunkgp&infoNo=$infoNo&linkType0_edit=1\">{$linkTypeArr[$link0_type]}</a>";		
			}
		echo"</td>"; 
		echo "<td colspan=\"2\">";
			if(isset($MG_IP_LK0_edit))
			{
				echo "<input type = \"text\" name = \"MG_IP_LK0\"	value = \"$MG_IP_LK0\" size = \"15\" maxlength = \"15\" class=\"text\" onchange=\"checkIP(this)\">&nbsp;";
				echo "<input type=\"submit\" name=\"MG_IP_LK0_save\" value=\"save\" onmouseover=\"this.className='style4'\" 	onmouseout=\"this.className='style3'\" class=\"style3\">";
			}
			else
			{
				if($MG_IP_LK0 ==''){
					$MG_IP_LK0 ='--';
				}
				echo "<input type=\"hidden\" name=\"MG_IP_LK0\" value=\"$MG_IP_LK0\">";
				echo "<a href=\"$PHP_SELF?linkset=$linkset&trunkgp=$trunkgp&infoNo=$infoNo&MG_IP_LK0_edit=1\">$MG_IP_LK0</a>";		
			}
		echo "</td>";
		echo "<td colspan=\"3\">";	
			if(isset($encode_rule0_edit))
			{
				echo "<select size=\"1\" value=\"$encode_rule0\" name=\"encode_rule0\">";
				for($i=0; $i<sizeof($encodeRuleArr); $i++)
				{
					echo "<option value=\"$i\" ";
					if($i == $encode_rule0)
						echo "selected";
					echo ">{$encodeRuleArr[$i]}</option>";
				}
				echo "</select>";		
				echo "<input type=\"submit\" name=\"encode_rule0_save\" value=\"save\" onmouseover=\"this.className='style4'\" 	onmouseout=\"this.className='style3'\" class=\"style3\">";
			}
			else
			{
				echo "<input type=\"hidden\" name=\"encode_rule0\" value=\"$encode_rule0\">";
				echo "<a href=\"$PHP_SELF?linkset=$linkset&trunkgp=$trunkgp&infoNo=$infoNo&encode_rule0_edit=1\">{$encodeRuleArr[$encode_rule0]}</a>";		
			}
		echo"</td>"; 
		//echo "<td colspan=\"1\">{$linkStaArr[$aasLink0_status]}</td>";
		echo "<td><INPUT TYPE=\"text\" NAME=\"link0_state\" VALUE=\"{$linkStaArr[$aasLink0_status]}\" SIZE=\"20\" style=\"color:$color_aasLink0_stat;border-left:medium none;border-right:medium none;border-top:medium none;border-bottom:medium none;font-size: 9pt\" READONLY VALUE=\"\"></td>";
	
		echo "</tr>";
	}
	{//link1	
		echo "<tr>";
		echo "<td colspan=\"1\">1</td>"; 
		echo "<td colspan=\"1\">";	
			if(isset($linkType1_edit))
			{
				echo "<select size=\"1\" value=\"$link1_type\" name=\"link1_type\">";
				for($i=0; $i<sizeof($linkTypeArr); $i++)
				{
					echo "<option value=\"$i\" ";
					if($i == $link1_type)
						echo "selected";
					echo ">{$linkTypeArr[$i]}</option>";
				}
				echo "</select>";		
				echo "<input type=\"submit\" name=\"linkType1_save\" value=\"save\" onmouseover=\"this.className='style4'\" 	onmouseout=\"this.className='style3'\" class=\"style3\">";
			}
			else
			{
				echo "<input type=\"hidden\" name=\"link1_type\" value=\"$link1_type\">";
				echo "<a href=\"$PHP_SELF?linkset=$linkset&trunkgp=$trunkgp&infoNo=$infoNo&linkType1_edit=1\">{$linkTypeArr[$link1_type]}</a>";		
			}
		echo"</td>"; 
		
		echo "<td colspan=\"2\">";
			if(isset($MG_IP_LK1_edit))
			{
				echo "<input type = \"text\" name = \"MG_IP_LK1\"	value = \"$MG_IP_LK1\" size = \"15\" maxlength = \"15\" class=\"text\" onchange=\"checkIP(this)\">&nbsp;";
				echo "<input type=\"submit\" name=\"MG_IP_LK1_save\" value=\"save\" onmouseover=\"this.className='style4'\" 	onmouseout=\"this.className='style3'\" class=\"style3\">";
			}
			else
			{
				if($MG_IP_LK1 ==''){
					$MG_IP_LK1 ='--';
				}
				echo "<input type=\"hidden\" name=\"MG_IP_LK1\" value=\"$MG_IP_LK1\">";
				echo "<a href=\"$PHP_SELF?linkset=$linkset&trunkgp=$trunkgp&infoNo=$infoNo&MG_IP_LK1_edit=1\">$MG_IP_LK1</a>";		
			}
		echo "</td>";
		echo "<td colspan=\"3\">";	
			if(isset($encode_rule1_edit))
			{
				echo "<select size=\"1\" value=\"$encode_rule1\" name=\"encode_rule1\">";
				for($i=0; $i<sizeof($encodeRuleArr); $i++)
				{
					echo "<option value=\"$i\" ";
					if($i == $encode_rule1)
						echo "selected";
					echo ">{$encodeRuleArr[$i]}</option>";
				}	
				echo "</select>";	
				echo "<input type=\"submit\" name=\"encode_rule1_save\" value=\"save\" onmouseover=\"this.className='style4'\" 	onmouseout=\"this.className='style3'\" class=\"style3\">";
			}
			else
			{
				echo "<input type=\"hidden\" name=\"encode_rule1\" value=\"$encode_rule1\">";
				echo "<a href=\"$PHP_SELF?linkset=$linkset&trunkgp=$trunkgp&infoNo=$infoNo&encode_rule1_edit=1\">{$encodeRuleArr[$encode_rule1]}</a>";		
			}
		echo"</td>"; 
		//echo "<td colspan=\"1\">{$linkStaArr[$aasLink1_status]}</td>";
		echo "<td><INPUT TYPE=\"text\" NAME=\"link1_state\" VALUE=\"{$linkStaArr[$aasLink1_status]}\" SIZE=\"20\" style=\"color:$color_aasLink1_stat;border-left:medium none;border-right:medium none;border-top:medium none;border-bottom:medium none;font-size: 9pt\" READONLY VALUE=\"\"></td>";
		echo "</tr>";
	}
	}
}
echo "</table>&nbsp;";

{//AAS announcement
	{//repeat count
		$oidstr = "2.3.2";
		$objWhereStr = getLevelWhere($oidstr);
		$getsql = "select initValue from $paramTable 
							where $objWhereStr
							";
		$result = @mysqli_query($pubConn,$getsql);
		$row = @mysqli_fetch_array($result);
		$play_times = hexdec($row[0]);
	}
	
echo "<table border=\"1\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\"> ";
	$languageArr=array("French","English","Chinese","Russian","Spanish");
	$selSql = " SELECT instance,languageNum,showfiled FROM aasAnnounce where name ='AAS' and showfiled !='' order by instance";
	$Result = @mysqli_query($pubConn,$selSql);
	$announceNum=@mysqli_num_rows($Result);
	
	$selSql = " SELECT showfiled FROM aasAnnounce where name ='languageNum'";
	$lan_re = @mysqli_query($pubConn,$selSql);
	$lan_row = @mysqli_fetch_array($lan_re);

	echo "<tr><th colspan=\"5\"><b>AAS announcement</b>";		
		echo "&nbsp;(Laguage:";
			echo "<select name=\"slctLanguage\" onchange=\"selectLanguge()\" >";
				for($k=0;$k< $lan_row[showfiled];$k++)
				{
					echo "<option value=\"$k\" ";
					if($k==$slctLanguage) echo "selected";
					echo ">$languageArr[$k]</option>";
				}
			echo "</select>)";
	echo "</th></tr>";
	
	echo "<tr>";	
	echo "<td bgcolor=\"#E6E6E6\">Repeatition Counter</td>";
	echo "<td colspan=\"8\">";
	if(isset($time_edit))
	{
		echo "<input type = \"text\" name = \"playtimes\"	value = \"$play_times\" size = \"6\" maxlength = \"2\" class=\"text\" onchange = checkInput(this,10,255)>&nbsp;";
		echo "<input type=\"submit\" name=\"time_save\" value=\"save\" onmouseover=\"this.className='style4'\" 	onmouseout=\"this.className='style3'\" class=\"style3\">";
	}
	else
	{
		echo "<input type=\"hidden\" name = \"playtimes\"	value = \"$play_times\">";
		if($play_times =='')
		{
			$play_times ='--';
		}
		echo "<a href=\"$PHP_SELF?linkset=$linkset&trunkgp=$trunkgp&infoNo=$infoNo&time_edit=1\">$play_times</a>";
	}
/*	
	echo "<tr>";	
	echo "<td bgcolor=\"#E6E6E6\">Voice Group</td>";
	echo "<td colspan=\"8\">";
		for($i=0; $i<32; $i++)
		{
			echo "<a href=\"./aas_voiceGrp.php?linkset=$linkset&trunkgp=$trunkgp&infoNo=$infoNo&inst=$i&sysNo=$this_sysNo\">$i&nbsp;</a>";
			echo "&nbsp;";
		}
	echo "</td>";
*/	
	$rowsNum=$announceNum+2;
	echo "<tr >";
	echo "<td rowspan=\"$rowsNum\" width=\"15%\" bgcolor=\"#E6E6E6\" >Call unattainable<br>announcement</td>";
	echo "</tr >";	
	echo "<tr>";
	echo "<td width=\"5%\"><b>No.</b></td>";
	echo "<td width=\"70%\"><b>Announcement</b></td>";
	echo "<td width=\"5%\"><b>Play</b></td>";
	echo "<td width=\"5%\"><b>Update</b></td>";	
	echo "</tr>";	
		
	for($num=0;$num< $announceNum;$num++)
	{
		echo "<tr>";		
			echo "<td>$num</td>";
			$Row = @mysqli_fetch_array($Result);
			$fileno = $Row[instance];
			$fileno = omc_keep_length($Row[instance],0,3);
			echo "<td width=\"19%\">$Row[showfiled]</td>";
			
			echo "<td>";
			$path = "language0".$slctLanguage."/";
			$fullpath =$path.$fileno;
			echo "<a href=\"./voiceplay.php?voicefile=$fullpath&backurl=$backurl&sysId=$sysId\">play</a>&nbsp;";
			echo "</td>";
			
			echo "<td>";		
			$path = "language0".$slctLanguage."/";
			$fullpath =$path.$fileno;
			echo "<a href=\"./uploadfile.php?voicefile=$fullpath&backurl=$backurl&sysId=$sysId\">upload</a>&nbsp;";
			echo "</td>";				
		echo "</tr>";
	}
	/*
	{//SRF announcement	
	echo "</td>";
	echo "<td  bgcolor=\"#E6E6E6\" >PPS announcement</td>";
	echo "<td  colspan=\"8\">";
		echo "<table width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" ><tr>";
		echo "<td><a href=\"./SRFLanguage.php?instanceNo=0&sysId=$sysId&backurl=$backurl\">Language 0(English)</a>&nbsp;&nbsp;&nbsp;</td>";
		echo "<td><a href=\"./SRFLanguage.php?instanceNo=1&sysId=$sysId&backurl=$backurl\">Language 1(French)</a>&nbsp;&nbsp;&nbsp;</td>";
		echo "<td><a href=\"./SRFLanguage.php?instanceNo=2&sysId=$sysId&backurl=$backurl\">Language 2(--)</a>&nbsp;&nbsp;&nbsp;</td>";
		echo "<td><a href=\"./SRFLanguage.php?instanceNo=3&sysId=$sysId&backurl=$backurl\">Language 3(--)</a>&nbsp;&nbsp;&nbsp;</td>";
		echo "<td><a href=\"./SRFLanguage.php?instanceNo=4&sysId=$sysId&backurl=$backurl\">Language 4(--)</a>&nbsp;&nbsp;&nbsp;</td>";
		echo "</table>";
	echo "</td>";
	echo "</tr>";	
	}
	*/
echo "</table>";	
}
echo "<div>";
	echo "<a href=\"./loaddata.php?infoNo=$infoNo&linkset=$linkset&trunkgp=$trunkgp&flag=$flag\">Link to AAS</a>";
	echo "</div>";
echo "<br>";
echo "<br><br>";

{//update aas param
	
	if(1)
	{//add BB prefix for aas
		$tmp = omc_keep_length('BB','F',16,0);
		$tmp = strtoupper($tmp);
		$oidstr = "2.3.1";
		$objWhereStr = getLevelWhere($oidstr);
		$updflag = "UPDATE $paramTable SET initValue = '$tmp' 
	        			WHERE $objWhereStr
	        			";								
	  	if($DEBUG) echo "$updflag<br>";
		mysqli_query($pubConn,$updflag);
		echo mysqli_error($pubConn);
		
		//aas0 添加prefix
		if($this_sysNo==0)
		{
			$msc_objDb = 'OBJ_322';
			$msc_paramTable = 'param_99';
			$AAS_prefix = omc_keep_length('BB','E',16,0);
			
			$objstrset='2.1.1';
			$objWhereStr =getLevelWhere($objstrset);				
			$paramSql = " SELECT initValue,readValue,instanceNo FROM $msc_paramTable  
			WHERE $objWhereStr AND initValue = '$AAS_prefix' ";
			if($DEBUG) echo "paramSql=$paramSql<br>";
			$Result = mysqli_query($pubConn,$paramSql);				
			$objstrset='2.1.2';
			$objWhereStr =getLevelWhere($objstrset);
			$findflag=0;
			while($Row	= mysqli_fetch_array($Result))
			{
				$paramSql = " SELECT initValue,readValue,instanceNo FROM $msc_paramTable  
				WHERE $objWhereStr AND instanceNo = '$Row[instanceNo]'	";
				if($DEBUG) echo "paramSql=$paramSql<br>";
				$Result_2 = mysqli_query($pubConn,$paramSql);				
				$Row_2		= mysqli_fetch_array($Result_2);
				$prefixflag=bindec(getBitValue($Row_2[initValue],'10.7-10.7'));
				$calltype  =bindec(getBitValue($Row_2[initValue],'10.4-10.6'));
				if($prefixflag==1&&$calltype==1)//type = emergency
				{
					$Assign_objstrset='2.1.3';
					$Assign_objWhereStr =getLevelWhere($Assign_objstrset);				
					$paramSql = " SELECT initValue,readValue,instanceNo FROM $msc_paramTable  
											WHERE $Assign_objWhereStr AND instanceNo ='$Row_2[instanceNo]'
											";
											
					$Assign_Result = mysqli_query($pubConn,$paramSql);				
					$Assign_Row	= mysqli_fetch_array($Assign_Result);
					$prefixTG = hexdec($Assign_Row[initValue]);		
					if($prefixTG==$trunkgp)
					{
						$prefixinstNo=$Row_2[instanceNo];
						$findflag=1;
						break;
					}
				}
			}
			if($findflag==0)
			{
				$paramSql = " SELECT initValue,readValue,instanceNo FROM $msc_paramTable  
				WHERE $objWhereStr ";
				if($DEBUG) echo "paramSql=$paramSql<br>";
				$Result_2 = mysqli_query($pubConn,$paramSql);				
				while($Row_2 = mysqli_fetch_array($Result_2))
				{					
					$prefixflag=bindec(getBitValue($Row_2[initValue],'10.7-10.7'));
					if($prefixflag==0)
					{
						$findflag=1;
						break;
					}
				}												
			}
	
			if($findflag==1)
			{
				$objstrset='2.1.1';
				$objWhereStr =getLevelWhere($objstrset);				
				$updSql = "UPDATE $msc_paramTable SET initValue = '$AAS_prefix'   
				WHERE $objWhereStr AND instanceNo = '$Row_2[instanceNo]'
				";
				if($DEBUG) echo "updSql=$updSql<br>";
				mysqli_query($pubConn,$updSql);
				
				$objstrset='2.1.2';
				$objWhereStr =getLevelWhere($objstrset);				
				$paramSql = " SELECT initValue FROM paramConf  
				WHERE $objWhereStr
				";
				if($DEBUG) echo "paramSql=$paramSql<br>";
				$Result_def = mysqli_query($pubConn,$paramSql);					
				$Row_def	= mysqli_fetch_array($Result_def);
				
				$Row_def[initValue] = setBitValue($Row_def[initValue],'10.7-10.7','1');//flag on
				$Row_def[initValue] = setBitValue($Row_def[initValue],'18.0-18.0','1');//VoicePromptFlag=on
				$Row_def[initValue] = setBitValue($Row_def[initValue],'10.4-10.6','001');//emergency
				$Row_def[initValue] = setBitValue($Row_def[initValue],'10.2-10.3','00');//trunk					
				$Row_def[initValue] = setBitValue($Row_def[initValue],'11.0-11.7','08');//length=8
				$Row_def[initValue] = setBitValue($Row_def[initValue],'10.0-10.0','0');//cdr=off
				
				$setValue = strtoupper($Row_def[initValue]);
				$updSql = "UPDATE $msc_paramTable SET initValue = '$setValue'   
				WHERE $objWhereStr AND instanceNo = '$Row_2[instanceNo]'
				";
				if($DEBUG) echo "updSql=$updSql<br>";
				mysqli_query($pubConn,$updSql);	
	
				$objstrset='2.1.3';
				$objWhereStr =getLevelWhere($objstrset);				
				$paramSql = " SELECT initValue,readValue,instanceNo FROM $msc_paramTable  
										WHERE $objWhereStr AND instanceNo ='$Row_2[instanceNo]'
										";
										
				$Result = mysqli_query($pubConn,$paramSql);				
				$Row	= mysqli_fetch_array($Result);
			
	
				$HEXtrunkgp = omc_keep_length(dechex($trunkgp),0,2);		
				$Row[initValue] = strtoupper($HEXtrunkgp);
				$updSql = "UPDATE $msc_paramTable SET initValue = '$Row[initValue]'   
				WHERE $objWhereStr AND instanceNo = '$Row_2[instanceNo]'
				";
				mysqli_query($pubConn,$updSql);			
			}
		}
	}
	if(1)
	{//修改AAS_mtp3 OPC DPC NI Route   		(arwean 060223)
		$aas_link_Db = 'OBJ_222';	
		$pub_link_Table  = 'param_99';
		$oidstr = '2.2';		
		$objWhereStr= '';
		$objWhereStr =getLevelWhere($oidstr);
				
		$paramSql = " SELECT initValue,readValue,instanceNo FROM $pub_link_Table
					WHERE $objWhereStr
					";
		$aas_Result = mysqli_query($pubConn,$paramSql);
		$aas_Row		= mysqli_fetch_array($aas_Result);			
		
		$aas_link_Table  = 'param_11';						
		$updSql = "UPDATE $aas_link_Table SET initValue = '$aas_Row[initValue]'   
								WHERE $objWhereStr AND instanceNo = '0'
								";
		mysqli_query($pubConn,$updSql);

								
		$NIoffset = array("0.0-0.0","0.1-0.1","0.2-0.2","0.3-0.3");		
		$NI_bit	= getBitValue($aas_Row[initValue],$NIoffset[$NetID]);
		$tmp = $NetID+1+$NI_bit*4;
		$oidstr = '2.3.'.$tmp;
		$objWhereStr= '';
		$objWhereStr =getLevelWhere($oidstr);
		$set_OPC = dechex($DPC);
		$set_OPC = omc_keep_length($set_OPC,0,6);
		$set_OPC = strtoupper($set_OPC);
		$updSql = "UPDATE $aas_link_Table SET initValue = '$set_OPC'
								WHERE $objWhereStr
								";
		if($DEBUG) echo "$updSql<br>";					
		mysqli_query($pubConn,$updSql);
		
		//AAS_11_pub--Linkset0
		$aas_objDB = 'OBJ_222';
		$aas_Table = 'param_11';
		$oidstr = '2.4.1';		
		$objWhereStr = getLevelWhere($oidstr);
		$getSql="SELECT initValue
				FROM $aas_Table 
				WHERE $objWhereStr AND instanceNo='0'
				";
		if($DEBUG) echo "<BR>getSql=$getSql";
		$result	=mysqli_query($pubConn,$getSql);		
		$rows	=mysqli_fetch_array($result);
				

		$tmp = omc_keep_length(dechex($WXC2PC),'0',6);
		$rows[initValue] = setBitValue($rows[initValue],'0.0-2.7',$tmp);//DPC

		$tmp = omc_keep_length(decbin($NetID),'0',2);
		$rows[initValue] = setBitValue($rows[initValue],'3.0-3.1',$tmp);//NI		

		$rows[initValue] = strtoupper($rows[initValue]);	
		
		$updflag = "UPDATE $aas_Table SET initValue = '$rows[initValue]' 
	        			WHERE $objWhereStr AND instanceNo='0'
	        			";								
	  	if($DEBUG) echo "$updflag<br>";
		mysqli_query($pubConn,$updflag);
		echo mysqli_error($pubConn);
		//AAS_11_pub--route
		$aas_objDB = 'OBJ_222';
		$aas_Table = 'param_11';
		$tmp=$NetID+1;
		$oidstr = '2.6.'.$tmp;		
		$objWhereStr = getLevelWhere($oidstr);
		$getSql="SELECT initValue
				FROM $aas_Table 
				WHERE $objWhereStr AND instanceNo='0'
				";
		if($DEBUG) echo "<BR>getSql=$getSql";
		$result	=mysqli_query($pubConn,$getSql);		
		$rows	=mysqli_fetch_array($result);
				

		$tmp = omc_keep_length(dechex($WXC2PC),'0',6);
		$rows[initValue] = setBitValue($rows[initValue],'0.0-2.7',$tmp);

		$rows[initValue] = setBitValue($rows[initValue],'3.0-3.7','00');
		
		$rows[initValue] = setBitValue($rows[initValue],'4.0-4.7','00');

		$rows[initValue] = strtoupper($rows[initValue]);	
		
		$updflag = "UPDATE $aas_Table SET initValue = '$rows[initValue]' 
	        			WHERE $objWhereStr AND instanceNo='0'
	        			";								
	  if($DEBUG) echo "$updflag<br>";
		mysqli_query($pubConn,$updflag);	
	}
	if(1)
	{//set AAS-NI-length-OPC-DPC   (arwean 060223)
		$oidstr="2.1.3";
		$objWhereStr = getLevelWhere($oidstr);
		$selSql = "select initValue from $paramTable where $objWhereStr";
		$Result = mysqli_query($pubConn,$selSql);
		echo mysqli_error($pubConn);
		$Row = mysqli_fetch_array($Result);
		
		$tmp = omc_keep_length(decbin($NetID),'0',4);
		$Row[initValue] = setBitValue($Row[initValue], "0.0-0.3", $tmp);//NI
		
		$tmp = omc_keep_length(decbin($NIbit),'0',4);
		$Row[initValue] = setBitValue($Row[initValue], "0.4-0.7", $tmp);//length
		
		$tmp = omc_keep_length(dechex($DPC),'0',6);
		$Row[initValue] = setBitValue($Row[initValue], "1.0-3.7", $tmp);//OPC
		
		$tmp = omc_keep_length(dechex($WXC2PC),'0',6);//DPC
		$Row[initValue] = setBitValue($Row[initValue], "4.0-6.7", $tmp);//DPC
		
		$updflag = "UPDATE $paramTable SET initValue = '$Row[initValue]' 
	        			WHERE $objWhereStr
	        			";								
		mysqli_query($pubConn,$updflag);
		echo mysqli_error($pubConn);			
	}
	if(1)
	{//SCF-- GTT table 		(arwean 060224)
		$sccp_objDB = 'OBJ_223';
		$tmpTable = 'param_11';
		$oidstr = '2.2';		
		$objWhereStr = getLevelWhere($oidstr);
		$getSql="SELECT initValue
				FROM $tmpTable 
				WHERE $objWhereStr AND instanceNo='0'
				";
		if($DEBUG) echo "<BR>getSql=$getSql";
		$result	=mysqli_query($pubConn,$getSql);		
		$rows	=mysqli_fetch_array($result);
		
		$rows[initValue] = setBitValue($rows[initValue],'0.0-0.7','01');//flag
		$rows[initValue] = setBitValue($rows[initValue],'01.0-01.7','01');//MSISDN
		$tmp = omc_keep_length($SCF_num,'F',20,0);
		$rows[initValue] = setBitValue($rows[initValue],'03.0-12.7',$tmp);//SCF number 
		$rows[initValue] = setBitValue($rows[initValue],'13.0-22.7',$tmp);//SCF number
		$tmp = omc_keep_length($NetID,'0',2);
		$rows[initValue] = setBitValue($rows[initValue],'23.0-23.7',$tmp);//NI
		$tmp = omc_keep_length(dechex($WXC2PC),'0',6);
		$rows[initValue] = setBitValue($rows[initValue],'24.0-26.7',$tmp);//DPC WXC2sp		
		$tmp = dechex(147);
		$rows[initValue] = setBitValue($rows[initValue],'27.0-27.7',$tmp);//SSN=147
		$rows[initValue] = strtoupper($rows[initValue]);
		 
		$updflag = "UPDATE $tmpTable SET initValue = '$rows[initValue]' 
	        			WHERE $objWhereStr AND instanceNo='0'
	        			";								
	  if($DEBUG) echo "<br>$updflag<br>";
		mysqli_query($pubConn,$updflag);
		echo mysqli_error($pubConn);					
	}	
	if(1)
	{//CIC0 =0 				(arwean 060224)
			$CIC_0 =0;
			$tmp = dechex($CIC_0);
			$tmp = omc_keep_length($tmp,'0',2);
			$oidstr = "2.1.8";
			$objWhereStr = getLevelWhere($oidstr);
			$updflag = "UPDATE $paramTable SET initValue = '$tmp' 
		        			WHERE $objWhereStr AND instanceNo = '0'
		        			";								
		  if($DEBUG) echo "$updflag<br>";
			mysqli_query($pubConn,$updflag);		
			echo mysqli_error($pubConn);
	}
	if(1)
	{//CIC1 =32 			(arwean 060224)
			$CIC_1 =32;			
			$tmp = dechex($CIC_1);
			$tmp = omc_keep_length($tmp,'0',2);
			$oidstr = "2.1.8";
			$objWhereStr = getLevelWhere($oidstr);
			$updflag = "UPDATE $paramTable SET initValue = '$tmp' 
		        			WHERE $objWhereStr AND instanceNo = '1'
		        			";								
		  if($DEBUG) echo "$updflag<br>";
			mysqli_query($pubConn,$updflag);		
			echo mysqli_error($pubConn);
	}
	if(0)
	{//Announcement option
		$announce_sysId = '322_99_99';
		$announce_sysIdArr	= explode('_',$announce_sysId);
		$announce_sysTypeNo	= $announce_sysIdArr[0];
		$announce_sysNo		= $announce_sysIdArr[1];
		$announce_subSysNo		= $announce_sysIdArr[2];
		$announce_oidstr = '2.1.6';
		$announce_objWhereStr =getLevelWhere($announce_oidstr);
		
		$announce_objDb		= 'OBJ_'.$announce_sysTypeNo;
		$announce_paramTable = 'param_'.$announce_sysNo;
	
		$announce_paramSql = " SELECT initValue,readValue,instanceNo FROM $announce_paramTable  
					WHERE $announce_objWhereStr
					";
		$Result  = mysqli_query($pubConn,$announce_paramSql);				
		$Row		 = mysqli_fetch_array($Result);
		$tmpInitValue =$tmp."02020202020202020202020202020202";
		$tmpInitValue = strtoupper($tmpInitValue);	
		$announce_updflag = "UPDATE $announce_paramTable SET initValue = '$tmpInitValue' 
	        			WHERE $announce_objWhereStr
	        			";								
	  if($DEBUG) echo "$announce_updflag<br>";
		mysqli_query($pubConn,$announce_updflag);
		echo mysqli_error($pubConn);
	}
}
?>

</form>
</body>
</html>
