<?php
/*********************************************************      
 程序说明：         
    功能说明：Peripheral状态显示
    调用关系：调用: header.inc     
              被调用:      
    变量说明：
	返回值：无
	作者：     
      
修改注释：      
NO.1      
姓名：            
时间：      
修改说明：      
*********************************************************/  
require("../../inc/header.inc");
$helpId = "1.2.3"; 
$DEBUG=0;

$db=$omc_db;
$dueDate = date("Y-m-d H:i:s",mktime(date("H"),date("i"),date("s")-$heatbeat_overtime,date("m"),date("d"),date("Y")));
$sort_field="subSysNo";
$sys_id	= isset($sys_id)?$sys_id:'all';
$tSysType=omc_sys_id_info($sys_id,sys_type);
$tSubSysNum=get_subsys_total($tSysType);
$tSysTypeNo=omc_sys_type2code($sys_id);
$tSysNo=omc_sys_id_info($sys_id,sys_num);

//$ttlSysArr = array("VPS","CNF","IWF","PCR-R2-31J");
$ttlSysArr = array("VPS","CNF","PCR-R2-31J");
$ttlNum = sizeof($ttlSysArr);

//clear heartbeat
if($clear){
	$delSql = " Delete FROM OMC_PUB.sysStat WHERE 
				sysTypeNo='120' OR sysTypeNo='130' OR sysTypeNo='140' 
				OR sysTypeNo='160' OR sysTypeNo='280'";
	//echo "<br>delSql=$delSql";
	$delRes = @mysqli_query($pubConn,$delSql);
	echo mysqli_error($pubConn);
}

$selSql="SELECT sysTypeNo,sysNo,subSysNo,detailStat,updateTime FROM $sysStat_table 
			  WHERE 
			  sysTypeNo='120' OR sysTypeNo='130' OR sysTypeNo='140' OR sysTypeNo='160' OR sysTypeNo='280'
			 ";
if($DEBUG) echo "<br>selSql=$selSql";
$selRes=mysqli_query($pubConn,$selSql);
$selRow=@mysqli_fetch_array($selRes);
echo mysqli_error($pubConn);

$arrayName=array(
		array('num' => '0',  'remark' => $strStatus,			'color' => '#000000'),
		array('num' => '1',  'remark' => $strType,				'color' => '#000000'),
		array('num' => '2',  'remark' => $strE1InstalledOrNot,	'color' => '#000000'),
		array('num' => '3',  'remark' => $strPhysicalLayer,		'color' => '#000000'),
		array('num' => '4',  'remark' => $strTransportLayer,	'color' => '#000000'),
		array('num' => '5',  'remark' => $strE1CHUse,			'color' => '#000000'),
		array('num' => '6',  'remark' => $strCPULoad,			'color' => '#000000'),
		array('num' => '7',  'remark' => $strMasterClock,		'color' => '#000000'),
		array('num' => '8',  'remark' => $strVersion,			'color' => '#000000')

);
//begin bit
$typ_bgn	=	18;	//subsys type
$ver_bgn	=	19;	//version
$ins_bgn	=	20;	//e1 installed
$chu_bgn	=	21;	//E1 CH# in use/local
$cpu_bgn	=	22;	//cpu loading
$grp_bgn	=	23; //group offsest

//type num
$stat		=	0;	//status
$type		=	1;	//subsys type
$enab		=	2;	//e1 install
$phys		=	3;	//e1 layer1
$tran		=	4;	//e1 layer2
$chus		=	5;	//E1 CH# in use/local
$load		=	6;	//cpu loading
$cloc		=	7;	//send master clock
$vers		=	8;	//version
$time		=	9;	//freshtime

//subsys type
$arrayType=array(
		array('num' => '0',  'remark' => 'SS7',		'color' => '#0000FF'),
		array('num' => '1',  'remark' => 'ISDN',	'color' => '#0000FF'),
		array('num' => '2',  'remark' => 'V5',		'color' => '#0000FF'),
		array('num' => '3',  'remark' => 'R2',		'color' => '#0000FF'),
		array('num' => '4',  'remark' => 'Static',	'color' => '#0000FF'),
		array('num' => '5',  'remark' => 'CNF',		'color' => '#0000FF')

);

//e1 installed
$arrayInstall=array(
		array('num' => '0',  'remark' => '--',	'color' => '#000000'),
		array('num' => '1',  'remark' => 'Y',	'color' => '#0000FF')
);

//e1 layer1
$arrayPhysical=array(
		array('num' => '0',  'remark' => 'Y',	'color' => '#0000FF'),
		array('num' => '1',  'remark' => 'N',	'color' => '#FF0000'),
		array('num' => '2',  'remark' => '--',	'color' => '#000000')
);

//e1 layer2
$arrayTransport=array(
		array('num' => '0',  'remark' => 'N',	'color' => '#FF0000'),
		array('num' => '1',  'remark' => 'Y',	'color' => '#0000FF'),
		array('num' => '2',  'remark' => '--',	'color' => '#000000')
);

//send master clock
$arrayClock=array(
		array('num' => '0',  'remark' => '--',	'color' => '#000000'),
		array('num' => '1',  'remark' => 'Y',	'color' => '#0000FF')
);


//echo canceller status
$arrayCan=array(
		array('num' => '0',  'remark' => '--',		'color' => '#000000'),
		array('num' => '1',  'remark' => 'Y',		'color' => '#0000FF')
);

//lock status
$arrayLock=array(
		array('num' => '0',  'remark' => 'INIT',	'color' => '#0000FF'),
		array('num' => '1',  'remark' => 'SEARCH',	'color' => '#0000FF'),
		array('num' => '2',  'remark' => 'LOCK',	'color' => '#0000FF'),
		array('num' => '3',  'remark' => 'CENTER',	'color' => '#0000FF'),
		array('num' => '4',  'remark' => 'ADJUST',	'color' => '#0000FF'),
		array('num' => '5',  'remark' => 'NOREF1',	'color' => '#0000FF'),
		array('num' => '6',  'remark' => 'NOREF',	'color' => '#0000FF'),
		array('num' => '7',  'remark' => 'IDLE',	'color' => '#0000FF')
);

//master clock
$arrayMaster=array(
		array('num' => '0',  'remark' => 'Slave',		'color' => '#0000FF'),
		array('num' => '1',  'remark' => 'Master',		'color' => '#0000FF')
);

do{
	$no_basic_status=0;
	$sysTypeNo = $selRow[sysTypeNo];
	$sysNo = $selRow[sysNo];
	$subSysNo = $selRow[subSysNo];

	if($sysTypeNo == 120){
		$sysTypeNo = 0;
	}elseif($sysTypeNo == 160){
		$sysTypeNo = 1;
	}elseif($sysTypeNo == 280){
		$sysTypeNo = 2;
	}

	if($selRow)
		$showSysArr[$sysTypeNo][$sysNo] = 1;	

	if($DEBUG)echo "<br>showSysArr[$sysTypeNo][$sysNo]={$showSysArr[$sysTypeNo][$sysNo]}";

	$hex_mes=$selRow[detailStat];
	if($DEBUG) echo "<br>hex_mes=$hex_mes";
	$refresh_time=$selRow[updateTime];
	if($refresh_time>$dueDate){
		$color_refresh_time="#0000FF";
	}else{
		$color_refresh_time="#FF0000";
		$no_basic_status=1;
	}
	
	$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$time][value]=$refresh_time;
	$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$time][color]=$color_refresh_time;
	if($DEBUG) echo "<br>time value={$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$time][value]}";
	if($DEBUG) echo "<br>time color={$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$time][color]}";

	$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";

	//subsys type
	$bin_typ=substr($bin_mes,$typ_bgn*8,8);
	$dec_typ=BinDec($bin_typ);
	$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$type][value]=$arrayType[$dec_typ][remark];
	$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$type][color]=$arrayType[$dec_typ][color];
	if($selTypeNo == 2){
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo-4][$type][value]="ISUP";
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo-4][$type][color]=$arrayType[$dec_typ][color];
	}
	if($DEBUG) echo "<br>type value={$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$type][value]}";
	if($DEBUG) echo "<br>type color={$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$type][color]}";
	//type num

	//version
	$bin_ver=substr($bin_mes,$ver_bgn*8,8);
	$dec_ver=BinDec($bin_ver);
	$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$vers][value]=DecHex($dec_ver);
	$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$vers][color]="#0000FF";
	if($DEBUG) echo "<br>version value={$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$vers][value]}";
	if($DEBUG) echo "<br>version color={$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$vers][color]}";

	//e1 installed
	$bin_ins=substr($bin_mes,$ins_bgn*8+7,1);
	$dec_ins=BinDec($bin_ins);
	if($selTypeNo == 2){
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo-4][$enab][value]=$arrayInstall[$dec_ins][remark];
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo-4][$enab][color]=$arrayInstall[$dec_ins][color];
	}else{
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$enab][value]=$arrayInstall[$dec_ins][remark];
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$enab][color]=$arrayInstall[$dec_ins][color];
	}

	if($DEBUG) echo "<br>install value={$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$enab][value]}";
	if($DEBUG) echo "<br>install color={$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$enab][color]}";

	//e1 layer1
	$bin_phy=substr($bin_mes,$ins_bgn*8+6,1);
	$dec_phy=BinDec($bin_phy);
	if($dec_ins==0){
		$dec_phy=2;
	}
	if($dec_phy==1){
		$no_basic_status=1;
	}
	if($selTypeNo == 2){
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo-4][$phys][value]=$arrayPhysical[$dec_phy][remark];
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo-4][$phys][color]=$arrayPhysical[$dec_phy][color];
	}else{
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$phys][value]=$arrayPhysical[$dec_phy][remark];
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$phys][color]=$arrayPhysical[$dec_phy][color];
	}
	if($DEBUG) echo "<br>layer1 value={$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$phys][value]}";
	if($DEBUG) echo "<br>layer1 color={$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$phys][color]}";


	//e1 layer2
	$bin_tra=substr($bin_mes,$ins_bgn*8+5,1);
	$dec_tra=BinDec($bin_tra);
	if($dec_ins==0){
		$dec_tra=2;
	}
	if($dec_tra==0){
		$no_basic_status=1;
	}
	if($selTypeNo == 2){
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo-4][$tran][value]=$arrayTransport[$dec_tra][remark];
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo-4][$tran][color]=$arrayTransport[$dec_tra][color];
	}else{
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$tran][value]=$arrayTransport[$dec_tra][remark];
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$tran][color]=$arrayTransport[$dec_tra][color];
	}
	if($DEBUG) echo "<br>layer2 value={$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$tran][value]}";
	if($DEBUG) echo "<br>layer2 color={$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$tran][color]}";

	//send master clock
	$bin_clk=substr($bin_mes,$ins_bgn*8+4,1);
	$dec_clk=BinDec($bin_clk);
	if($selTypeNo == 2){
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo-4][$cloc][value]=$arrayClock[$dec_clk][remark];
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo-4][$cloc][color]=$arrayClock[$dec_clk][color];
	}else{
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$cloc][value]=$arrayClock[$dec_clk][remark];
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$cloc][color]=$arrayClock[$dec_clk][color];
	}
	if($DEBUG) echo "<br>clock value={$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$cloc][value]}";
	if($DEBUG) echo "<br>clock color={$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$cloc][color]}";

	//E1 CH# in use/local
	$bin_chu=substr($bin_mes,$chu_bgn*8,8);
	if($selTypeNo == 2){
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo-4][$chus][value]=BinDec($bin_chu)." / 30";
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo-4][$chus][color]="#0000FF";
	}else{
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$chus][value]=BinDec($bin_chu)." / 30";
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$chus][color]="#0000FF";
	}
	if($DEBUG) echo "<br>ch value={$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$chus][value]}";
	if($DEBUG) echo "<br>ch color={$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$chus][color]}";

	//cpu loading
	$bin_cpu=substr($bin_mes,$cpu_bgn*8,8);
	$dec_cpu=BinDec($bin_cpu);
	if($selTypeNo == 2){
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo-4][$load][value]=($dec_cpu*3.34)."%";
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo-4][$load][color]="#0000FF";
	}else{
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$load][value]=($dec_cpu*3.34)."%";
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$load][color]="#0000FF";
	}
	if($DEBUG) echo "<br>cpu value={$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$load][value]}";
	if($DEBUG) echo "<br>cpu color={$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$load][color]}";

	if($no_basic_status){
		$bStatusArr[$sysTypeNo][$sysNo][$subSysNo] = 1;
		$basic_status="N";
		$basic_status_color="FF0000";
	}else{
		$basic_status="Y";
		$basic_status_color="0000FF";
	}
	if($selTypeNo == 2 || $sysTypeNo == 2){
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$stat][value]=$basic_status;
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$stat][color]=$basic_status_color;

		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo-4][$stat][value]=$basic_status;
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo-4][$stat][color]=$basic_status_color;
	}else{
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$stat][value]=$basic_status;
		$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$stat][color]=$basic_status_color;
	}
	if($DEBUG) echo "<br>arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$stat][value]={$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$stat][value]}";
	if($DEBUG) echo "<br>arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$stat][color]={$arrayTotal[$sysTypeNo][$sysNo][$subSysNo][$stat][color]}";
	
	if($sysTypeNo == 2){
		$hex_grp = substr($hex_mes,$grp_bgn*2,2);
		$grpNum = HexDec($hex_grp);
		//echo "<br>grpNum=$grpNum";

		for($i=0;$i<5;$i++){
			for($j=0;$j<2;$j++){
				$grpNo = $i*2+$j;
				$userNum[$sysNo][$grpNum][$grpNo] = HexDec(substr($hex_mes,($grp_bgn+1+$i)*2+1-$j,1));
				//echo "<br>userNum[$sysNo][$grpNum][$grpNo]={$userNum[$sysNo][$grpNum][$grpNo]}";
			}
		}
	}
}while($selRow=@mysqli_fetch_array($selRes));

for($i=0;$i<4;$i++){
	$sysNum = get_sys_total($ttlSysArr[$i]);	
	for($j=0;$j<$sysNum;$j++){
		for($k=0;$k<8;$k++){
			if($bStatusArr[$i][$j][$k])  
				$showStatus[$i][$j] = 1;  		
		}
		if($showSysArr[$i][$j]){
			if($showStatus[$i][$j]){
				$showStatusArr[$i][$j][0] = "N";
				$showStatusArr[$i][$j][1] = "#FF0000";
			}else{
				$showStatusArr[$i][$j][0] = "Y";
				$showStatusArr[$i][$j][1] = "#0000FF";
			}
		}
	}
}

//get pcr8 status
$pcr8Sql = " SELECT sysTypeNo,sysNo,subSysNo,detailStat,updateTime FROM $sysStat_table 
		     WHERE 
		     sysTypeNo='130'
		   ";
if($DEBUG) echo "<br>pcr8Sql=$pcr8Sql";
$pcr8Res=mysqli_query($pubConn,$pcr8Sql);
$pcr8Row=@mysqli_fetch_array($pcr8Res);
echo mysqli_error($pubConn);

//begin bit
$ver_bgn	=	18;	//version
$typ_bgn	=	21;	//subsys type
$ins_bgn	=	22;	//e1 installed
$inl_bgn	=   23; //e1 layer2 installed
$phy_bgn	=	24;	//e1 layer1(physical layer)
$tra_bgn	=	25;	//e1 layer1(transport layer)
$can_bgn	=	26;	//echo canceller status
$cpu_bgn	=	27;	//cpu loading
$loc_bgn	=	28;	//lock status
$fre_bgn	=	29;	//frequency
$pow_bgn	=	30;	//power card and master clock
$pra_bgn	=	31; //E1 FRAMER status
do{
	$sysNo = $pcr8Row[sysNo];
	$subSysNo = $pcr8Row[subSysNo];
	$hex_mes = $pcr8Row[detailStat];
	//echo "<br>hex_mes=$hex_mes";

	if(!$pcr8Row){
		break;
	}
	
	$showPcr8SysArr[$sysNo] = 1;	
	$showPcr8SubArr[$sysNo][$subSysNo] = 1;

	$refreshTime[$sysNo][$subSysNo][0] = $pcr8Row[updateTime];
	if($refreshTime[$sysNo][$subSysNo][0] > $dueDate){
		$refreshTime[$sysNo][$subSysNo][1] = "#0000FF";
	}else{
		$refreshTime[$sysNo][$subSysNo][1] = "#FF0000";
		$noBasicStatus[$sysNo][$subSysNo]=1;
	}

	$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";

	//version
	$bin_ver_0=substr($bin_mes,$ver_bgn*8,8);
	$dec_ver_0=BinDec($bin_ver_0);
	
	$bin_ver_1=substr($bin_mes,($ver_bgn+1)*8,8);
	$dec_ver_1=BinDec($bin_ver_1);
	$dec_ver_1=omc_keep_length($dec_ver_1,0,2);

	$bin_ver_2=substr($bin_mes,($ver_bgn+2)*8,8);
	$dec_ver_2=BinDec($bin_ver_2);
	$dec_ver_2=omc_keep_length($dec_ver_2,0,2);

	$versionArr[$sysNo][$subSysNo][0] = $version = $dec_ver_0.".".$dec_ver_1.".".$dec_ver_2;
	$versionArr[$sysNo][$subSysNo][1] = $color_version = "#0000FF";
	$verNum[$sysNo] = $subSysNo;
	if($DEBUG) echo "<br>verNum[$sysNo]=$verNum[$sysNo]";
	if($DEBUG) echo "<br>versionArr[$sysNo][$subSysNo][0]={$versionArr[$sysNo][$subSysNo][0]}";

	//subsys type
	$bin_typ = substr($bin_mes,$typ_bgn*8,8);
	$subTypeArr[$sysNo][$subSysNo][0] = $dec_typ = BinDec($bin_typ);
	if($DEBUG) echo "<br>subTypeArr[$sysNo][$subSysNo][0] = {$subTypeArr[$sysNo][$subSysNo][0]}";

	//e1 install
	for($i=0;$i<8;$i++){
		$bin_ins=substr($bin_mes,$ins_bgn*8+7-$i,1);
		$eInstallArr[$sysNo][$subSysNo][$i]=BinDec($bin_ins);
		if($DEBUG) echo "<br>eInstallArr[$sysNo][$subSysNo][$i]={$eInstallArr[$sysNo][$subSysNo][$i]}";
	}

	//e1 layer2 install
	for($i=0;$i<8;$i++)
	{
		$bin_inl=substr($bin_mes,$inl_bgn*8+7-$i,1);
		$eL2InsArr[$sysNo][$subSysNo][$i]=BinDec($bin_inl);
		if($DEBUG) echo "<br>eL2InsArr[$sysNo][$subSysNo][$i]={$eL2InsArr[$sysNo][$subSysNo][$i]}";
	}

	//e1 layer1
	for($i=0;$i<8;$i++){
		$bin_phy=substr($bin_mes,$phy_bgn*8+7-$i,1);
		$eL1StatusArr[$sysNo][$subSysNo][$i] = BinDec($bin_phy);
		if($DEBUG) echo "<br>eL1StatusArr[$sysNo][$subSysNo][$i]={$eL1StatusArr[$sysNo][$subSysNo][$i]}";
		if($eInstallArr[$sysNo][$subSysNo][$i] == 0){
			$eL1StatusArr[$sysNo][$subSysNo][$i]=2;
		}

		if($eL1StatusArr[$sysNo][$subSysNo][$i] == 1){
			$noBasicStatus[$sysNo][$subSysNo]=1;
		}
	}

	//e1 layer2
	for($i=0;$i<8;$i++)
	{
		$bin_tra=substr($bin_mes,$tra_bgn*8+7-$i,1);
		$eL2StatusArr[$sysNo][$subSysNo][$i]=BinDec($bin_tra);
		if($eInstallArr[$sysNo][$subSysNo][$i] == 0 || $eL2InsArr[$sysNo][$subSysNo][$i] == 0){
			$eL2StatusArr[$sysNo][$subSysNo][$i]=2;
		}
		if($DEBUG) echo "<br>eL2StatusArr[$sysNo][$subSysNo][$i]={$eL2StatusArr[$sysNo][$subSysNo][$i]}";
		if($eL2StatusArr[$sysNo][$subSysNo][$i] == 0){
			$noBasicStatus[$sysNo][$subSysNo]=1;
		}
	}

	//echo canceller status
	for($i=0;$i<8;$i++)
	{
		$bin_can=substr($bin_mes,$can_bgn*8+7-$i,1);
		$canStatusArr[$sysNo][$subSysNo][$i]=BinDec($bin_can);
		if($eInstallArr[$sysNo][$subSysNo][$i] == 0){
			$canStatusArr[$sysNo][$subSysNo][$i] = 0;
		}
		if($DEBUG) echo "<br>canStatusArr[$sysNo][$subSysNo][$i]={$canStatusArr[$sysNo][$subSysNo][$i]}";
	}

	//cpu loading
	$bin_cpu=substr($bin_mes,$cpu_bgn*8,8);
	$dec_cpu=BinDec($bin_cpu);
	if($DEBUG) echo "<br>dec_cpu=$dec_cpu";

	$cpu_load=change2point($dec_cpu/126);
	if($cpu_load>100){
		$cpu_load=100;
	}
	elseif($cpu_load<0){
		$cpu_load=0;
	}
	if($DEBUG) echo "<br>cpu_load=$cpu_load";
	if($cpu_load>90){
		$noBasicStatus[$sysNo][$subSysNo] = 1;
		$cpuLoadArr[$sysNo][$subSysNo][1] = "#FF0000";
	}else{
		$cpuLoadArr[$sysNo][$subSysNo][1] = "#0000FF";
	}
	$cpuLoadArr[$sysNo][$subSysNo][0] = $cpu_load."%";

	//lock status
	$bin_loc = substr($bin_mes,$loc_bgn*8,8);
	$lockStatusArr[$sysNo][$subSysNo] = BinDec($bin_loc);
	if($DEBUG) echo "<br>lockStatusArr[$sysNo][$subSysNo]={$lockStatusArr[$sysNo][$subSysNo]}";

	//frequency
	$bin_fre=substr($bin_mes,$fre_bgn*8,8);
	$dec_fre=BinDec($bin_fre);
	$freqArr[$sysNo][$subSysNo][0] = omc_keep_length($dec_fre,0,3);
	if($dec_loc==7){
		$freqArr[$sysNo][$subSysNo][0] = '--';
		$freqArr[$sysNo][$subSysNo][1] = "#000000";
	}else{
		$freqArr[$sysNo][$subSysNo][1] = "#0000FF";
	}
	if($DEBUG) echo "<br>freqArr[$sysNo][$subSysNo][0]={$freqArr[$sysNo][$subSysNo][0]}";

	//master clock
	$bin_mas = substr($bin_mes,$pow_bgn*8+7,1);
	$masClockArr[$sysNo][$subSysNo] = BinDec($bin_mas);
	if($DEBUG) echo "<br>masClockArr[$sysNo][$subSysNo]=$masClockArr[$sysNo][$subSysNo]";
}while($pcr8Row = @mysqli_fetch_array($pcr8Res));

$pcr8Num = get_sys_total('PCR');
for($i=0;$i<$pcr8Num;$i++){
	for($j=0;$j<16;$j++){
		if($noBasicStatus[$i][$j]){
			$showPcr8[$i] = 1;
			$showSubArr[$i][$j][0] = "N";
			$showSubArr[$i][$j][1] = "#FF0000";
		}else{
			$showSubArr[$i][$j][0] = "Y";
			$showSubArr[$i][$j][1] = "#0000FF";
		}
	}

	if($showPcr8SysArr[$sysNo]){
		if($showPcr8[$i]){
			$showPcr8Arr[$i][0] = "N";
			$showPcr8Arr[$i][1] = "#FF0000";
		}else{
			$showPcr8Arr[$i][0] = "Y";
			$showPcr8Arr[$i][1] = "#0000FF";
		}
	}
}
?>
<body topmargin="5" leftmargin="12">
<?php
echo "<table border=\"0\" width=\"100%\">";
echo "<tr>";
echo "<td width=\"50%\">";
echo "$strSysStatus > $strCentralOffice > $strPeripheral";
echo "</td>";
echo "<td width=\"50%\" align=\"right\" title=\"Help\">";
showHelp($helpId);
echo "</td>";
echo "</tr>";
echo "</table>";
$old_sys_id = $sys_id;
//echo "sys_id=$sys_id,selTypeNo=$selTypeNo<br>";
if($sys_id == 'all'){
	echo "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"1\"><tr><td><p align=\"center\"><font color=\"#0000FF\" size=\"2\">$strPeripheral</font></p></td></tr></table>";   
	echo "<table borderColor=\"#666666\" cellSpacing=\"0\" borderColorDark=\"#ffffff\" cellPadding=\"1\" width=\"100%\" bgColor=\"#ffffff\" border=\"1\">"; 
	echo "<tbody>"; 
    echo "<tr bgColor=\"#e6e6e6\">"; 
    echo "<td width=\"85\" rowSpan=\"2\">$strItem</td>"; 
    echo "<td width=\"40\" rowSpan=\"2\">$strBasicStatus</td>";
    echo "<td width=\"551\" colSpan=\"16\">"; 
    echo "<p align=\"center\">$strSubsystemID</p>"; 
    echo "</td>"; 
    echo "</tr>"; 
    echo "<tr bgColor=\"#e6e6e6\">"; 
	for ( $i=0; $i<16; $i++ ){
		echo "<td colspan=\"1\" width=\"38\">$i</td>"; 
	}
    echo "</tr>";

	for($i=0;$i<$ttlNum;$i++){
		if($DEFAULT_SYS=='SN' && $ttlSysArr[$i]!='VPS'){
			continue;
		}
		if($ttlSysArr[$i]=='VPS')
			continue;

		$tmpSql = " SELECT * FROM elementExistConf WHERE  elementName='$ttlSysArr[$i]' AND existFlag='1'";
		if($DEBUG)	
		echo "<br>tmpSql=$tmpSql";
		$tmpRes = mysqli_query($pubConn,$tmpSql);
		if(mysqli_num_rows($tmpRes)<=0)
			continue;

		$sysNum = get_sys_total($ttlSysArr[$i]);
		for($j=0;$j<$sysNum;$j++){
			if($j == $sysNum-1 && $i == $ttlNum-1){
				$colNum = 1;
			}else{
				$colNum = 1;
			}
			echo "<tr>";
			$sys_id = $ttlSysArr[$i]."_".$j;
			echo "<td><a href=\"$SELF_PHP?sys_id=$sys_id&selTypeNo=$i\">$ttlSysArr[$i]_$j</a></td>";
			if($showSysArr[$i][$j]){
				echo "<td><font color=\"{$showStatusArr[$i][$j][1]}\">{$showStatusArr[$i][$j][0]}</font></td>";
				for($k=0;$k<16;$k++){
					if(isset($arrayTotal[$i][$j][$k][$stat][value])){
						echo "<td colspan=\"$colNum\"><font color=\"{$arrayTotal[$i][$j][$k][$stat][color]}\">{$arrayTotal[$i][$j][$k][$stat][value]}</font></td>";
					}else{
						echo "<td colspan=\"$colNum\">--</td>";
					}
				}
			}else{
				echo "<td>--</td>";
				for($p=0; $p<16; $p++){
					echo "<td>--</td>";
				}
			}
			echo "</tr>";
		}
	}
	$tmpSql = " SELECT * FROM elementExistConf WHERE  elementName='PCR' AND existFlag='1'";
	if($DEBUG)	
	echo "<br>tmpSql=$tmpSql";
	$tmpRes = mysqli_query($pubConn,$tmpSql);
	if(mysqli_num_rows($tmpRes)>0)
	{
		//show pcr8
		for($j=0;$j<$pcr8Num;$j++){
			echo "<tr>";
			$sys_id = 'PCR_'.$j;
			echo "<td><a href=\"$SELF_PHP?sys_id=$sys_id&selTypeNo=130\">$sys_id</a></td>";
			if($showPcr8SysArr[$j]){
				echo "<td><font color=\"{$showPcr8Arr[$j][1]}\">{$showPcr8Arr[$j][0]}</font></td>";
				for($k=0;$k<16;$k++){
					if(isset($showPcr8SubArr[$j][$k])){
						echo "<td><font color=\"{$showSubArr[$j][$k][1]}\">{$showSubArr[$j][$k][0]}</font></td>";
					}else{
						echo "<td>--</td>";
					}
				}

			}else{
				echo "<td>--</td>";
				for($p=0; $p<16; $p++){
					echo "<td>--</td>";
				}
			}
			echo "</tr>";
		}
	}
	echo "</tbody>"; 
	echo "</table>"; 
 
 
	echo "</table>";    
	echo "</td></tr></table>";
	echo "<table border=\"0\" width=\"100%\">";  
	echo "<tr>";  
	echo "<td>";  
	echo "<p align=\"left\">$strRemark:&nbsp;&nbsp;<font color=\"#0000FF\">Y</font> = $strNormal, &nbsp; &nbsp;<font color=#FF0000>N</font> = $strAbnormal,&nbsp; &nbsp;-- = $strNothing.</td>";     
	echo "<td>";              
	echo "<p align=\"right\"><a href=\"$returnRoute\" target=\"contents\"><img align=absBottom border=0 src=\"../../images/left.gif\" width=\"14\" height=\"14\">$strBack</a>";
	echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
	echo "<a href=\"$PHP_SLEF?clear=1\" target=\"_self\"><img align=absBottom border=0 src=\"../../images/delete.gif\" width=\"14\" height=\"14\">$strClear</a>";
	echo "</p>";      
	echo "</td>";    
	echo "</tr>";   
	echo "</table>";
	echo "<meta http-equiv=\"refresh\" content=\"10 url=$PHP_SELF?sys_id=$old_sys_id&selTypeNo=$selTypeNo\">";
	exit();
}//end if ($sys_id == 'all')
elseif($selTypeNo == '130'){
	$paneNum = explode("_",$sys_id);
	$sysCode = $paneNum[1];

	echo "<table border=\"0\" width=\"600\">";
	echo "<tr><td width=\"100%\"><p align=\"center\"><font color=\"#0000FF\" size=\"2\"> PCR_$sysCode&nbsp; $strStatusInfo</font></p></td>";
	echo "<tr><td width=\"100%\" height=\"1\">";
	echo "<table border=\"1\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666666\"  bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">"; 

	echo "<tr bgcolor=\"#E6E6E6\"><td width=\"64\" height=\"15\" bgcolor=\"#FFFFFF\">ID</td><td width=\"191\" height=\"15\" bgcolor=\"#FFFFFF\" align=\"center\">$strBasicStatus</td>";
	echo "<td width=\"266\" height=\"15\" bgcolor=\"#FFFFFF\" align=\"center\">$strRefreshTime</td>";
	echo "<td width=\"266\" height=\"15\" bgcolor=\"#FFFFFF\" align=\"center\">$strClockStatus</td>";
	echo "<td width=\"266\" height=\"15\" bgcolor=\"#FFFFFF\" align=\"center\">$strPCM2MClockPhaseStatus</td>";
	echo "<td width=\"266\" height=\"15\" bgcolor=\"#FFFFFF\" align=\"center\">$strVersion</td>";
	//echo "<td width=\"266\" height=\"15\" bgcolor=\"#FFFFFF\" align=\"center\">$strClockReference</td>";
	echo "</tr>";
	for($i=0;$i<16;$i++){
		$showId = omc_keep_length($i,0,2);
		echo "<tr><td width=\"64\"  bgcolor=\"#FFFFFF\">$showId</td>";
		if($showPcr8SubArr[$sysCode][$i]){
			echo "<td width=\"191\"  bgcolor=\"#FFFFFF\">";
			if($noBasicStatus[$sysCode][$i])
				echo "<font color=\"#FF0000\">Error</font>";
			else
				echo "<font color=\"#0000FF\">Normal</font>";
			echo "</td>";

			echo "<td width=\"266\"  bgcolor=\"#FFFFFF\">";
			if($showPcr8SubArr[$sysCode][$i])
				echo "<font color=\"{$refreshTime[$sysCode][$i][1]}\">{$refreshTime[$sysCode][$i][0]}</font>";
			echo "</td>";
		
			echo "<td width=\"266\"  bgcolor=\"#FFFFFF\">";
			echo "<font color=\"{$arrayMaster[$masClockArr[$sysCode][$i]][color]}\">{$arrayMaster[$masClockArr[$sysCode][$i]][remark]}</font>";
			echo "</td>";

			echo "<td width=\"266\"  bgcolor=\"#FFFFFF\">";
			echo "<font color=\"{$arrayLock[$lockStatusArr[$sysCode][$i]][color]}\">{$arrayLock[$lockStatusArr[$sysCode][$i]][remark]}</font>";
			echo "</td>";

			echo "<td width=\"266\"  bgcolor=\"#FFFFFF\">";
			echo "<font color=\"{$versionArr[$sysNo][$subSysNo][1]}\">{$versionArr[$sysNo][$subSysNo][0]}</font>";
			echo "</td>";
			
		}else{
			echo "<td>--</td>";
			echo "<td>--</td>";
			echo "<td>--</td>";
			echo "<td>--</td>";
			echo "<td>--</td>";
			//echo "<td>--</td>";

		}
		echo "</tr>";
	}		
	echo "</table></td>";
	echo "</tr>";
					
	echo "<tr><td width=\"100%\"><p align=\"center\"><font color=\"#0000FF\" size=\"2\">PCR_$sysCode E1 Status</font></p></td><td width=\"7\"></td>";
	echo "</tr>";      
		
	echo "<tr><td width=\"100%\">"; 
	echo "<table border=\"1\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666666\"  bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">"; 
	echo "</tr>";
	for($i=0;$i<128;$i++){
		if($i % 8 == 0){	
			echo "<tr bgcolor=\"#C0C0C0\">"; 
			echo "<td width=\"31\" height=\"15\" align=\"left\">Slot</td>";
			echo "<td width=\"31\" height=\"15\" align=\"left\">Port</td>";
			echo "<td width=\"31\" height=\"15\" align=\"left\" title=\"Enable\">EN</td>";
			echo "<td width=\"31\" height=\"15\" align=\"left\" title=\"Physical layer\">L1</td>";
			echo "<td width=\"31\" height=\"15\" align=\"left\" title=\"Transport\">L2</td>";
			echo "<td width=\"31\" height=\"15\" align=\"left\" title=\"Echo canceller\">EC</td>";
			echo "</tr>";
		}
		
		$slotNum = floor($i/8);
		$portNum = $i%8;
		echo "<tr>"; 
		echo "<td>$slotNum</td>";
		echo "<td>$portNum</td>";
		if($showPcr8SubArr[$sysCode][$slotNum]){
			echo "<td title=\"Enable\"><font color=\"{$arrayInstall[$eInstallArr[$sysCode][$slotNum][$portNum]][color]}\">{$arrayInstall[$eInstallArr[$sysCode][$slotNum][$portNum]][remark]}</font></td>";
			echo "<td title=\"Physical layer\"><font color=\"{$arrayPhysical[$eL1StatusArr[$sysCode][$slotNum][$portNum]][color]}\">{$arrayPhysical[$eL1StatusArr[$sysCode][$slotNum][$portNum]][remark]}</font></td>";
			echo "<td title=\"Physical layer\"><font color=\"{$arrayTransport[$eL2StatusArr[$sysCode][$slotNum][$portNum]][color]}\">{$arrayTransport[$eL2StatusArr[$sysCode][$slotNum][$portNum]][remark]}</font></td>";
			echo "<td title=\"Physical layer\"><font color=\"{$arrayCan[$canStatusArr[$sysCode][$slotNum][$portNum]][color]}\">{$arrayCan[$canStatusArr[$sysCode][$slotNum][$portNum]][remark]}</font></td>";
		}else{
			echo "<td>--</td>";
			echo "<td>--</td>";
			echo "<td>--</td>";
			echo "<td>--</td>";
		}
		echo "</tr>";

	}
	echo "</table>";    
	echo "</td>";
	echo "<td width=\"9\"></td>";
	echo "</tr></table>";
	echo "<table border=\"0\" width=\"725\">";  
	echo "<tr>";  
	echo "<td>";  
	echo "<p align=\"left\"><nobr>$strRemark:&nbsp;&nbsp;<font color=\"#0000FF\">Y</font> = $strNormal, &nbsp; &nbsp;<font color=#FF0000>N</font> = $strAbnormal,&nbsp; &nbsp;-- = $strNothing.</nobr></td>";     
	echo "<td>";              
	echo "<p align=\"right\"><a href=\"$returnRoute\" target=\"contents\"><img align=absBottom border=0 src=\"../../images/left.gif\" width=\"14\" height=\"14\">$strBack</a>";
	echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
	echo "<a href=\"$PHP_SLEF?clear=1\" target=\"_self\"><img align=absBottom border=0 src=\"../../images/delete.gif\" width=\"14\" height=\"14\">$strClear</a>";
	echo "</p>";      
	echo "</td>";    
	echo "</tr>";   
	echo "</table>";

	exit();
}//elseif($selTypeNo == '130') 

echo "<table border=\"0\" width=\"100%\">";  
echo "<tr>";
echo "<td width=\"50%\"><p align=\"center\"><font color=\"#0000FF\" size=\"2\">$ttlSysArr[$selTypeNo]_0 $strStatusInformation</font>";
echo "</td>";
echo "<td width=\"5\"></td>";
echo "<td width=\"50%\"><p align=\"center\"><font color=\"#0000FF\" size=\"2\">$ttlSysArr[$selTypeNo]_1 status information</font>";
echo "</td>";
echo "</tr>";   
echo "<tr>";   
echo "<td width=\"50%\">";       
echo "<table border=\"1\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666666\"  bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">";
echo "<tr bgcolor=\"#E6E6E6\">";
echo "<td width=\"115\">Subsystem ID</td>";
for($i=0;$i<8;$i++){
	echo "<td width=\"39\">";
	echo "$i";
	echo "</td>";
}
echo "</tr>";
for($i=0;$i<9;$i++){
	echo "<tr>";
	echo "<td><nobr>{$arrayName[$i][remark]}</nobr></td>";
	for($j=0;$j<8;$j++){
		if(isset($arrayTotal[$selTypeNo][0][$j][$i][value]))
			echo "<td><font color=\"{$arrayTotal[$selTypeNo][0][$j][$i][color]}\">{$arrayTotal[$selTypeNo][0][$j][$i][value]}</font></td>";
		else
			echo "<td>--</td>";
	}
	echo "</tr>";
}

echo "</table>";            
echo "</td>";
echo "<td width=\"5\"></td>";
echo "<td width=\"50%\">";       
echo "<table border=\"1\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666666\"  bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">";
echo "<tr bgcolor=\"#E6E6E6\">";
echo "<td width=\"115\">Subsystem ID</td>";
for($i=0;$i<8;$i++){
	echo "<td width=\"39\">";
	echo "$i";
	echo "</td>";
}
echo "</tr>";
for($i=0;$i<9;$i++){
	echo "<tr>";
	echo "<td><nobr>{$arrayName[$i][remark]}</nobr></td>";
	for($j=0;$j<8;$j++){
		if(isset($arrayTotal[$selTypeNo][1][$j][$i][value]))
			echo "<td><font color=\"{$arrayTotal[$selTypeNo][1][$j][$i][color]}\">{$arrayTotal[$selTypeNo][1][$j][$i][value]}</font></td>";
		else
			echo "<td>--</td>";
	}
	echo "</tr>";
}

echo "</table>";            
echo "</td>";
echo "</tr>"; 


echo "<tr>";  
echo "<td width=\"50%\"><p align=\"center\"><font color=\"#0000FF\" size=\"2\">";       
echo "$strRefreshTime</font></p></td><td width=\"5\"></td><td width=\"50%\">";       
echo "<p align=\"center\"><font color=\"#0000FF\" size=\"2\">";       
echo "$strRefreshTime</font></td>";  
echo "</tr>";  
echo "<tr>";  
echo "<td width=\"50%\">";              
echo "<table border=\"1\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">"; 
for($i=0;$i<4;$i++){
	echo "<tr>";
	for($j=0;$j<2;$j++){
		$sub_code=$i*2+$j;
		$dis_code=$sub_code;
		echo "<td width=\"10%\">$dis_code</td>";
		if(isset($arrayTotal[$selTypeNo][0][$sub_code][$time][value]))
			echo "<td width=\"40%\"><font color=\"{$arrayTotal[$selTypeNo][0][$sub_code][$time][color]}\">{$arrayTotal[$selTypeNo][0][$sub_code][$time][value]}</font></td>";
		else
			echo "<td>--</td>";
	}
	echo "</tr>";
}      
echo "</table>";       
echo "</td>";
echo "<td width=\"5\"></td>";
echo "<td width=\"50%\">";              
echo "<table border=\"1\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">"; 
for($i=0;$i<4;$i++){
	echo "<tr>";
	for($j=0;$j<2;$j++){
		$sub_code=$i*2+$j;
		$dis_code=$sub_code;
		echo "<td width=\"10%\">$dis_code</td>";
		if(isset($arrayTotal[$selTypeNo][1][$sub_code][$time][value]))
			echo "<td width=\"40%\"><font color=\"{$arrayTotal[$selTypeNo][1][$sub_code][$time][color]}\">{$arrayTotal[$selTypeNo][1][$sub_code][$time][value]}</font></td>";
		else
			echo "<td>--</td>";
	}
	echo "</tr>";
}      
echo "</table>";   
echo "</td>";
echo "</tr>";  

if($selTypeNo == '2'){
	echo "<tr>";  
	echo "<td width=\"50%\"><p align=\"center\"><font color=\"#0000FF\" size=\"2\">";       
	echo "Online users</font></p></td><td width=\"5\"></td><td width=\"50%\">";       
	echo "<p align=\"center\"><font color=\"#0000FF\" size=\"2\">";       
	echo "Online users</font></td>";  
	echo "</tr>";  
	echo "<tr>";  
	echo "<td width=\"50%\">";              
	echo "<table border=\"1\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">"; 
	echo "<tr>";
	echo "<td width=\"4.5%\">&nbsp;</td>";
	for($i=1;$i<11;$i++){
		echo "<td width=\"4.5%\">$i</td>";
	}
	echo "</tr>";

	for($i=0;$i<4;$i++){
		echo "<td>$i</td>";
		for($j=0;$j<10;$j++){
			if(isset($userNum[0][$i][$j]))
				echo "<td ><font color=\"#0000FF\">{$userNum[0][$i][$j]}</font></td>";
			else
				echo "<td >--</td>";
		}
		echo "</tr>";
	}      
	echo "</table>";       
	echo "</td>";
	echo "<td width=\"5\"></td>";
	echo "<td width=\"50%\">";              
	echo "<table border=\"1\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">"; 
	echo "<tr>";
	echo "<td width=\"4.5%\">&nbsp;</td>";
	for($i=1;$i<11;$i++){
		echo "<td width=\"4.5%\">$i</td>";
	}
	echo "</tr>";

	for($i=0;$i<4;$i++){
		echo "<td>$i</td>";
		for($j=0;$j<10;$j++){
			if(isset($userNum[1][$i][$j]))
				echo "<td ><font color=\"#0000FF\">{$userNum[0][$i][$j]}</font></td>";
			else
				echo "<td >--</td>";
		}
		echo "</tr>";
	}      
	echo "</table>";   
	echo "</td>";
	echo "</tr>";  
}//endif($sysTypeNo==2)

echo "</table>"; 
echo "<table border=\"0\" width=\"100%\">";  
echo "<tr>";  
echo "<td>";  
echo "<p align=\"left\"><nobr>$strRemark:&nbsp;&nbsp;<font color=\"#0000FF\">Y</font> = $strNormal, &nbsp; &nbsp;<font color=#FF0000>N</font> = $strAbnormal,&nbsp; &nbsp;-- = $strNothing.</nobr></td>";     
echo "<td>";              
echo "<p align=\"right\"><a href=\"$PHP_SELF?sys_id=all\" target=\"contents\"><img align=absBottom border=0 src=\"../../images/left.gif\" width=\"14\" height=\"14\">";      
echo "$strBack</a></p>";    
echo "</td>";    
echo "</tr>";   
echo "</table>";
?>
<meta http-equiv="refresh" content="10 url=<?php echo "$PHP_SELF?sys_id=$old_sys_id&selTypeNo=$selTypeNo";?>">
</body>
</html>  
