<?php
require("../../inc/header.inc");

adjust_head();

$selectedLanguage=$userInfo[language];
$DEBUG=0;
function outSpanId($id,$innerHtml,$color){
	echo "<span id=\"$id\" style=\"color:$color\">$innerHtml</span>";
}
getSerial();



//
//*****
//$url_temp=$_SERVER["REQUEST_URI"];
//echo "This page URL:$url_temp<br>";
$db=$omc_db;
$sys_id	= isset($sys_id)?$sys_id:'all';
$showRange = isset($showRange)?$showRange:'low';
if($DEBUG)echo "<br>sys_id=$sys_id";
$mod_type	= isset($mod_type)?$mod_type:'0';

$sysType	= omc_sys_id_info($sys_id,sys_type);
$sysTypeNo	= omc_sys_type2code($sysType);
$sysType=$PlatTypeDefArr[$sysNo][remark];
$TypeNo	= omc_sys_type2code($sysType);
if($DEBUG)echo "<br>sys_id=$sys_id";

//echo "<br>mod_type=$mod_type";

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

?>
<html>
<style type="text/css">
<!--
.inputstyle {font-family: Verdana, Arial, Helvetica, sans-serif; text-align:left; font-size:8pt; margin:0pt; padding:0pt; border:0px;}
-->
</style>

<body leftmargin="15" rightmargin="10" onload="javascript:adjust();" onresize="javascript:adjust();" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;">
<?php

echo "<FORM NAME=\"downForm\">";


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

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

$defineMtp3Status=array(
		array('num' => '0',  'remark' => 'N', 'color' => '#FF0000'),
		array('num' => '1',  'remark' => 'Y', 'color' => '#0000FF'),
		array('num' => '2',  'remark' => '--', 'color' => '#000000'),
		array('num' => '3',  'remark' => '--', 'color' => '#000000')
);

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

$defineSccpStatus=array(
		array('num' => '0',  'remark' => 'Fail', 'color' => '#FF0000'),
		array('num' => '1',  'remark' => 'Congest', 'color' => '#FF0000'),
		array('num' => '2',  'remark' => 'Y', 'color' => '#0000FF')
);

$defineTcapStatus=array(
		array('num' => '0',  'remark' => 'Not used', 'color' => '#0000FF'),
		array('num' => '1',  'remark' => 'Y', 'color' => '#0000FF')
);

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

$omcDebugModule=array(
		array('num' => '0',  'remark' => 'IPTRANS', 'color' => '#000000'),
		array('num' => '1',  'remark' => 'MTP3',	'color' => '#000000'),
		array('num' => '2',  'remark' => 'SCCP',	'color' => '#000000'),
		array('num' => '3',  'remark' => 'TCAP',	'color' => '#000000'),
		array('num' => '4',  'remark' => 'XAP-P',	'color' => '#000000'),
		array('num' => '5',  'remark' => 'MSC',		'color' => '#000000'),
		array('num' => '6',  'remark' => 'VLR',		'color' => '#000000'),
		array('num' => '7',  'remark' => '--',		'color' => '#000000'),
		array('num' => '8',  'remark' => 'HLR',		'color' => '#000000'),
		array('num' => '9',  'remark' => 'SMSC',	'color' => '#000000'),
		array('num' => '10', 'remark' => 'PPS',		'color' => '#000000'),
		array('num' => '11', 'remark' => 'SNMP',	'color' => '#000000'),
		array('num' => '12', 'remark' => '--',		'color' => '#000000'),
		array('num' => '13', 'remark' => 'DEBUG',	'color' => '#000000'),
		array('num' => '14', 'remark' => 'CDR',		'color' => '#000000'),
		array('num' => '15', 'remark' => 'SS7 Gate','color' => '#000000')
);
$aucDebugModule=array(
		array('num' => '0',  'remark' => 'IPTRANS', 'color' => '#000000'),
		array('num' => '1',  'remark' => 'MTP3',	'color' => '#000000'),
		array('num' => '2',  'remark' => 'SCCP',	'color' => '#000000'),
		array('num' => '3',  'remark' => 'TCAP',	'color' => '#000000'),
		array('num' => '4',  'remark' => 'XAP-P',	'color' => '#000000'),
		array('num' => '5',  'remark' => 'MSC',		'color' => '#000000'),
		array('num' => '6',  'remark' => 'VLR',		'color' => '#000000'),
		array('num' => '7',  'remark' => '--',		'color' => '#000000'),
		array('num' => '8',  'remark' => 'HLR',		'color' => '#000000'),
		array('num' => '9',  'remark' => 'SMSC',	'color' => '#000000'),
		array('num' => '10', 'remark' => 'PPS',		'color' => '#000000'),
		array('num' => '11', 'remark' => 'SNMP',	'color' => '#000000'),
		array('num' => '12', 'remark' => '--',		'color' => '#000000'),
		array('num' => '13', 'remark' => 'DEBUG',	'color' => '#000000'),
		array('num' => '14', 'remark' => 'AUC',		'color' => '#000000'),
		array('num' => '15', 'remark' => 'EIR',		'color' => '#000000')
);
$otherDebugModule=array(
		array('num' => '0',  'remark' => 'IPTRANS', 'color' => '#000000'),
		array('num' => '1',  'remark' => 'MTP3',	'color' => '#000000'),
		array('num' => '2',  'remark' => 'SCCP',	'color' => '#000000'),
		array('num' => '3',  'remark' => 'TCAP',	'color' => '#000000'),
		array('num' => '4',  'remark' => 'XAP-P',	'color' => '#000000'),
		array('num' => '5',  'remark' => 'MSC',		'color' => '#000000'),
		array('num' => '6',  'remark' => 'VLR',		'color' => '#000000'),
		array('num' => '7',  'remark' => '--',		'color' => '#000000'),
		array('num' => '8',  'remark' => 'HLR',		'color' => '#000000'),
		array('num' => '9',  'remark' => 'SMSC',	'color' => '#000000'),
		array('num' => '10', 'remark' => 'PPS',		'color' => '#000000'),
		array('num' => '11', 'remark' => 'SNMP',	'color' => '#000000'),
		array('num' => '12', 'remark' => '--',		'color' => '#000000'),
		array('num' => '13', 'remark' => 'DEBUG',	'color' => '#000000'),
		array('num' => '14', 'remark' => 'AUC',		'color' => '#000000'),
		array('num' => '15', 'remark' => 'EIR',		'color' => '#000000')
);

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

$defineSyncStatus=array(
		array('num' => '0',  'remark' => 'Y',		'color' => '#0000FF'),
		array('num' => '1',  'remark' => 'Restart', 'color' => '#0000FF'),
		array('num' => '2',  'remark' => 'Init',	'color' => '#0000FF'),
		array('num' => '3',  'remark' => 'suspend', 'color' => '#0000FF'),
		array('num' => '4',  'remark' => 'Stop',	'color' => '#FF0000')
);

$defineSsnStatus=array(
		array('num' => '0',  'remark' => '--',		'color' => '#0000FF'),
		array('num' => '1',  'remark' => '--',		'color' => '#0000FF'),
		array('num' => '2',  'remark' => '--',		'color' => '#0000FF'),
		array('num' => '3',  'remark' => '--',		'color' => '#0000FF'),
		array('num' => '4',  'remark' => 'OMC',		'color' => '#0000FF'),
		array('num' => '5',  'remark' => '--',		'color' => '#0000FF'),
		array('num' => '6',  'remark' => 'HLR',		'color' => '#0000FF'),
		array('num' => '7',  'remark' => 'VLR',		'color' => '#0000FF'),
		array('num' => '8',  'remark' => 'MSC',		'color' => '#0000FF'),
		array('num' => '9',  'remark' => 'EIR',		'color' => '#0000FF'),
		array('num' => '10',  'remark' => 'AUC',	'color' => '#0000FF'),
		array('num' => '11',  'remark' => 'SMSC',	'color' => '#0000FF'),
		array('num' => '12',  'remark' => 'CAP(CCF)', 'color' => '#0000FF'),
		array('num' => '13',  'remark' => 'CAP(SCF)', 'color' => '#0000FF'),
		array('num' => '14',  'remark' => 'AIF',	'color' => '#0000FF'),
		array('num' => '15',  'remark' => '--',		'color' => '#0000FF'),
		array('num' => '16',  'remark' => '--',		'color' => '#0000FF'),
		array('num' => '17',  'remark' => '--',		'color' => '#0000FF'),
		array('num' => '18',  'remark' => '--',		'color' => '#0000FF'),
		array('num' => '19',  'remark' => 'ESME',	'color' => '#0000FF'),
		array('num' => '20',  'remark' => 'SMPP',	'color' => '#0000FF'),
		array('num' => '21',  'remark' => 'MNP',	'color' => '#0000FF'),
		array('num' => '22',  'remark' => 'USSD',	'color' => '#0000FF')
);


$sysType	= omc_sys_id_info($sys_id,sys_type);
$sysTypeNo	= omc_sys_type2code($sysType);
$sysNo		= omc_sys_id_info($sys_id,sys_num);
$subSysNo	= omc_sys_id_info($sys_id,subsys_num);
if($DEBUG)echo "<br>sysType=$sysType";
if($DEBUG)echo "<br>sysNo=$sysNo";
if($DEBUG)echo "<br>subSysNo=$subSysNo";

$sysType=$PlatTypeDefArr[$sysNo][remark];
$TypeNo	= omc_sys_type2code($sysType);
$selPlat="SELECT platHeart FROM sysConf WHERE sysTypeNo = '$TypeNo' ";
if($DEBUG)echo "<br>selPlat=$selPlat";
$resPlat=@mysqli_query($pubConn,$selPlat);
$rowPlat=@mysqli_fetch_array($resPlat);
$sysNo = $rowPlat[0];

if($DEBUG)echo "<br>sysType=$sysType";
if($DEBUG)echo "<br>sysNo=$sysNo";
if($DEBUG)echo "<br>subSysNo=$subSysNo";


if($sysType == 'EMS')
	$helpId="1.2.2.1";
else
	$helpId="1.2.2.2";

adjust_title_head();
echo "<table id=\"table_up\" border=\"0\" width=\"100%\">";
	echo "<tr>";
		echo "<td width=\"50%\">";
		echo "$strSysStatus > Subsystem > $strServer";
		echo "</td>";
		echo "<td width=\"50%\" align=\"right\" title=\"Help\">";
		showHelp($helpId);
		echo "</td>";
	echo "</tr>";
	
	echo "<tr>";
		echo "<td width=\"50%\">";
		echo "&nbsp;";
		echo "</td>";
		echo "<td width=\"50%\" align=\"right\">";
		echo "<a href=\"serverStatus.php?sys_id=all&showRange=$showRange&backpage=$backpage\" target=\"contents\"><img align=absBottom border=0 src=\"../../images/left.gif\" width=\"14\" height=\"14\">";      
				echo "$strBack</a>";
		echo "</td>";
	echo "</tr>";
echo "</table>";

adjust_title_tail();
adjust_content_head();

$sel_mes_sql="SELECT detailStat,updateTime,sysTypeNo FROM $sysStat_table 
			  WHERE 
			  sysTypeNo='$sysTypeNo' AND sysNo='$sysNo' AND subSysNo='$subSysNo'
			 ";
if($DEBUG)
	echo "<br>sel_mes_sql=$sel_mes_sql";
$sel_mes_res=mysqli_query($pubConn,$sel_mes_sql);
$sel_mes_row=@mysqli_fetch_array($sel_mes_res);
echo mysqli_error($pubConn);
//echo "<br>sel_mes_sql=$sel_mes_sql";
if(!$sel_mes_row)
{
	echo "<br><font size='2'>$strNotInstalled</font>";
	exit();
}

$hex_mes=$sel_mes_row[detailStat];

if($DEBUG)
	echo "<br>hex_mes=$hex_mes";
$refresh_time=$sel_mes_row[updateTime];
if($refresh_time > $due_date && $refresh_time < $ove_date)
{
	$color_refresh_time="#0000FF";
}
else
{
	$no_sys_status=1;
	$no_vlr_status=1;
	$color_refresh_time="#FF0000";
}

$bin_mes='';
//============================
/*
$ty=$sel_mes_row[sysTypeNo];
$tt=$sel_mes_row[updateTime];
echo "sysType:$ty<br>";
echo "time:$tt<br>";
echo "hex_mes:$hex_mes<br>";
*/
//============================



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


/************************************iptrans************************************/
$iptrans_bgn_byt=21;
$iptrans_len_bin=substr($bin_mes,$iptrans_bgn_byt*8,16);//iptrans所占长度,19bytes
$iptrans_len_dec=BinDec($iptrans_len_bin);
if($iptrans_len_dec > 0){
	$showIptrans = 1;
}

if($DEBUG)echo "<br>iptrans_len_dec=$iptrans_len_dec";

//版本号
$bin_version_0=substr($bin_mes,($iptrans_bgn_byt+2)*8,8);
$dec_version_0=BinDec($bin_version_0);

$bin_version_1=substr($bin_mes,($iptrans_bgn_byt+3)*8,8);
$dec_version_1=BinDec($bin_version_1);
$dec_version_1=omc_keep_length($dec_version_1,0,2);

$bin_version_2=substr($bin_mes,($iptrans_bgn_byt+4)*8,8);
$dec_version_2=BinDec($bin_version_2);
$dec_version_2=omc_keep_length($dec_version_2,0,2);

$version=$dec_version_0.".".$dec_version_1.".".$dec_version_2;
$color_version="#0000FF";
if($DEBUG)
echo "<br>version=$version";

//状态
$iptrans_state_bin=substr($bin_mes,($iptrans_bgn_byt+5)*8,8);
$iptrans_state_dec=BinDec($iptrans_state_bin);
if($DEBUG)echo "<br>iptrans_state_dec=$iptrans_state_dec";

//port状态
for($i=0;$i<4;$i++){	
	for($j=0;$j<8;$j++){
		$num=($i+1)*8-1-$j;
		$port_bin="port_".$num."_bin";
		$port_dec="port_".$num."_dec";
		${$port_bin}=substr($bin_mes,($iptrans_bgn_byt+6)*8+$i*8+$j,1);
		${$port_dec}=BinDec(${$port_bin});
		if($DEBUG)echo "<br>$port_dec=${$port_dec}";
	}
}

if($mod_type==1){
	 if(!$showIptrans){
		echo "<br><font size='2'>$strNotInstalled</font>";
		exit();
	 }
?>
<table border="0" width="100%" cellpadding="0" cellspacing="1">
<tr><td><p align="center"><font color="#0000FF" size="2">
<?php
echo "IPTRANS</font>";
echo "( $strVersion:";
echo "<font color=\"#0000FF\">$version</font>";
echo ", ";
echo " $strStatus:";

$id = "input_iptrans_state";
if($iptrans_state_dec<2){
	$color = $defineStatus[$iptrans_state_dec][color];
	$innerHtml = $defineStatus[$iptrans_state_dec][remark];
}else{
	$color = "#0000FF";
	$innerHtml = '--';
}
outSpanId($id,$innerHtml,$color);

echo ", ";
echo "$strRefreshTime:";
$id = "input_refresh_time";
outSpanId($id,$refresh_time,$color_refresh_time);
echo " )";
?>
</p></td></tr>
</table>
<p></p>
<table border="1" width="100%" cellpadding="1" cellspacing="0" bordercolor="#666666" 	  bordercolordark="#FFFFFF" bgcolor="#FFFFFF">
<tr bgcolor="#E6E6E6">
<td width="12.5%">
<nobr><?php echo "$strPortNo"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "$strStatus"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "$strPortNo"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "$strStatus"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "$strPortNo"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "$strStatus"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "$strPortNo"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "$strStatus"; ?></nobr>
</td>
</tr>
<?php
for($i=0;$i<8;$i++)
{
	echo "<tr>";
		for($j=0;$j<8;$j++)
		{
			if($j%2==0)
			{
				$dis_no=4950+($j/2)*8+$i;
				echo "<td>";
				echo $dis_no;
				echo "</td>";
			}
			else
			{
				$id="input_port_status" . "_$i" . "_$j";
				$dis_port=(($j-1)/2)*8+$i;
				$port_name="port_".$dis_port."_dec";
				$port_status=${$port_name};
				echo "<td>";
				outSpanId($id,$defineIptransStatus[$port_status][remark],$defineIptransStatus[$port_status][color]);
				echo "</td>";
			}
		}
	echo "</tr>";
}
?>
</table>
<?php
}//end if($mod_type==1)

/************************************mtp3************************************/
$mtp3_bgn_byt=$iptrans_bgn_byt+4+$iptrans_len_dec;
if($DEBUG)echo "<br>mtp3_bgn_byt=$mtp3_bgn_byt";
$mtp3_len_bin=substr($bin_mes,$mtp3_bgn_byt*8,16);//mtp3所占长度
$mtp3_len_dec=BinDec($mtp3_len_bin);
if($mtp3_len_dec){
	$showMtp3=1;
}
if($DEBUG)echo "<br>mtp3_len_dec=$mtp3_len_dec";

//版本号
$bin_version_0=substr($bin_mes,($mtp3_bgn_byt+2)*8,8);
$dec_version_0=BinDec($bin_version_0);

$bin_version_1=substr($bin_mes,($mtp3_bgn_byt+3)*8,8);
$dec_version_1=BinDec($bin_version_1);
$dec_version_1=omc_keep_length($dec_version_1,0,2);

$bin_version_2=substr($bin_mes,($mtp3_bgn_byt+4)*8,8);
$dec_version_2=BinDec($bin_version_2);
$dec_version_2=omc_keep_length($dec_version_2,0,2);

$version=$dec_version_0.".".$dec_version_1.".".$dec_version_2;
$color_version="#0000FF";
if($DEBUG)echo "<br>version=$version";

//状态
$mtp3_state_bin=substr($bin_mes,($mtp3_bgn_byt+5)*8,8);
$mtp3_state_dec=BinDec($mtp3_state_bin);
if($DEBUG)echo "<br>mtp3_state_dec=$mtp3_state_dec";

//link状态
for($i=0;$i<64;$i++)
{	
	for($j=0;$j<4;$j++)
	{
		$num=($i+1)*4-1-$j;
		if($DEBUG)echo "<br>num=$num";
		$link_bin="link_".$num."_bin";
		$link_dec="link_".$num."_dec";
		${$link_bin}=substr($bin_mes,($mtp3_bgn_byt+6)*8+$i*8+$j*2,2);
		${$link_dec}=BinDec(${$link_bin});
		if($DEBUG)echo "<br>$link_dec=${$link_dec}";
	}
}

//linkset状态
for($i=0;$i<32;$i++)
{
	for($j=0;$j<4;$j++)
	{
		$num=($i+1)*4-1-$j;
		if($DEBUG)echo "<br>num=$num";
		$linkset_bin="linkset_".$num."_bin";
		$linkset_dec="linkset_".$num."_dec";
		${$linkset_bin}=substr($bin_mes,($mtp3_bgn_byt+6+64)*8+$i*8+$j*2,2);
		${$linkset_dec}=BinDec(${$linkset_bin});
		if($DEBUG)echo "<br>$linkset_dec=${$linkset_dec}";
	}
}


if($mod_type==2)
{
	 if(!$showMtp3)
	 {
		echo "<br><font size='2'>$strNotInstalled</font>";
		exit();
	 }
?>
<p></p>
<table border="0" width="100%" cellpadding="0" cellspacing="1">
<tr><td><p align="center"><font color="#0000FF" size="2">
<?php
echo "MTP3</font>";
echo "( $strVersion:";
echo "<font color=\"#0000FF\">$version</font>";
echo ", ";
echo " $strStatus:";
$id = 'input_mtp3_state';
if($mtp3_state_dec<2){
	$innerHtml = $defineStatus[$mtp3_state_dec][remark];
	$color = $defineStatus[$mtp3_state_dec][color];
}else{
	$innerHtml = '--';
	$color = '#0000FF';
}
outSpanId($id,$innerHtml,$color);
echo ", ";
echo "$strRefreshTime:";
$id = "input_refresh_time";
outSpanId($id,$refresh_time,$color_refresh_time);
echo " )";
?>
</p></td></tr>
</table>
<p></p>
<table border="1" width="100%" cellpadding="1" cellspacing="0" bordercolor="#666666" 	  bordercolordark="#FFFFFF" bgcolor="#FFFFFF">
<tr bgcolor="#E6E6E6" align="center">
<td colspan="8">
Link
</td>
<tr bgcolor="#E6E6E6">
<td width="12.5%">
<nobr><?php echo "No"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "$strStatus"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "No"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "$strStatus"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "No"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "$strStatus"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "No"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "$strStatus"; ?></nobr>
</td>
</tr>
<?php
for($i=0;$i<64;$i++)
{
	echo "<tr>";
		for($j=0;$j<8;$j++)
		{
			if($j%2==0)
			{
				$dis_no=($j/2)*64+$i;
				echo "<td>";
				echo $dis_no;
				echo "</td>";
			}
			else
			{
				$id = "input_mtp3_link_status" . "_$i" . "_$j";
				$dis_link=(($j-1)/2)*64+$i;
				$link_name="link_".$dis_link."_dec";
				$link_status=${$link_name};
				echo "<td>";
				if($link_status<2){
					$innerHtml = $defineMtp3Status[$link_status][remark];
					$color = $defineMtp3Status[$link_status][color];
				}else{
					$innerHtml = "--";
					$color = '#000000';
				}
				outSpanId($id,$innerHtml,$color);
				echo "</td>";
			}
		}
	echo "</tr>";
}
?>
</table>
<p></p>
<table border="1" width="100%" cellpadding="1" cellspacing="0" bordercolor="#666666" 	  bordercolordark="#FFFFFF" bgcolor="#FFFFFF">
<tr bgcolor="#E6E6E6" align="center">
<td colspan="8">
Linkset
</td>
<tr bgcolor="#E6E6E6">
<td width="12.5%">
<nobr><?php echo "No"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "$strStatus"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "No"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "$strStatus"; ?></nobr>

</td>
<td width="12.5%">
<nobr><?php echo "No"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "$strStatus"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "No"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "$strStatus"; ?></nobr>
</td>
</tr>
<?php
for($i=0;$i<32;$i++)
{
	echo "<tr>";
		for($j=0;$j<8;$j++)
		{
			if($j%2==0)
			{
				$dis_no=($j/2)*32+$i;
				echo "<td>";
				echo $dis_no;
				echo "</td>";
			}
			else
			{
				$id = "input_mtp3_linkset_status" . "_$i" . "_$j";
				$dis_linkset=(($j-1)/2)*32+$i;
				$linkset_name="linkset_".$dis_linkset."_dec";
				$linkset_status=${$linkset_name};
				echo "<td>";
				if($linkset_status<2){
					$innerHtml = $defineMtp3Status[$linkset_status][remark];
					$color = $defineMtp3Status[$linkset_status][color];
				}else{
					$innerHtml = "--";
					$color = '#000000';
				}
				outSpanId($id,$innerHtml,$color);
				echo "</td>";
			}
		}
	echo "</tr>";
}
?>
</table>

<?php
}//end if($mod_type==2)

/************************************sccp************************************/
$sccp_bgn_byt=$mtp3_bgn_byt+4+$mtp3_len_dec;
$sccp_len_bin=substr($bin_mes,$sccp_bgn_byt*8,16);//sccp所占长度
$sccp_len_dec=BinDec($sccp_len_bin);
if($DEBUG)echo "<br>sccp_len_dec=$sccp_len_dec";
$ssnNum=$sccp_len_dec-4;
if($sccp_len_dec > 0){
	$showSccp = 1;
}

//版本号
$bin_version_0=substr($bin_mes,($sccp_bgn_byt+2)*8,8);
$dec_version_0=BinDec($bin_version_0);

$bin_version_1=substr($bin_mes,($sccp_bgn_byt+3)*8,8);
$dec_version_1=BinDec($bin_version_1);
$dec_version_1=omc_keep_length($dec_version_1,0,2);

$bin_version_2=substr($bin_mes,($sccp_bgn_byt+4)*8,8);
$dec_version_2=BinDec($bin_version_2);
$dec_version_2=omc_keep_length($dec_version_2,0,2);

$version=$dec_version_0.".".$dec_version_1.".".$dec_version_2;
$color_version="#0000FF";
if($DEBUG)
echo "<br>version=$version";

//状态
$sccp_state_bin=substr($bin_mes,($sccp_bgn_byt+5)*8,8);
$sccp_state_dec=BinDec($sccp_state_bin);
if($DEBUG)echo "<br>sccp_state_dec=$sccp_state_dec";

for($i=0;$i<$ssnNum;$i++)
{
	$ssn_hex="ssn_".$i."_hex";
	$ssn_dec="ssn_".$i."_dec";
	${$ssn_hex}=substr($hex_mes,($sccp_bgn_byt+6+$i)*2,2);
	${$ssn_dec}=HexDec(${$ssn_hex});
	if($DEBUG) echo "<br>$ssn_dec=${$ssn_dec}";
}

if($mod_type==3)
{
	 if(!$showSccp)
	 {
		echo "<br><font size='2'>$strNotInstalled</font>";
		exit();
	 }
?>

<p></p>
<table border="0" width="100%" cellpadding="0" cellspacing="1">
<tr><td><p align="center"><font color="#0000FF" size="2">
<?php
echo "SCCP</font>";
echo "( $strVersion:";
echo "<font color=\"#0000FF\">$version</font>";
echo ", ";
echo " $strStatus:";
$id = 'input_sccp_state';
if($sccp_state_dec<3){
	$innerHtml = $defineSccpStatus[$sccp_state_dec][remark];
	$color = $defineSccpStatus[$sccp_state_dec][color];
}else{
	$innerHtml = '--';
	$color = '#000000';
}
outSpanId($id,$innerHtml,$color);
echo ", ";
echo "$strRefreshTime:";
$id = "input_refresh_time";
outSpanId($id,$refresh_time,$color_refresh_time);
echo " )";
?>
</p></td></tr>
</table>
<p></p>
<table border="1" width="100%" cellpadding="1" cellspacing="0" bordercolor="#666666" 	  bordercolordark="#FFFFFF" bgcolor="#FFFFFF">
<?php
if($ssnNum>0)
{
	echo "<tr bgcolor=\"#E6E6E6\">";
	echo "<td width=\"50%\">Registered ssn num</td>";
	echo "<td width=\"50%\">Registered ssn name</td>";
	echo "</tr>";
	for($i=0;$i<$ssnNum;$i++)
	{
		$ssn_dec="ssn_".$i."_dec";
		$showSsn=${$ssn_dec};
		$showNum=omc_keep_length($showSsn,0,3);
		echo "<tr>";
		echo "<td width=\"50%\">$showNum</td>";
		if($showSsn==146)		{
			$showSsn=12;
		}
		elseif($showSsn==147){
			$showSsn=13;
		}
		elseif($showSsn==254){
			$showSsn=14;
		}
		elseif($showSsn==32){
			$showSsn=21;
		}
		elseif($showSsn==153){
			$showSsn=22;
		}
		echo "<td width=\"50%\">";
		echo "<font color=\"#0000FF\">{$defineSsnStatus[$showSsn][remark]}</font>";
		echo "</td>";
		echo "</tr>";
	}
}
echo "</table>";
}//end if($mod_type==3)

/************************************tcap************************************/
$tcap_bgn_byt=$sccp_bgn_byt+4+$sccp_len_dec;
$tcap_len_bin=substr($bin_mes,$tcap_bgn_byt*8,16);//tcap所占长度
$tcap_len_dec=BinDec($tcap_len_bin);
if($DEBUG)echo "<br>tcap_len_dec=$tcap_len_dec";
if($tcap_len_dec > 0){
	$showTcap = 1;
}

//版本号
$bin_version_0=substr($bin_mes,($tcap_bgn_byt+2)*8,8);
$dec_version_0=BinDec($bin_version_0);

$bin_version_1=substr($bin_mes,($tcap_bgn_byt+3)*8,8);
$dec_version_1=BinDec($bin_version_1);
$dec_version_1=omc_keep_length($dec_version_1,0,2);

$bin_version_2=substr($bin_mes,($tcap_bgn_byt+4)*8,8);
$dec_version_2=BinDec($bin_version_2);
$dec_version_2=omc_keep_length($dec_version_2,0,2);

$version=$dec_version_0.".".$dec_version_1.".".$dec_version_2;
$color_version="#0000FF";
if($DEBUG)
echo "<br>version=$version";

//状态
$tcap_state_bin=substr($bin_mes,($tcap_bgn_byt+5)*8,8);
$tcap_state_dec=BinDec($tcap_state_bin);
if($DEBUG)echo "<br>tcap_state_dec=$tcap_state_dec";

//Transaction ID
$tsid_state_bin=substr($bin_mes,($tcap_bgn_byt+6)*8,16);
$tsid_state_dec=BinDec($tsid_state_bin);
if($DEBUG)echo "<br>tsid_state_bin=$tsid_state_bin";
if($DEBUG)echo "<br>tsid_state_dec=$tsid_state_dec";

//Dialogue ID
$dlid_state_bin=substr($bin_mes,($tcap_bgn_byt+8)*8,16);
$dlid_state_dec=BinDec($dlid_state_bin);
if($DEBUG)echo "<br>dlid_state_bin=$dlid_state_bin";
if($DEBUG)echo "<br>dlid_state_dec=$dlid_state_dec";

if($mod_type==4){
	 if(!$showTcap){
		echo "<br><font size='2'>$strNotInstalled</font>";
		exit();
	 }

?>
<p></p>
<table border="0" width="100%" cellpadding="0" cellspacing="1">
<tr><td><p align="center"><font color="#0000FF" size="2">
<?php
echo "TCAP</font>";
echo "( $strVersion:";
echo "<font color=\"#0000FF\">$version</font>";
echo ", ";
echo " $strStatus:";
$id = 'input_tcap_state';
if($tcap_state_dec<2){
	$innerHtml = $defineTcapStatus[$tcap_state_dec][remark];
	$color = $defineTcapStatus[$tcap_state_dec][color];
}else{
	$innerHtml = '--';
	$color = '#000000';
}
outSpanId($id,$innerHtml,$color);
echo ", ";
echo "$strRefreshTime:";
$id = "input_refresh_time";
outSpanId($id,$refresh_time,$color_refresh_time);
echo " )";
?>
</p></td></tr>
</table>
<p></p>
<table border="1" width="100%" cellpadding="1" cellspacing="0" bordercolor="#666666" 	  bordercolordark="#FFFFFF" bgcolor="#FFFFFF">
<tr bgcolor="#E6E6E6">
<td width="40%">
ID
</td>
<td width="60%">
Occupied
</td>
</tr>
<tr>
<td width="40%">
Current Used Dialogue ID
</td>
<td width="60%">
<?php
outSpanId('input_tsid_state_dec',$tsid_state_dec,'#0000ff');
?>
</td>
</tr>
<tr>
<td width="40%">
Max Used Dialogue ID
</td>
<td width="60%">
<?php
outSpanId('input_dlid_state_dec',$dlid_state_dec,'#0000ff');
?>
</td>
</tr>
</table>
<?php
}//end if($mod_type==4)

/************************************snmp************************************/

$snmp_bgn_byt=$tcap_bgn_byt+4+$tcap_len_dec;
$snmp_len_bin=substr($bin_mes,$snmp_bgn_byt*8,16);//snmp所占长度
$snmp_len_dec=BinDec($snmp_len_bin);
if($DEBUG)echo "<br>snmp_len_dec=$snmp_len_dec";
if($snmp_len_dec > 0){
	$showSnmp = 1;
}

//版本号
$bin_version_0=substr($bin_mes,($snmp_bgn_byt+2)*8,8);
$dec_version_0=BinDec($bin_version_0);

$bin_version_1=substr($bin_mes,($snmp_bgn_byt+3)*8,8);
$dec_version_1=BinDec($bin_version_1);
$dec_version_1=omc_keep_length($dec_version_1,0,2);

$bin_version_2=substr($bin_mes,($snmp_bgn_byt+4)*8,8);
$dec_version_2=BinDec($bin_version_2);

$dec_version_2=omc_keep_length($dec_version_2,0,2);

$version=$dec_version_0.".".$dec_version_1.".".$dec_version_2;
$color_version="#0000FF";
if($DEBUG)
echo "<br>version=$version";

//状态

$snmp_state_bin=substr($bin_mes,($snmp_bgn_byt+5)*8,8);
$snmp_state_dec=BinDec($snmp_state_bin);
if($DEBUG)echo "<br>snmp_state_dec=$snmp_state_dec";

//trap function
$trap_func_bin=substr($bin_mes,($snmp_bgn_byt+6)*8,8);
$trap_func_dec=BinDec($trap_func_bin);
if($DEBUG)echo "<br>trap_func_dec=$trap_func_dec";

//set function
$set_func_bin=substr($bin_mes,($snmp_bgn_byt+7)*8,8);
$set_func_dec=BinDec($set_func_bin);
if($DEBUG)echo "<br>set_func_dec=$set_func_dec";

//get function
$get_func_bin=substr($bin_mes,($snmp_bgn_byt+8)*8,8);
$get_func_dec=BinDec($get_func_bin);
if($DEBUG)echo "<br>get_func_dec=$get_func_dec";

//rsp function
$rsp_func_bin=substr($bin_mes,($snmp_bgn_byt+9)*8,8);
$rsp_func_dec=BinDec($rsp_func_bin);
if($DEBUG)echo "<br>rsp_func_dec=$rsp_func_dec";
if($mod_type==5){
	if(!$showSnmp){
		echo "<br><font size='2'>$strNotInstalled</font>";
		exit();
	 }

?>

<p></p>
<table border="0" width="100%" cellpadding="0" cellspacing="1">
<tr><td><p align="center"><font color="#0000FF" size="2">
<?php
echo "SNMP</font>";
echo "( $strVersion:";
echo "<font color=\"#0000FF\">$version</font>";
echo ", ";
echo " $strStatus:";
$id = 'input_snmp_state';
if($snmp_state_dec<2){
	$innerHtml = $defineStatus[$snmp_state_dec][remark];
	$color = $defineStatus[$snmp_state_dec][color];
}else{
	$innerHtml = '--';
	$color = '#000000';
}
outSpanId($id,$innerHtml,$color);
echo ", ";
echo "$strRefreshTime:";
$id = "input_refresh_time";
outSpanId($id,$refresh_time,$color_refresh_time);
echo " )";
?>

</p></td></tr>
</table>
<p></p>
<table border="1" width="100%" cellpadding="1" cellspacing="0" bordercolor="#666666" 	  bordercolordark="#FFFFFF" bgcolor="#FFFFFF">
<tr bgcolor="#E6E6E6">
<td width="50%">
Function type
</td>
<td width="50%">
Registered number
</td>
</tr>
<tr>
<td width="50%">
TRAP
</td>
<td width="50%">
<?php
outSpanId('input_trap_func_dec',$trap_func_dec,'#0000ff');
?>
</td>
</tr>
<tr>
<td width="50%">
SET
</td>
<td width="50%">
<?php
outSpanId('input_set_func_dec',$set_func_dec,'#0000ff');
?>
</td></tr>
<tr>
<td width="50%">GET</td>
<td width="50%">
<?php
outSpanId('input_get_func_dec',$get_func_dec,'#0000ff');
?>
</td></tr>
<tr>
<td width="50%">RSP</td>
<td width="50%">
<?php
outSpanId('input_rsp_func_dec',$rsp_func_dec,'#0000ff');
?>
</td></tr>
</table>
<?php
}//end if($mod_type==5)

/************************************debug************************************/
$debug_bgn_byt=$snmp_bgn_byt+4+$snmp_len_dec;
$debug_len_bin=substr($bin_mes,$debug_bgn_byt*8,16);//debug所占长度
$debug_len_dec=BinDec($debug_len_bin);
if($DEBUG)echo "<br>debug_len_dec=$debug_len_dec";
if($debug_len_dec > 0){
	$showDebug = 1;
}

//版本号
$bin_version_0=substr($bin_mes,($debug_bgn_byt+2)*8,8);
$dec_version_0=BinDec($bin_version_0);

$bin_version_1=substr($bin_mes,($debug_bgn_byt+3)*8,8);
$dec_version_1=BinDec($bin_version_1);
$dec_version_1=omc_keep_length($dec_version_1,0,2);

$bin_version_2=substr($bin_mes,($debug_bgn_byt+4)*8,8);
$dec_version_2=BinDec($bin_version_2);
$dec_version_2=omc_keep_length($dec_version_2,0,2);

$version=$dec_version_0.".".$dec_version_1.".".$dec_version_2;
$color_version="#0000FF";
if($DEBUG)
echo "<br>version=$version";

//状态
$debug_state_bin=substr($bin_mes,($debug_bgn_byt+5)*8,8);
$debug_state_dec=BinDec($debug_state_bin);
if($DEBUG)echo "<br>debug_state_dec=$debug_state_dec";

//use debug count
$count_bin=substr($bin_mes,($debug_bgn_byt+6)*8,8);
$count_dec=BinDec($count_bin);
if($DEBUG)echo "<br>count_dec=$count_dec";

//use debug module
for($i=0;$i<16;$i++)
{
	$use_bin="use_".$i."_bin";
	$use_dec="use_".$i."_dec";
	${$use_bin}=substr($bin_mes,($debug_bgn_byt+7)*8+$i,1);
	${$use_dec}=BinDec(${$use_bin});
	if($DEBUG)echo "<br>$use_dec=${$use_dec}";
}

if($mod_type==6)
{
	 if(!$showDebug)
	 {
		echo "<br><font size='2'>$strNotInstalled</font>";
		exit();
	 }

?>
<p></p>
<table border="0" width="100%" cellpadding="0" cellspacing="1">
<tr><td><p align="center"><font color="#0000FF" size="2">
<?php
echo "DEBUG</font>";
echo "( $strVersion:";
echo "<font color=\"#0000FF\">$version</font>";
echo ", ";
echo " $strStatus:";
$id = 'input_debug_state';
if($debug_state_dec<2){
	$innerHtml = $defineDebugStatus[$debug_state_dec][remark];
	$color = $defineDebugStatus[$debug_state_dec][color];
}else{
	$innerHtml = '--';
	$color = '#000000';
}
outSpanId($id,$innerHtml,$color);
echo ", ";
echo "$strRefreshTime:";
$id = "input_refresh_time";
outSpanId($id,$refresh_time,$color_refresh_time);
echo " )";
?>
</p></td></tr>
</table>
<p></p>
<table border="1" width="100%" cellpadding="1" cellspacing="0" bordercolor="#666666" 	  bordercolordark="#FFFFFF" bgcolor="#FFFFFF">
<tr bgcolor="#E6E6E6">
<td width="12.5%">
<nobr><?php echo "Module"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "Used"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "Module"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "Used"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "Module"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "Used"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "Module"; ?></nobr>
</td>
<td width="12.5%">
<nobr><?php echo "Used"; ?></nobr>
</td>
</tr>
<?php
for($i=0;$i<4;$i++)
{
	echo "<tr>";
		for($j=0;$j<8;$j++)
		{
			$id = "input_debug_items" . "_$i" . "_$j";
			if($j%2==0)
			{
				$dis_no=($j/2)*4+$i;
				echo "<td>";
				if($PlatTypeDefArr[$sysNo][remark]=='EMS')
				{
					echo $omcDebugModule[$dis_no][remark];
				}
				elseif($sysType=='AUC' || $sysType=='EIR' || $sysType=='HLR')
				{
					echo $aucDebugModule[$dis_no][remark];
				}
				else
				{
					echo $otherDebugModule[$dis_no][remark];
				}
				echo "</td>";
			}
			else
			{
				$dis_port=(($j-1)/2)*4+$i;
				$port_name="use_".$dis_port."_dec";
				$port_status=${$port_name};
				echo "<td>";
				outSpanId($id,$defineModuleStatus[$port_status][remark],$defineModuleStatus[$port_status][color]);
				echo "</td>";
			}
		}
	echo "</tr>";
}
?>
</table>
<?php
}//end if($mod_type==6)

/************************************data sync************************************/
$syn_bgn_byt=$debug_bgn_byt+4+$debug_len_dec;
$syn_len_bin=substr($bin_mes,$syn_bgn_byt*8,16);//syn所占长度
$syn_len_dec=BinDec($syn_len_bin);
if($DEBUG)echo "<br>syn_len_dec=$syn_len_dec";
if($syn_len_dec > 0){
	$showDatasync = 1;
}

//版本号
$bin_version_0=substr($bin_mes,($syn_bgn_byt+2)*8,8);
$dec_version_0=BinDec($bin_version_0);

$bin_version_1=substr($bin_mes,($syn_bgn_byt+3)*8,8);
$dec_version_1=BinDec($bin_version_1);
$dec_version_1=omc_keep_length($dec_version_1,0,2);

$bin_version_2=substr($bin_mes,($syn_bgn_byt+4)*8,8);
$dec_version_2=BinDec($bin_version_2);
$dec_version_2=omc_keep_length($dec_version_2,0,2);

$version=$dec_version_0.".".$dec_version_1.".".$dec_version_2;
$color_version="#0000FF";
if($DEBUG)echo "<br>version=$version";

//状态
$syn_state_bin=substr($bin_mes,($syn_bgn_byt+5)*8,8);
$syn_state_dec=BinDec($syn_state_bin);
if($DEBUG)echo "<br>syn_state_dec=$syn_state_dec";

//shmnum
$shmnum_hex=substr($hex_mes,($syn_bgn_byt+6)*2,2);
$shmnum_dec=HexDec($shmnum_hex);

//shmid
$shmid_hex=substr($hex_mes,($syn_bgn_byt+7)*2,2);
$shmid_dec=HexDec($shmid_hex);

//Init progress
$init_hex=substr($hex_mes,($syn_bgn_byt+8)*2,2);
$init_dec=HexDec($init_hex);
$initPro=$init_dec."%";

//Init progress
$init_hex=substr($hex_mes,($syn_bgn_byt+8)*2,2);
$init_dec=HexDec($init_hex);

//time
$time_hex=substr($hex_mes,($syn_bgn_byt+9)*2,2);
$time_dec=HexDec($time_hex);

if($mod_type==7)
{
	 if(!$showDatasync)
	 {
		echo "<br><font size='2'>$strNotInstalled</font>";
		exit();
	 }
?>
<p></p>
<table border="0" width="100%" cellpadding="0" cellspacing="1">
<tr><td><p align="center"><font color="#0000FF" size="2">
<?php
echo "DATA SYNCHRONIZATION</font>";
echo "( $strVersion:";
echo "<font color=\"#0000FF\">$version</font>";
echo ", ";
echo " $strStatus:";
if($syn_state_dec<5){
	echo "<font color={$defineSyncStatus[$syn_state_dec][color]}>{$defineSyncStatus[$syn_state_dec][remark]}</font>";
}else{
	echo "<font color=\"#0000FF\">--</font>";
}
echo ", ";
echo "$strRefreshTime:";
echo "<font color=\"$color_refresh_time\">$refresh_time</font>";
echo " )";
?>
</p></td></tr>
</table>
<p></p>
<table border="1" width="100%" cellpadding="1" cellspacing="0" bordercolor="#666666" 	  bordercolordark="#FFFFFF" bgcolor="#FFFFFF">
<tr>
<td width="50%" bgcolor="#E6E6E6">SHM NUM</td>
<td width="50%"><?php echo "<font color=\"#0000FF\">$shmnum_dec</font>";?></td>
</tr>
<tr>
<td width="50%" bgcolor="#E6E6E6">SHM ID</td>
<td width="50%">
<?php
echo "<font color=\"#0000FF\">$shmid_dec</font>";
?>
</td></tr>
<tr>
<td width="50%" bgcolor="#E6E6E6">Initialization progress</td>
<td width="50%">
<?php
if($sysType != 'MSC')
	echo "<font color=\"#0000FF\">$initPro</font>";
else
	echo "<font color=\"#000000\">--</font>";
?>
</td>
</tr>
<tr>
<td width="50%" bgcolor="#E6E6E6">
Time(minutes)
</td>
<td width="50%">
<?php
if($sysType != 'MSC')
	echo "<font color=\"#0000FF\">$time_dec</font>";
else
	echo "<font color=\"#000000\">--</font>";
?>
</td>
</tr>
</table>
 <?php 
 }//end if($mod_type==7)

/************************************basic status************************************/

$res_bgn_byt=$syn_bgn_byt+4+$syn_len_dec;
$res_len_bin=substr($bin_mes,$res_bgn_byt*8,16);//basic status所占长度
$res_len_dec=BinDec($res_len_bin);

$basic_bgn_byt=$res_bgn_byt+4+$res_len_dec;
$basic_len_bin=substr($bin_mes,$basic_bgn_byt*8,16);//basic status所占长度
$basic_len_dec=BinDec($basic_len_bin);
if($DEBUG)echo "<br>basic_len_dec=$basic_len_dec";
if($basic_len_dec > 0){
	$showbasic = 1;
}

//cpu loading
$bin_cpu_0=substr($bin_mes,($basic_bgn_byt+2)*8,16);
$dec_cpu_0=BinDec($bin_cpu_0);
$dec_cpu_0=1000-$dec_cpu_0;
if($dec_cpu_0<0){
	$dec_cpu_0=0;
}elseif($dec_cpu_0>1000){
	$dec_cpu_0=1000;
}
if($dec_cpu_0>900){
	$color_cpu_loading="#FF0000";
	$no_sys_status=1;
}else{
	$color_cpu_loading="#0000FF";
}
$cpu_loading=($dec_cpu_0/10)."%";
if($DEBUG)echo "<br>cpu_loading=$cpu_loading";

//uptime
$uptime_hex=substr($hex_mes,($basic_bgn_byt+4)*2,8);
$uptime_dec=HexDec($uptime_hex);
$uptime=date("Y-m-d H:i:s",$uptime_dec);

//total memory
$total_memory_hex=substr($hex_mes,($basic_bgn_byt+8)*2,8);
$total_memory_dec=HexDec($total_memory_hex);
if($DEBUG)echo "<br>total_memory_dec=$total_memory_dec";

//free memory
$free_memory_hex=substr($hex_mes,($basic_bgn_byt+12)*2,8);
$free_memory_dec=HexDec($free_memory_hex);
if($DEBUG)echo "<br>free_memory_dec=$free_memory_dec";
if(isset($total_memory_dec)&&$total_memory_dec!=0)
{
	$memoryRate=($free_memory_dec/$total_memory_dec)*100;
	$memoryRate=number_format($memoryRate, 2, '.', '');	
}
$memory=$free_memory_dec." / ".$total_memory_dec."&nbsp;&nbsp;".$memoryRate."%";
if($free_memory_dec*10<$total_memory_dec){
	$color_memory="#FF0000";
}else{
	$color_memory="#0000FF";
}
if($DEBUG)echo "<br>memory=$memory";

//total disk space
$total_disk_hex=substr($hex_mes,($basic_bgn_byt+16)*2,8);
$total_disk_dec=HexDec($total_disk_hex);
if($DEBUG)echo "<br>total_disk_dec=$total_disk_dec";

//free disk space
$free_disk_hex=substr($hex_mes,($basic_bgn_byt+20)*2,8);
$free_disk_dec=HexDec($free_disk_hex);
if($DEBUG)echo "<br>free_disk_dec=$free_disk_dec";
if(isset($total_disk_dec)&&$total_disk_dec!=0)
{
	$diskRate=($free_disk_dec/$total_disk_dec)*100;
	$diskRate=number_format($diskRate, 2, '.', '');	
}
$disk=$free_disk_dec." / ".$total_disk_dec."&nbsp;&nbsp;".$diskRate."%";
if($free_disk_dec*10<$total_disk_dec){
	$color_disk="#FF0000";
	$no_sys_status=1;
}else{
	$color_disk="#0000FF";
}
if($DEBUG)echo "<br>disk=$memory";

/*******************
server send heartbeat
********************/
if($DEBUG)echo "<br>sysType=$sysType";
$sysTypeNo=omc_sys_type2code($sysType);
$sysSubNum=get_subsys_total($sysType);
$sysNo=floor($subSysNo/$sysSubNum);
$subSysNo=$subSysNo%$sysSubNum;

$showId=$sysType."_".$sysNo."_".$subSysNo;

$sel_mes_sql="SELECT detailStat,updateTime FROM $sysStat_table 
		  WHERE 
		  sysTypeNo='$sysTypeNo' AND sysNo='$sysNo' AND subSysNo='$subSysNo' 
		 ";
if($DEBUG)
	echo "<br>sel_mes_sql=$sel_mes_sql";
$sel_mes_res=mysqli_query($pubConn,$sel_mes_sql);
$sel_mes_row=@mysqli_fetch_array($sel_mes_res);
echo "<br>";
echo mysqli_error($pubConn);

if(!$sel_mes_row)
{
	echo "<br><font size='2'>$strNotInstalled</font>";
	exit();
}

$refresh_time=$sel_mes_row[updateTime];
if($DEBUG)
	echo "refresh_time=$refresh_time<br>";
if($refresh_time > $due_date && $refresh_time < $ove_date)
{
	$color_refresh_time="#0000FF";
}
else
{
	$no_sys_status=1;
	$color_refresh_time="#FF0000";
}

$hex_mes=$sel_mes_row[detailStat];
if($DEBUG)
	echo "<br>hex_mes=$hex_mes";

/*
$refresh_time=$sel_mes_row[updateTime];
if($refresh_time > $due_date && $refresh_time < $ove_date)
{
	$color_refresh_time="#0000FF";
}
else
{
	$color_refresh_time="#FF0000";
	$no_sys_status=1;
}
if($DEBUG)echo "<br>refresh_time=$refresh_time";
*/

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


if($sysType=='EMS')
{
	//begin bit
	$verBgn = 23;//version
	$sta_bgn=26;
	$sync_bgn=46;
	$num_bgn=66;//进程数目
	$pro_bgn=67;//服务器进程状态
	

	//main server status
	$hex_sta=substr($hex_mes,$sta_bgn*2,2);
	$dec_sta=HexDec($hex_sta);
	
	
	if($defineSyncStatus[$syn_state_dec][remark]=='Init')
	{
		$dec_sta=1;
	}
	$defineServerState=array(
				array('num'=> '0',	'remark' => 'Offline',		'color' => '#0000FF'),
				array('num'=> '1',	'remark' => 'Init',			'color' => '#0000FF'),
				array('num'=> '2',	'remark' => 'Detect',		'color' => '#0000FF'),
				array('num'=> '3',	'remark' => 'Slave',		'color' => '#0000FF'),
				array('num'=> '4',	'remark' => 'Sync',			'color' => '#0000FF'),
				array('num'=> '5',	'remark' => 'Master',		'color' => '#0000FF'),
				array('num'=> '6',	'remark' => 'Degrade',		'color' => '#0000FF'),
				array('num'=> '7',	'remark' => 'Single',		'color' => '#0000FF')
	);

	//sync information
	$arrSyncInfor[0]="First master log_file number";
	$arrSyncInfor[1]="Last master log_file number";
	$arrSyncInfor[2]="Master log position";
	$arrSyncInfor[3]="Slave log_file number";
	$arrSyncInfor[4]="Slave log position";
	for($i=0;$i<5;$i++)
	{
		$hex_sync=substr($hex_mes,$sync_bgn*2+$i*8,8);
		$dec_sync[$i]=HexDec($hex_sync);
		if($DEBUG)echo "<br>dec_sync[$i]=$dec_sync[$i]";
	}
	//进程数目
	$hex_pro_num=substr($hex_mes,$num_bgn*2,2);
	$pro_num=HexDec($hex_pro_num);
	if($DEBUG)	echo "<br>dec_pro_num=$pro_num";

	//服务器进程状态，每个byte表示一个进程的状态 （0=未运行，1=部分子进程未运行，2=正常运行,3=服务器上不运行该进程） 
	$array_proc_status=array(
				array('num'=> '0','remark' => 'stopped',	'color' => '#FF0000'),
				array('num'=> '1','remark' => 'working',	'color' => '#0000FF'),
				array('num'=> '2','remark' => 'suspended',			'color' => '#FF0000')
			 );
	for($i=0;$i< $pro_num;$i++)
	{
		${hex_process_.$i}=substr($hex_mes,$pro_bgn*2+$i*2,2);
		${dec_process_.$i}=HexDec(${hex_process_.$i});
		if($DEBUG)echo "<br>dec_process_$i=${dec_process_.$i}";
		if(${dec_process_.$i} < 1){
			$no_sys_status=1;
		}
	}
	
	//Version Information
	$hex_version_0=substr($hex_mes,($verBgn)*2,2);
	$dec_version_0=HexDec($hex_version_0);

	$hex_version_1=substr($hex_mes,($verBgn)*2+2,2);
	$dec_version_1=HexDec($hex_version_1);
	$dec_version_1=omc_keep_length($dec_version_1,0,2);

	$hex_version_2=substr($hex_mes,($verBgn)*2+4,2);
	$dec_version_2=HexDec($hex_version_2);
	$dec_version_2=omc_keep_length($dec_version_2,0,2);

	$version=$dec_version_0.".".$dec_version_1.".".$dec_version_2;
	$color_version="#0000FF";
	if($DEBUG)echo "<br>version=$version";
	
	
	$array_display_proc=array(
		array('num'=>'0', 'remark'=>'mysqld',			'proc_status'=>$array_proc_status[$dec_process_0][remark],	'proc_color'=>$array_proc_status[$dec_process_0][color],	'run'=>'Y'),	
		array('num'=>'1', 'remark'=>'httpd',			'proc_status'=>$array_proc_status[$dec_process_1][remark],	'proc_color'=>$array_proc_status[$dec_process_1][color],	'run'=>'Y'),
		array('num'=>'2', 'remark'=>'omcMain',			'proc_status'=>$array_proc_status[$dec_process_2][remark],	'proc_color'=>$array_proc_status[$dec_process_2][color],	'run'=>'Y'),
		array('num'=>'3', 'remark'=>'iptrans',			'proc_status'=>$array_proc_status[$dec_process_3][remark],	'proc_color'=>$array_proc_status[$dec_process_3][color],	'run'=>'Y'),
		array('num'=>'4', 'remark'=>'paraComm',			'proc_status'=>$array_proc_status[$dec_process_4][remark],	'proc_color'=>$array_proc_status[$dec_process_4][color],	'run'=>'Y'),
		array('num'=>'5', 'remark'=>'subsComm',		'proc_status'=>$array_proc_status[$dec_process_5][remark],	'proc_color'=>$array_proc_status[$dec_process_5][color],	'run'=>'Y'),
		array('num'=>'6', 'remark'=>'logCollector',		'proc_status'=>$array_proc_status[$dec_process_6][remark],	'proc_color'=>$array_proc_status[$dec_process_6][color],	'run'=>'Y'),
		array('num'=>'7', 'remark'=>'omcCleaner',		'proc_status'=>$array_proc_status[$dec_process_7][remark],	'proc_color'=>$array_proc_status[$dec_process_7][color],	'run'=>'N'),
		array('num'=>'8','remark'=>'smcli',			'proc_status'=>$array_proc_status[$dec_process_8][remark],	'proc_color'=>$array_proc_status[$dec_process_8][color], 'run'=>'Y'),
		array('num'=>'9','remark'=>'cdrCollector',	'proc_status'=>$array_proc_status[$dec_process_9][remark],	'proc_color'=>$array_proc_status[$dec_process_9][color], 'run'=>'Y'),
		array('num'=>'10','remark'=>'subsDataBackup',		'proc_status'=>$array_proc_status[$dec_process_10][remark],	'proc_color'=>$array_proc_status[$dec_process_10][color], 'run'=>'Y'),
		array('num'=>'11','remark'=>'ftpSend',			'proc_status'=>$array_proc_status[$dec_process_11][remark],	'proc_color'=>$array_proc_status[$dec_process_11][color], 'run'=>'Y'),
		array('num'=>'12','remark'=>'alarmAgent',			'proc_status'=>$array_proc_status[$dec_process_12][remark],	'proc_color'=>$array_proc_status[$dec_process_12][color], 'run'=>'Y'),
		array('num'=>'13','remark'=>'nrtrde',	'proc_status'=>$array_proc_status[$dec_process_13][remark],	'proc_color'=>$array_proc_status[$dec_process_13][color], 'run'=>'Y'),
		array('num'=>'14','remark'=>'sftpSend',	'proc_status'=>$array_proc_status[$dec_process_14][remark],	'proc_color'=>$array_proc_status[$dec_process_14][color], 'run'=>'Y'),

	);
}
elseif($sysType=='HLR' || $sysType=='SMSC')
{
	//echo "sysType=$sysType<br>";
	//begin bit

	$ver_bgn		=	23;	//version
	$sta_bgn		=	26; //hlr state
	$lcn_bgn		=	31; //license user
	$real_bgn		=	35;	//real user
	$snum_bgn		=	39;	//serial number
	
	//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);

	$version=$dec_ver_0.".".$dec_ver_1.".".$dec_ver_2;
	$color_version="#0000FF";
	if($DEBUG)echo "<br>version=$version";

	//main server status
	$bin_sta=substr($bin_mes,$sta_bgn*8,8);
	$dec_sta=BinDec($bin_sta);
	if($defineSyncStatus[$syn_state_dec][remark]=='Init'){
		$dec_sta=2;
	}
	if($dec_sta==4){
		$color_stoped="#FF0000";
		$no_sys_status=1;
	}
	else{
		$color_stoped="#0000FF";
	}
	$defineServerState=array(
				array('num'=> '0',	'remark' => $strNormal,		'color' => '#0000FF'),
				array('num'=> '1',	'remark' => $strRestart,	'color' => '#ff8c00'),
				array('num'=> '2',	'remark' => $strInitialize,	'color' => '#ff8c00'),
				array('num'=> '3',	'remark' => $strSuspend,	'color' => '#ff8c00'),
				array('num'=> '4',	'remark' => $strStop,		'color' => $color_stoped)
	);
	
	$hex_lcn=substr($hex_mes,$lcn_bgn*2,8);
	$lcnNum=HexDec($hex_lcn);

	$hex_real=substr($hex_mes,$real_bgn*2,8);
	$realNum=HexDec($hex_real);

	
	$serialNum = $srlArr[1][$sysNo][number];
	
}elseif($sysType=='AAS')
{
	//echo "sysType=$sysType<br>";
	//begin bit

	$alarmComp_bgn	=	14;// alarm component
	$alarmCode_bgn	=	16;// alarm code
	$ver_bgn		=	23;	//version
	$sta_bgn		=	26; //hlr state
	$lcn_bgn		=	31; //license user
	$real_bgn		=	35;	//real user
	$snum_bgn		=	39;	//serial number
	
	$bin_alarmComp=substr($bin_mes,$alarmComp_bgn*8,16);
	$dec_alarmComp=BinDec($bin_alarmComp);

	$bin_alarmCode=substr($bin_mes,$alarmCode_bgn*8,8);
	$dec_alarmCode=BinDec($bin_alarmCode);
	if($dec_alarmComp==1&&$dec_alarmCode==1)
		$biccAlarm=1;
	
	//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);

	$version=$dec_ver_0.".".$dec_ver_1.".".$dec_ver_2;
	$color_version="#0000FF";
	if($DEBUG)echo "<br>version=$version";

	//main server status
	$bin_sta=substr($bin_mes,$sta_bgn*8,8);
	$dec_sta=BinDec($bin_sta);
	if($defineSyncStatus[$syn_state_dec][remark]=='Init'){
		$dec_sta=2;
	}
	if($dec_sta==4){
		$color_stoped="#FF0000";
		$no_sys_status=1;
	}
	else{
		$color_stoped="#0000FF";
	}

	$defineServerState=array(
				array('num'=> '0',	'remark' => $strNormal,		'color' => '#0000FF'),
				array('num'=> '1',	'remark' => $strRestart,	'color' => '#ff8c00'),
				array('num'=> '2',	'remark' => $strInitialize,	'color' => '#ff8c00'),
				array('num'=> '3',	'remark' => $strSuspend,	'color' => '#ff8c00'),
				array('num'=> '4',	'remark' => $strStop,		'color' => $color_stoped)
	);
	
	$hex_lcn=substr($hex_mes,$lcn_bgn*2,8);
	$lcnNum=HexDec($hex_lcn);

	$hex_real=substr($hex_mes,$real_bgn*2,8);
	$realNum=HexDec($hex_real);

	

	$serialNum = $srlArr[5][$sysNo][number];
}elseif($sysType=='AUC'  || $sysType=='EIR'){
	//begin bit
	$mas_bgn	=	26;	//main master
	$ver_bgn	=	23;	//version information
	$snum		=	39; //serial number	

	$lcn_bgn	=	31; //license user
	$real_bgn	=	35;	//real user
	$hex_lcn=substr($hex_mes,$lcn_bgn*2,8);
	$lcnNum=HexDec($hex_lcn);
	$hex_real=substr($hex_mes,$real_bgn*2,8);
	$realNum=HexDec($hex_real);
	
	//whether master or not(0/1=Y/N)
	$bin_if_master=substr($bin_mes,$mas_bgn*8,1);
	$dec_if_master=BinDec($bin_if_master);
	if($DEBUG)echo "<br>dec_if_master=$dec_if_master";

	//bit5-3:main server status(0/1/2/3/4=restart/initialize/normal/suspend/stop)
	$bin_main_server_status=substr($bin_mes,$mas_bgn*8+2,3);
	$dec_sta=BinDec($bin_main_server_status);
	if($DEBUG)echo "<br>dec_sta=$dec_sta";
	if($defineSyncStatus[$syn_state_dec][remark]=='Init')
	{
		$dec_sta=1;
	}

	if($dec_if_master==0 && $dec_sta==4){
		$color_stoped="#FF0000";
		$no_sys_status=1;
	}
	else
	{
		$color_stoped="#0000FF";
	}

	$defineServerState=array(
				array('num'=> '0','remark' => $strRestart,		'color' => '#ff8c00'),
				array('num'=> '1','remark' => $strInitialize,	'color' => '#ff8c00'),
				array('num'=> '2','remark' => $strNormal,		'color' => '#0000FF'),
				array('num'=> '3','remark' => $strPause,		'color' => '#ff8c00'),
				array('num'=> '4','remark' => $strStop,			'color' => $color_stoped)
	);

	//Version Information
	$hex_version_0=substr($hex_mes,$ver_bgn*2,2);
	$dec_version_0=HexDec($hex_version_0);

	$hex_version_1=substr($hex_mes,$ver_bgn*2+2,2);
	$dec_version_1=HexDec($hex_version_1);
	$dec_version_1=omc_keep_length($dec_version_1,0,2);

	$hex_version_2=substr($hex_mes,$ver_bgn*2+4,2);
	$dec_version_2=HexDec($hex_version_2);
	$dec_version_2=omc_keep_length($dec_version_2,0,2);

	$version=$dec_version_0.".".$dec_version_1.".".$dec_version_2;
	$color_version="#0000FF";
	if($DEBUG)echo "<br>version=$version";
	
	if($sysType == 'AUC')
		$serialNum = $srlArr[2][$sysNo][number];
	else
		$serialNum = $srlArr[4][$sysNo][number];
	
}
elseif($sysType=='PPS')
{
	//begin bit
	$ver_bgn	=	23;	//version
	$sta_bgn	=	26; //pps state
	$lcn_bgn	=   31; //licensed users
	$real_bgn	=	35; //real users
	$snum_bgn	=	39; //serial number

	//version
	$hex_ver_0=substr($hex_mes,$ver_bgn*2,2);
	$dec_ver_0=HexDec($hex_ver_0);

	$hex_ver_1=substr($hex_mes,($ver_bgn+1)*2,2);
	$dec_ver_1=HexDec($hex_ver_1);
	$dec_ver_1=omc_keep_length($dec_ver_1,0,2);

	$hex_ver_2=substr($hex_mes,($ver_bgn+2)*2,2);
	$dec_ver_2=HexDec($hex_ver_2);
	$dec_ver_2=omc_keep_length($dec_ver_2,0,2);

	$version=$dec_ver_0.".".$dec_ver_1.".".$dec_ver_2;
	$color_version="#0000FF";
	if($DEBUG)echo "<br>version=$version";

	//main server status
	$hex_sta=substr($hex_mes,$sta_bgn*2,2);
	$dec_sta=HexDec($hex_sta);
	if($DEBUG)echo "<br>dec_sta=$dec_sta";
	if($defineSyncStatus[$syn_state_dec][remark]=='Init')
	{
		$dec_sta=2;
	}
	if($dec_sta==4)
	{
		$no_sys_status=1;
	}

	$defineServerState=array(
				array('num'=> '0',	'remark' => $strNormal,		'color' => '#0000FF'),
				array('num'=> '1',	'remark' => $strRestart,	'color' => '#ff8c00'),
				array('num'=> '2',	'remark' => $strInitialize,	'color' => '#ff8c00'),
				array('num'=> '3',	'remark' => $strSuspend,	'color' => '#ff8c00'),
				array('num'=> '4',	'remark' => $strStop,		'color' => '#FF0000')
	);

	$hex_lcn=substr($hex_mes,$lcn_bgn*2,8);
	$lcnNum=HexDec($hex_lcn);

	$hex_real=substr($hex_mes,$real_bgn*2,8);
	$realNum=HexDec($hex_real);

	$serialNum = $srlArr[3][$sysNo][number];
}elseif($sysType=='VSS'){
	$useSttArr = array(
		array(num => '0', remark => '--',  color => '#000000'),
		array(num => '1', remark => 'Y',  color => '#0000FF')
	);

	$linkSttArr = array(
		array(num => '0', remark => 'N',  color => '#FF0000'),
		array(num => '1', remark => 'Y',  color => '#0000FF'),
		array(num => '2', remark => '--',  color => '#000000')
	);
	
	$linkTypeArr = array(
		array(num => '0', remark => 'E1',  color => '#000000'),
		array(num => '1', remark => 'T1',  color => '#000000'),
		array(num => '2', remark => '--',  color => '#000000')
	);
	
	$voiceRuleArr = array(
		array(num => '0', remark => 'A LAW',  color => '#000000'),
		array(num => '1', remark => 'MU LAW',  color => '#000000')
	);
	
	$chnSttArr = array(
		array(num => '0', remark => '--', color => '#000000'),
		array(num => '1', remark => 'Y',  color => '#0000FF')
	);
	
	$VSS_funcFlagArr = array(
		array(num => '0', remark => 'None'),
		array(num => '1', remark => 'VMS'),
		array(num => '2', remark => 'AAS'),
		array(num => '3', remark => 'VMS&AAS')
	);

	//begin byte
	$ver_bgn	=	23;	//version
	$ttl_box	=	31; //total mailboxs
	$ena_box	=	35; //registered mailboxs
	$act_box	=	43; //active mailboxs
	$ttl_vce	=	47; //total voicemails
	$ttl_sec	=	51; //total seconds of voicemails
	$avr_sec	=	55; //average seconds of voicemails
	$stt_e0		=	67; //E1 #0 status (bit 0: 0/1 not in used / in used; bit 1: 0/1 link not ok / link ok
						//				link type bit 2: 0/1 in E1/T1;voice rule bit 3: 0/1 in A LAW/MU LAW)
	$stt_e1		=	68; //E1 #1 status
	$chn_u0		=	69; //E1 #0 used channel
	$chn_u1		=	70; //E1 #1 used channel
	$chn_s0		=	71; //E1 #0 channel status (use a bit to indetify one channel)
	$chn_s1		=	75; //E1 #1 channel status
	$smpp_stat	=	59; //smpp status
	$func_flag	=	80; //VSS function flag
	
	//Field01:Version Information
	$version_0=substr($hex_mes,($ver_bgn+0)*2,2);
	$version_0=hexdec($version_0);

	$version_1=substr($hex_mes,($ver_bgn+1)*2,2);
	$version_1=omc_keep_length($version_1,0,2);
	$version_1=hexdec($version_1);
	
	$version_2=substr($hex_mes,($ver_bgn+2)*2,2);
	$version_2=omc_keep_length($version_2,0,2);
	$version_2=hexdec($version_2);
	
	$version=$version_0.".".$version_1.".".$version_2;

	$color_version="#0000FF";
	if($DEBUG)	echo "<br>version=$version";

	//Field02:total mailboxs
	$hexTotBox=substr($hex_mes,$ttl_box*2,8);
	$totBox=HexDec($hexTotBox);
	if($DEBUG)echo "<br>totBox=$totBox";

	//Field03:$ena_box
	$hexEnaBox=substr($hex_mes,$ena_box*2,8);
	$enaBox=HexDec($hexEnaBox);
	if($DEBUG)echo "<br>enaBox=$enaBox";

	//Field04:$act_box
	$hexActBox=substr($hex_mes,$act_box*2,8);
	$actBox=HexDec($hexActBox);
	if($DEBUG)echo "<br>actBox=$actBox";

	//Field05:total voicemails
	$hexTotVoi=substr($hex_mes,$ttl_vce*2,8);
	$totVoi=HexDec($hexTotVoi);
	if($DEBUG)echo "<br>totVoi=$totVoi";

	//Field06:
	$hexTtlVoi=substr($hex_mes,$ttl_sec*2,8);
	$ttlVoi=HexDec($hexTtlVoi);
	if($DEBUG)echo "<br>ttlVoi=$ttlVoi";

	//Field07:
	$hexAvrVoi=substr($hex_mes,$avr_sec*2,8);
	$avrVoi=HexDec($hexAvrVoi);
	if($DEBUG)echo "<br>avrVoi=$avrVoi";

	//Field08 E1#0 status (bit 0: 0/1 not in used / in used; bit 1: 0/1 link not ok / link ok
							//link type bit 2: 0/1 in E1/T1;voice rule bit 3: 0/1 in A LAW/MU LAW)
	for($i=0;$i<4;$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;
		$sttE0[2] = 2;
		$sttE0[3] = 2;
	}

	//Field09 E1#1 status
	for($i=0;$i<4;$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;
		$sttE1[2] = 2;
		$sttE1[3] = 2;
	}

	if(($sttE0[0] && !$sttE0[1]) || ($sttE1[0] && !$sttE1[1])){
		$no_sys_status = 1;
	}

	//Field10 E1 #0 used channel
	$hexChnU0=substr($hex_mes,$chn_u0*2,2);
	$chnU0=HexDec($hexChnU0);
	if(!$sttE0[0]){
		$chnU0 = "--";
	}
	
	//Field11 E1 #1 used channel
	$hexChnU1=substr($hex_mes,$chn_u1*2,2);
	$chnU1=HexDec($hexChnU1);
	if(!$sttE1[0]){
		$chnU1 = "--";
	}

	//Field12 E1 #0 channel status (use a bit to indetify one channel)
	for($i=0;$i<4;$i++){
		for($j=0;$j<8;$j++){
			$dstNum = $i*8+$j;
			$binChnS0=substr($bin_mes,($chn_s0+$i)*8+7-$j,1);
			$chnS0[$dstNum]=BinDec($binChnS0);
			if($DEBUG)echo "<br>chnS0[$dstNum]={$chnS0[$dstNum]}";
		}
	}

	//Field13 E1 #1 channel status (use a bit to indetify one channel)
	for($i=0;$i<4;$i++){
		for($j=0;$j<8;$j++){
			$dstNum = $i*8+$j;
			$binChnS1=substr($bin_mes,($chn_s1+$i)*8+7-$j,1);
			$chnS1[$dstNum]=BinDec($binChnS1);
			if($DEBUG)echo "<br>chnS1[$dstNum]={$chnS1[$dstNum]}";
		}
	}
	
	//Field14 SMPP status(1bytes,smpp_stat):
	$smppStat=substr($hex_mes,$smpp_stat*2,2);
	if($DEBUG)echo "<br>smppStat=$smppStat";
	
	$funcFlag=hexdec(substr($hex_mes,$func_flag*2,2));
	if($DEBUG)echo "<br>funcFlag=$funcFlag";
	
	$serialNum = $srlArr[5][$sysNo][number];
//	if($smppStat < 1){
//		$no_sys_status = 1;
//	}
}elseif($sysType=='MSC' || $sysType=='SN'){

	//begin bit
	$lcn_bgn	=	31; //license user
	$real_bgn	=	35;	//real user
	$hex_lcn=substr($hex_mes,$lcn_bgn*2,8);
	$lcnNum=HexDec($hex_lcn);
	$hex_real=substr($hex_mes,$real_bgn*2,8);
	$realNum=HexDec($hex_real);
	$msc_bgn_byt=21;
	$msc_len_hex=substr($hex_mes,$msc_bgn_byt*2,4);//msc length
	$msc_len_dec=HexDec($msc_len_hex);
	if($DEBUG)echo "<br>msc_len_dec=$msc_len_dec";

	//Field01(3bytes,18-20):Version Information
	$version_0=substr($hex_mes,($msc_bgn_byt+2)*2,2);
	$version_0=hexdec($version_0);

	$version_1=substr($hex_mes,($msc_bgn_byt+3)*2,2);
	$version_1=omc_keep_length($version_1,0,2);
	$version_1=hexdec($version_1);
	
	$version_2=substr($hex_mes,($msc_bgn_byt+4)*2,2);
	$version_2=omc_keep_length($version_2,0,2);
	$version_2=hexdec($version_2);

	$version=$version_0.".".$version_1.".".$version_2;
	$color_version="#0000FF";
	if($DEBUG)	echo "<br>version=$version";

	//main server status（0/1/2/3/4=normal/restart/initialize/suspend/stop）
	$hex_sta=substr($hex_mes,($msc_bgn_byt+5)*2,2);
	$dec_sta=HexDec($hex_sta);
	if($DEBUG)echo "<br>dec_sta=$dec_sta";
	if($defineSyncStatus[$syn_state_dec][remark]=='Init'){
		$dec_sta=2;
	}
	if($dec_sta==4){
		$no_sys_status=1;
	}

	$defineServerState=array(
				array('num'=> '0','remark' => $strNormal,		'color' => '#0000FF'),
				array('num'=> '1','remark' => $strRestart,		'color' => '#ff8c00'),
				array('num'=> '2','remark' => $strInitialize,	'color' => '#ff8c00'),
				array('num'=> '3','remark' => $strSuspend,		'color' => '#ff8c00'),
				array('num'=> '4','remark' => $strStop,			'color' => '#FF0000'),
				array('num'=> '5','remark' => $strWait,		'color' => '#ff8c00'),
				array('num'=> '6','remark' => $strSingle,			'color' => '#0000FF')
	);

	//E1 status
	$arrayDefineStatus=array(
				array('num'=> '0','remark' => 'TUP',		'color' => '#0000FF'),
				array('num'=> '1','remark' => 'ISUP',		'color' => '#0000FF'),
				array('num'=> '2','remark' => 'AIF',		'color' => '#0000FF'),
				array('num'=> '3','remark' => 'ISDN NT',	'color' => '#0000FF'),
				array('num'=> '4','remark' => 'ISDN LT',	'color' => '#0000FF'),
				array('num'=> '5','remark' => 'Error',		'color' => '#FF0000'),
				array('num'=> '6','remark' => 'Error',		'color' => '#FF0000'),
				array('num'=> '7','remark' => '--',			'color' => '#000000')
	);

	if($no_sys_status)
	{
		$color_sys_status="#FF0000";
		$sys_status="Error";
	}
	else
	{
		$color_sys_status="#0000FF";
		$sys_status="Normal";
	}

	/****************VLR heartbeat***************/
	$showVlrId="VLR_".$sysNo."_".$subSysNo;
	$vlr_bgn_byt=$msc_bgn_byt+4+$msc_len_dec;
	if($DEBUG)echo "<br>vlr_bgn_byt=$vlr_bgn_byt";
	$vlr_len_hex=substr($hex_mes,$vlr_bgn_byt*2,4);//vlr length
	$vlr_len_dec=HexDec($vlr_len_hex);
	if($DEBUG)echo "<br>vlr_len_dec=$vlr_len_dec";
	if($vlr_len_dec==0)
	{
		$noShowVlr=1;
	}
	//Field01:Version Information
	$vlr_version_0=substr($hex_mes,($vlr_bgn_byt+2)*2,2);
	$vlr_version_0=hexdec($vlr_version_0);

	$vlr_version_1=substr($hex_mes,($vlr_bgn_byt+3)*2,2);
	$vlr_version_1=hexdec($vlr_version_1);
	$vlr_version_1=omc_keep_length($vlr_version_1,0,2);

	$vlr_version_2=substr($hex_mes,($vlr_bgn_byt+4)*2,2);
	$vlr_version_2=hexdec($vlr_version_2);
	$vlr_version_2=omc_keep_length($vlr_version_2,0,2);
	
	$vlr_version=$vlr_version_0.".".$vlr_version_1.".".$vlr_version_2;
	$color_vlr_version="#0000FF";
	if($DEBUG)echo "<br>vlr_version=$vlr_version";

	//vlr status（/1/2/3/4=SearchVLR/Sync/Single/Dual/）
	$hex_vlr_status=substr($hex_mes,($vlr_bgn_byt+5)*2,2);
	$dec_vlr_status=HexDec($hex_vlr_status);
	if($DEBUG)echo "<br>dec_vlr_status=$dec_vlr_status";
	{//add by arwean 2006-03-15
	$hex_vlr_lcn=substr($hex_mes,($vlr_bgn_byt+10)*2,8);
	$vlr_lcnNum=HexDec($hex_vlr_lcn);
	}
	//VLR user number
	$hex_vlr_num	= substr($hex_mes,($vlr_bgn_byt+14)*2,8);
	$dec_vlr_num	= hexdec($hex_vlr_num);
	if($DEBUG)	echo "<br>dec_vlr_num = $dec_vlr_num";

	$array_vlr_status=array(
				array('num'=> '1','remark' => 'SearchVLR',		'color' => '#0000FF'),
				array('num'=> '2','remark' => 'Sync',			'color' => '#0000FF'),
				array('num'=> '3','remark' => 'Single',			'color' => '#0000FF'),
				array('num'=> '4','remark' => 'Normal',			'color' => '#0000FF')
	);
	
	if($no_vlr_status){
		$color_vlr_status="#FF0000";
		$vlr_status="Error";
		$no_sys_status = 1;
	}
	else{
		$color_vlr_status="#0000FF";
		$vlr_status="Normal";
	}
	$serialNum = $srlArr[0][$sysNo][number];//add by arwean 2006-03-15
	//system("echo sn srlArr[4][$sysNo][number] == {$srlArr[4][$sysNo][number]} status>>debug.txt");
}elseif($sysType=='SMEG')
{
	if($DEBUG)echo "SMEG.bin=$hex_mes<br>";
	$smeg_state_label=array(0=>"Normal",1=>"Restart",2=>"Init",3=>"Suspend",4=>"Stop",5=>"Disable");
	$smeg_state_color=array(0=>"#0000FF",1=>"#0000FF",2=>"#0000FF",3=>"#0000FF",4=>"#FF0000",5=>"#FF0000");
	$smpp_smtp_pos=43;
	$smeg_smpp_tx=substr($hex_mes,$smpp_smtp_pos++*2,2)+0;
	$smeg_smpp_rx=substr($hex_mes,$smpp_smtp_pos++*2,2)+0;
	$smeg_smtp_tx=substr($hex_mes,$smpp_smtp_pos++*2,2)+0;
	$smeg_smtp_rx=substr($hex_mes,$smpp_smtp_pos*2,2)+0;
	if($DEBUG)echo "smeg_smpp_tx=$smeg_smpp_tx,smeg_smpp_rx=$smeg_smpp_rx,smeg_smtp_tx=$smeg_smtp_tx,smeg_smtp_rx=$smeg_smtp_rx<br>";
}elseif($sysType=='OPPS')
{
        //$DEBUG=1;
        if($DEBUG)echo "OPPS.bin=$hex_mes<br>";
        $opr_state_pos=52;
        $opr_license_pos=70;
        $opr_realuser_pos=78;
        $opr_serial_pos=86;
        $opr_service_state_pos=94;
        $opr_state_label=array(0=>"Normal",1=>"Restart",2=>"Init",3=>"Suspend",4=>"Shutdown");
        $opr_state_color=array(0=>"#0000FF",1=>"#FF0000",2=>"#0000FF",3=>"#FF0000",4=>"#FF0000");
        $opr_state=hexdec(substr($hex_mes,$opr_state_pos,2));
        $opr_license=hexdec(substr($hex_mes,$opr_license_pos,8));
        $opr_realuser=hexdec(substr($hex_mes,$opr_realuser_pos,8));
        $opr_serial=substr($hex_mes,$opr_serial_pos,8);
        $opr_service_state_label=array(0=>"Disabled",1=>"Normal");
        $opr_service_state=substr($hex_mes,$opr_service_state_pos,2);
        if($DEBUG)echo "state=$opr_state,license=$opr_license,realuser=$opr_realuser,serial=$opr_serial<br>";
        //$DEBUG=0;
}



if($no_sys_status){
	$color_sys_status="#FF0000";
	$sys_status="Error";
}else{
	$color_sys_status="#0000FF";
	$sys_status="Normal";
}

if($mod_type==0)
{
	if(!$showbasic)
	{
		echo "<br><font size='2'>$strNotInstalled</font>";
		exit();
	}
	if($platStatus)
	{
		$showPlatRemark = "N";
		$showPlatColor = "#FF0000";
	}
	else
	{
		$showPlatRemark = "Y";
		$showPlatColor = "0000FF";
	}
?>
	
	<p></p>
	<table border="0" width="100%" cellpadding="0" cellspacing="1">
		<?php
		echo "<tr>";
			echo "<td>&nbsp;";                 
				echo "<input type=\"hidden\" name=\"backpage\" value=\"$backpage\">";
			echo "</td>";
		echo "</tr>";
		?>
		<tr><td><p align="center"><font color="#0000FF" size="2">
		<?php
		echo "$showId";
		$sysAlias=omc_get_sysAlias($sysTypeNo,$sysNo,$subSysNo);
		if($sysAlias!=-1)
		{
			echo " [$sysAlias]";
		}
		echo " $strStatusInformation</font>";
		
		if($sysType=='HLR' || $sysType=='AUC'  || $sysType=='EIR' || $sysType=='SMSC' || $sysType=='PPS' || $sysType=='VSS' || $sysType=='MSC' || $sysType=='EMS' || $sysType=='SN' || $sysType=='AAS')
		{
			echo "($strVersion:";
			echo "<font color=\"#0000FF\">$version</font>";
			echo ")";
		}
		?>
		</p></td></tr>
	</table>
	
	<table border="1" width="100%" cellpadding="1" cellspacing="0" bordercolor="#666666" 	  bordercolordark="#FFFFFF" bgcolor="#FFFFFF">
	<tr>
		<td bgcolor="#E6E6E6" width="50%">
			<nobr><font color="000000"><?php echo $strBasicStatus; ?></font></nobr>
		</td>
		<!--
		<td bgcolor="#FFFFFF" width="50%"><nobr><font color="<?php echo $color_sys_status; ?>"><?php echo $sys_status; ?></font></nobr>
		-->
		<td bgcolor="#FFFFFF" width="50%">
			<nobr><?php
				outSpanId('input_sys_status',$sys_status,$color_sys_status);
				 ?></nobr>
		</td>
	</tr>
	<?php
	if($sysType=='HLR' || $sysType=='AUC'  || $sysType=='EIR' || $sysType=='PPS' || $sysType=='EMS' || $sysType=='MSC' || $sysType=='SN')
	{
		echo "<tr>";
			echo "<td bgcolor=\"#E6E6E6\" width=\"50%\">
			<nobr><font color=\"000000\">$strDualServerMode</font></nobr>";
			echo "</td>";
			echo "<td bgcolor=\"#FFFFFF\" width=\"50%\"";
			outSpanId('input_serverState',$defineServerState[$dec_sta][remark],$defineServerState[$dec_sta][color]);
			echo "</td>";
		echo "</tr>";
	}
	?>
	<tr>
		<td bgcolor="#E6E6E6" width="50%">
		<nobr><font color="000000"><?php echo $strRefreshTime; ?></font></nobr>
		</td>
		<td bgcolor="#FFFFFF" width="50%">
		<!--
		<nobr><font color="<?php echo $color_refresh_time; ?>"><?php echo $refresh_time; ?></font></nobr>
		-->
		<nobr><?php 
			outSpanId('input_refresh_time',$refresh_time,$color_refresh_time);
			?></nobr>
		</td>
	</tr>
	<tr>
	<td bgcolor="#E6E6E6" width="50%">
	<nobr><font color="000000"><?php echo $strStartTime; ?></font></nobr>
	</td>
	<td bgcolor="#FFFFFF" width="50%">
	<nobr><font color="#0000FF"><?php echo $uptime; ?></font></nobr>
	</td>
	</tr>
	<tr>
	<td bgcolor="#E6E6E6" width="50%"><nobr><font color="000000"><?php echo "$strPhysicsMemory($strRemainAll)"; ?>(KB)</font></nobr></td>
	<td bgcolor="#FFFFFF" width="50%"><nobr>
		<?php 
		outSpanId('input_memory',$memory,$color_memory);
		?>
	</nobr></td>
	</tr>
	<tr>
	<td bgcolor="#E6E6E6" width="50%"><nobr><font color="000000"><?php echo "$strHardDiskSpace($strRemainAll)"; ?>(KB)</font></nobr></td>
	<td bgcolor="#FFFFFF" width="50%"><nobr>
		<?php outSpanId('input_disk',$disk,$color_disk); ?>

	</nobr></td>
	</tr>
	<?php
	//SMEG
	if($sysType=='SMEG')
	{
		echo "<tr><td bgcolor=\"#E6E6E6\">SMPP TX</td>";
		echo "<td><font color=\"{$smeg_state_color[$smeg_smpp_tx]}\">$smeg_state_label[$smeg_smpp_tx]</td></tr>";
		
		echo "<tr><td bgcolor=\"#E6E6E6\">SMPP RX</td>";
		echo "<td><font color=\"{$smeg_state_color[$smeg_smpp_rx]}\">$smeg_state_label[$smeg_smpp_rx]</td></tr>";
		
		echo "<tr><td bgcolor=\"#E6E6E6\">SMTP TX</td>";
		echo "<td><font color=\"{$smeg_state_color[$smeg_smtp_tx]}\">$smeg_state_label[$smeg_smtp_tx]</td></tr>";
		
		echo "<tr><td bgcolor=\"#E6E6E6\">SMTP RX</td>";
		echo "<td><font color=\"{$smeg_state_color[$smeg_smtp_rx]}\">$smeg_state_label[$smeg_smtp_rx]</td></tr>";
	}
	
	if($sysType=="OPPS")
  {
  	//echo "<tr><td bgcolor=\"#E6E6E6\">State</td>";
    //echo "<td><font color=\"{$opr_state_color[$opr_state]}\">$opr_state_label[$opr_state]</td></tr>";
    echo "<tr><td bgcolor=\"#E6E6E6\">License</td>";
    echo "<td>$opr_license</td></tr>";
    echo "<tr><td bgcolor=\"#E6E6E6\">Real user</td>";
    echo "<td>$opr_realuser</td></tr>";
    echo "<tr><td bgcolor=\"#E6E6E6\">Serial number</td>";
    echo "<td>$opr_serial</td></tr>";
    
    $opr_service_state1=substr($opr_service_state,0,1)+0;
    $opr_service_state2=substr($opr_service_state,1,1)+0;
    echo "<tr><td bgcolor=\"#E6E6E6\">OPR</td>";
    echo "<td><font color=blue>{$opr_service_state_label[$opr_service_state1]}</font></td></tr>";
  	echo "<tr><td bgcolor=\"#E6E6E6\">IMDX</td>";
    echo "<td><font color=blue>{$opr_service_state_label[$opr_service_state2]}</font></td></tr>";
  
  }

	
	if($sysType=='EMS')
	{	
		for($i=0;$i<5;$i++)
		{
			$id = "input_dec_sync" . "_$i";
			echo "<tr>";
			echo "<td bgcolor=\"#E6E6E6\" width=\"50%\">
			<nobr><font color=\"000000\">$arrSyncInfor[$i]</font></nobr>";
			echo "</td>";
			echo "<td bgcolor=\"#FFFFFF\" width=\"50%\"><nobr>";
			outSpanId($id,$dec_sync[$i],'#0000FF');
			echo "</td></nobr>";
			echo "</tr>";
		}
	}
	if($sysType=='HLR' || $sysType=='PPS' || $sysType=='SMSC' || $sysType=='AUC' || $sysType=='MSC'){
		$LicenseStr = ($sysType=='MSC') ? "E1 license" : "License";
		$UserStr = ($sysType=='MSC') ? "E1 used" : "Users";
		echo "<tr>";
		echo "<td bgcolor=\"#E6E6E6\" width=\"50%\">$LicenseStr</td>";
		echo "<td width=\"50%\"><font color=\"#0000FF\">$lcnNum</font></td>";
		echo "</tr>";
	//	if($sysType=='PPS'){
			if($sysType=='SMSC')
				echo "<tr style=\"display:none\">";
			else	
				echo "<tr>";	
			echo "<td bgcolor=\"#E6E6E6\" width=\"50%\">$UserStr</td>";
			echo "<td>";
			outSpanId('input_realNum',$realNum,'#0000FF');
			echo "</td>";
			echo "</tr>";
	//	}
	}
	
	if($sysType=='HLR' || $sysType=='PPS' || $sysType=='AUC' || $sysType=='EIR'  || $sysType=='VSS' || $sysType=='MSC' || $sysType=='SMSC'){
		echo "<tr>";
		echo "<td bgcolor=\"#E6E6E6\" width=\"50%\">Serial number</td>";
		echo "<td width=\"50%\"><font color=\"$ttlSrlClr\">$serialNum</font></td>";
		echo "</tr>";
	}
	
	
	if($sysType=='VSS'){
		echo "<tr>";
		echo "<td bgcolor=\"#E6E6E6\" width=\"50%\">Total mailboxs</td>";
		echo "<td width=\"50%\"><font color=\"#0000FF\">$totBox</font></td>";
		echo "</tr>";
		
		echo "<tr>";
		echo "<td bgcolor=\"#E6E6E6\" width=\"50%\">Registered mailboxs</td>";
		echo "<td width=\"50%\"><font color=\"#0000FF\">$enaBox</font></td>";
		echo "</tr>";
	
		echo "<tr>";
		echo "<td bgcolor=\"#E6E6E6\" width=\"50%\">Active mailboxs</td>";
		echo "<td width=\"50%\"><font color=\"#0000FF\">$actBox</font></td>";
		echo "</tr>";
	
		echo "<tr>";
		echo "<td bgcolor=\"#E6E6E6\" width=\"50%\">Total voicemails</td>";
		echo "<td width=\"50%\"><font color=\"#0000FF\">$totVoi</font></td>";
		echo "</tr>";
	
		echo "<tr>";
		echo "<td bgcolor=\"#E6E6E6\" width=\"50%\">Total seconds of voicemails</td>";
		echo "<td width=\"50%\"><font color=\"#0000FF\">$ttlVoi</font></td>";
		echo "</tr>";
	
		echo "<tr>";
		echo "<td bgcolor=\"#E6E6E6\" width=\"50%\">Average seconds of voicemails</td>";
		echo "<td width=\"50%\"><font color=\"#0000FF\">$avrVoi</font></td>";
		echo "</tr>";
	
		echo "<tr>";
		echo "<td bgcolor=\"#E6E6E6\" width=\"50%\">SMPP state</td>";
		if($smppStat > 0){
			echo "<td width=\"50%\"><font color=\"#0000FF\">Established</font></td>";
		}else{
			echo "<td width=\"50%\"><font color=\"#0000FF\">Not established</font></td>";
		}
		echo "</tr>";
		
		/*
		echo "<tr>";
		echo "<td bgcolor=\"#E6E6E6\" width=\"50%\">VSS function flag</td>";
		echo "<td width=\"50%\"><font color=\"#0000FF\">{$VSS_funcFlagArr[$funcFlag][remark]}</font></td>";
		echo "</tr>";
		*/
		echo "</table>";
	
		echo "<p> </p>";
		echo "<table style=\"display:none;\" border=\"1\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666666\"  bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">";
		echo "<tr bgcolor=\"#E6E6E6\" align=\"center\">";
		echo "<td width=\"50%\" colspan=\"4\">{$linkTypeArr[$sttE0[2]][remark]} #0</td>";
		echo "<td width=\"50%\" colspan=\"4\">{$linkTypeArr[$sttE1[2]][remark]} #1</td>";
		echo "</tr>";
	
		echo "<tr>";
		echo "<td width=\"50%\" colspan=\"4\">Used flag:&nbsp;<font color=\"{$useSttArr[$sttE0[0]][color]}\">{$useSttArr[$sttE0[0]][remark]}</font>";
		echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Link status:&nbsp;<font color=\"{$linkSttArr[$sttE0[1]][color]}\">{$linkSttArr[$sttE0[1]][remark]}</font>";
		echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CH in used:&nbsp;<font color=\"0000FF\">$chnU0</font>";
		echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Voice rule:&nbsp;<font color=\"0000FF\">{$voiceRuleArr[$sttE0[3]][remark]}</font>";
	
		echo "<td width=\"50%\" colspan=\"4\">Used flag:&nbsp;<font color=\"{$useSttArr[$sttE1[0]][color]}\">{$useSttArr[$sttE1[0]][remark]}</font>";
		echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Link status:&nbsp;<font color=\"{$linkSttArr[$sttE1[1]][color]}\">{$linkSttArr[$sttE1[1]][remark]}</font>";
		echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CH in used:&nbsp;<font color=\"0000FF\">$chnU1</font>";
		echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Voice rule:&nbsp;<font color=\"0000FF\">{$voiceRuleArr[$sttE1[3]][remark]}</font>";
		echo "</tr>";
		for($i=0;$i<16;$i++){
			echo "<tr>";
			for($j=0;$j<2;$j++){
				$showNum = $j*16+$i;
				echo "<td width=\"12.5\">";
				echo omc_keep_length($showNum,0,2);
				echo "</td>";
				echo "<td width=\"12.5\">";
				echo "<font color=\"{$chnSttArr[$chnS0[$showNum]][color]}\">{$chnSttArr[$chnS0[$showNum]][remark]}</font>";
				echo "</td>";
			}
			for($j=0;$j<2;$j++){
				$showNum = $j*16+$i;
				echo "<td width=\"12.5\">";
				echo omc_keep_length($showNum,0,2);
				echo "</td>";
				echo "<td width=\"12.5\">";
				echo "<font color=\"{$chnSttArr[$chnS1[$showNum]][color]}\">{$chnSttArr[$chnS1[$showNum]][remark]}</font>";
				echo "</td>";
			}
			echo "</tr>";
		}
	}
	
	if($sysType=='AAS'){
		echo "</TABLE>";
		echo "<BR><BR>";
		echo "<table border=\"1\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666666\"  bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">";
		if($biccAlarm==1){
			echo "<tr bgcolor=\"#E6E6E6\" align=\"center\">";
			echo "<td width=\"50%\" align=\"left\">Alarm</td>";
			echo "<td width=\"50%\" align=\"left\"><FONT color=\"#FF0000\">BICC trunk not reachable</FONT></td>";
			echo "</tr>";
		}
		
	}
	
	echo "</table>";
	if($sysType=='EMS')
	{
		echo "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"1\">";
		echo "<tr><td><p align=\"center\"><font color=\"#0000ff\" size=\"2\">$strProcessStatus</font></p></td></tr></table>";
		echo "<table border=\"1\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">";
		echo "<tr><td bgcolor=\"#E6E6E6\" width=\"25%\"><nobr><font color=\"000000\">$strProcessID</font></nobr></td><td bgcolor=\"#E6E6E6\" width=\"25%\"><nobr><font color=\"000000\">$strProcessName</font></nobr></td><td bgcolor=\"#E6E6E6\" width=\"25%\"><nobr><font color=\"000000\">$strProcessStatus</font></nobr></td></tr>";
	
		for($i=0;$i< $pro_num;$i++)
		{
			$proc_num=${dec_process_.$i};
			$show_num=omc_keep_length($i,0,2);
	
			if($proc_num!=3)
			{
				$id = "input_proc_status" . "_$show_num";
				echo "<tr><td bgcolor=\"#FFFFFF\" width=\"25%\"><nobr><font color=\"000000\">$show_num</font></nobr></td>";
				echo "<td bgcolor=\"#FFFFFF\" width=\"25%\"><nobr><font color=\"000000\">{$array_display_proc[$i][remark]}</font></nobr></td>";
				echo"<td>";
				outSpanId($id,$array_display_proc[$i][proc_status],$array_display_proc[$i][proc_color]);
				echo "</td>";
			}
		}
		echo "</table>";
	}//end if($PlatTypeDefArr[$sysNo][remark]=='EMS')
	elseif(!$noShowVlr && $sysType == 'MSC')
	{
		echo "<p> </p>";
		echo "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"1\">";
		echo "<tr><td><p align=\"center\"><font color=\"#0000FF\" size=\"2\">";
		echo "$showVlrId";
		$sysAlias=omc_get_sysAlias($sysTypeNo,$sysNo,$subSysNo);
		if($sysAlias!=-1){
			echo " [$sysAlias]";
		}
		echo " $strStatusInformation</font>";
		echo "($strVersion:";
		echo "<font color=\"#0000FF\">$vlr_version</font>";
		echo ")</p></td></tr></table>";
		echo "<table border=\"1\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">";
		echo "<tr>";
		echo "<td bgcolor=\"#E6E6E6\" width=\"50%\">";
		echo "<nobr><font color=\"000000\">$strRefreshTime</font></nobr></td>";
		echo "<td bgcolor=\"#FFFFFF\" width=\"50%\">";
		outSpanId('input_refresh_time_vlr',$refresh_time,$color_refresh_time);
		echo "<tr><td bgcolor=\"#E6E6E6\" width=\"50%\">";
		echo "<nobr><font color=\"000000\">$strBasicStatus</font></nobr></td>";
		echo "<td bgcolor=\"#FFFFFF\" width=\"50%\"><nobr>";
		outSpanId('input_vlr_status',$vlr_status,$color_vlr_status);
		echo "</nobr></td>";
		
		echo "<tr><td bgcolor=\"#E6E6E6\" width=\"50%\"><nobr><font color=\"000000\">$strDualServerMode</font></nobr></td>";
		echo "<td bgcolor=\"#FFFFFF\" width=\"50%\"><nobr>";
		outSpanId('input_servState_vlr',$defineServerState[$dec_sta][remark],$defineServerState[$dec_sta][color]);
		echo "</nobr></td>";
	
		echo "<tr><td bgcolor=\"#E6E6E6\" width=\"50%\"><nobr><font color=\"000000\">$strVlrNum</font></nobr></td>";
		echo "<td bgcolor=\"#FFFFFF\" width=\"50%\">";
		outSpanId('input_dec_vlr_num',$dec_vlr_num,'#0000FF');		
		echo "</nobr></td>";
		
		echo "<tr><td bgcolor=\"#E6E6E6\" width=\"50%\"><nobr><font color=\"000000\">License</font></nobr></td>";
		echo "<td bgcolor=\"#FFFFFF\" width=\"50%\">";
		echo "<nobr><font color=\"#0000FF\">$vlr_lcnNum</font>";	
		echo "</tr></table>";
	}
	if($sysType=='SMSC')
	{
		//show smpp link status, zhengjianhui 2008-12-3
		$smpp_link_status_color=array(0=>"#aeaeae",1=>"#000000",2=>"#00ff00",3=>"#0000ff",4=>"#ff00ff");
		$smpp_link_status_label=array(0=>"Not Init",1=>"Idle",2=>"Waiting",3=>"Established",4=>"Suspend");
		
		//echo "sysNo=$sysNo<br>$hex_mes<br>";
		$smpp_link_status_pos=47;
		$smpp_link_status_len=32;
		$smpp_link_status_hex=substr($hex_mes,$smpp_link_status_pos*2,$smpp_link_status_len*2);
		echo "<br><center><font color=blue>SMPP Link Status</font></center>";
		echo "<table border=\"1\" width=\"100%\" cellpadding=\"2\" cellspacing=\"0\"  bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">";

		//smpp link alias
		$smpp_link_alias_oid="2.2.1.1.2";
		//oidwhere
		$levelArr=explode('.',$smpp_link_alias_oid);
		for($j=0;$j<sizeof($levelArr);$j++){
			$levelNo=$j+1;
			${"level_$levelNo"}=$levelArr[$j];

			if($j == 0){
				$levelWhere ="level_$levelNo='${"level_$levelNo"}'";
			}else{
				$levelWhere .=" AND level_$levelNo='${"level_$levelNo"}'";
			}
		}

		$sql="select * from OBJ_260.param_9 where $levelWhere ";
		$res=@mysqli_query($pubConn,$sql);
		//echo "$sql<br>";
		while($row=@mysqli_fetch_array($res))
		{
			$instanceNo=$row[instanceNo]+0;
			$smpp_link_alias[$instanceNo]=$row[initValue];
			//echo "$instanceNo-{$row[initValue]}<br>";
		}

		for($row=0;$row<4;$row++)
		{
			echo "<tr>";
			for($col=0;$col<8;$col++)
			{
				$no=$row*8+$col;
				$status=substr($smpp_link_status_hex,$no*2,2);
				$istatus=hexdec($status)+0;
				$noshow=omc_keep_length($no,0,2);
				if($smpp_link_alias[$no] != "")
					echo "<td width=12.5% bgcolor=#eeeeee><font color=#000000>$noshow [ {$smpp_link_alias[$no]} ]</font></td>";
				else
					echo "<td width=12.5% bgcolor=#eeeeee><font color=#000000>$no</font></td>";	

			}
			echo "</tr>";
			
			
			echo "<tr>";
			for($col=0;$col<8;$col++)
			{
				$no=$row*8+$col;
				$status=substr($smpp_link_status_hex,$no*2,2);
				$istatus=hexdec($status)+0;
				if($istatus>=0&&$istatus<5)
					echo "<td width=12.5%><font color={$smpp_link_status_color[$istatus]}>{$smpp_link_status_label[$istatus]}</font></td>";
				else
					echo "<td width=12.5%><font color=#00000>--</font></td>";
			}
			echo "</tr>";
		
		}
			
		echo "</table>";
		
		/*
		echo "&nbsp;SMPP Link Status: ";
		echo "<font color={$smpp_link_status_color[0]}>Not Init</font>;&nbsp;&nbsp;&nbsp;";
		echo "<font color={$smpp_link_status_color[1]}>Idle</font>;&nbsp;&nbsp;&nbsp;";
		echo "<font color={$smpp_link_status_color[2]}>Waiting</font>;&nbsp;&nbsp;&nbsp;";
		echo "<font color={$smpp_link_status_color[3]}>Established</font>;&nbsp;&nbsp;&nbsp;";
		echo "<font color={$smpp_link_status_color[4]}>Suspend</font>; ";
		*/

	}
	{//if there are some alarm, show it (add by arwean 2006-7-11 15:05)
		$selSql = "select * from sysAlarmLog where sysTypeNo='$sysTypeNo' and sysNo='$sysNo' and clearBy is null";
		if($DEBUG) echo "<br>db=$db;<br>selSql=$selSql";
		$Result = mysqli_query($pubConn,$selSql);
		if(mysqli_num_rows($Result))
		{
			echo "<p> </p>";
			echo "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"1\">";
			echo "<tr><td><p align=\"center\"><font color=\"#FF0000\" size=\"2\">";
			echo "{$sysType}_{$sysNo}_{$subSysNo} alarm list";
			echo "</p></td></tr></table>";
			
			echo "<table border=\"1\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">";
			echo "<tr bgcolor=\"#E6E6E6\">";
			echo "<td>Alarm level</td>";
			echo "<td>Events</td>";
			echo "<td>Alarm time</td>";
			echo "</tr>";
			while($Rows=mysqli_fetch_array($Result))
			{
				$alarmTime = $Rows[alarmTime];
				$tmpSql="SELECT * FROM sysAlarmConf
						WHERE sysTypeNo='$sysTypeNo' AND compCode='$Rows[compCode]' AND alarmCode='$Rows[alarmCode]'";
				if($DEBUG)echo "<br>tmpSql=$tmpSql";
				$tmpResult=@mysqli_query($pubConn,$tmpSql);
				echo mysqli_error($pubConn);
				$tmpRows=@mysqli_fetch_array($tmpResult);
				$alarmLevel= $tmpRows[alarmLevel];
				if(trim($tmpRows[alarmDesc_2])=="")
					echo "<tr style=\"display:none\">";
				else
					echo "<tr>";
				echo "<td>{$alarmLevelDefArr[$alarmLevel][remark]}</td>";
				echo "<td>{$tmpRows[alarmDesc_2]}</td>";
				echo "<td>$alarmTime</td>";
				echo "</tr>";
			}
			echo "</table>";
		}
	}//end show alarm.
}//end if($mod_type==0)
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=\"serverStatus.php?sys_id=all&showRange=$showRange&backpage=$backpage\" 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>";
adjust_content_tail();
?>
<!--
<meta http-equiv="refresh" content="10 url=<?php echo "$PHP_SELF?sys_id=$sys_id&mod_type=$mod_type&showRange=$showRange&backpage=$backpage";?>">
-->

</body>
</html>    
