<?php
//Include the head file
require("../../inc/header.inc");
?>
<style type="text/css">
<!--
.style3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt;background: url(--.gif); border: 0px;  height: 16px;}
-->
</style>
<body>
	
	
<?php
//when refresh the page,it only refresh the 1/6 of the page  

if(!isset($refresh_flag))
	$refresh_flag=0;
else
	$refresh_flag=$refresh_flag;	
$refresh_flag=($refresh_flag+1)%6;
//echo "refresh_flag:$refresh_flag<br>";
echo "<form name=myform>";
echo "<input type=hidden name=refresh_flag value=$refresh_flag>";
echo "</form>";
echo "<meta http-equiv=\"refresh\" content=\"10; url=$PHP_SELF?refresh_flag=$refresh_flag\">";
//================================data define===============================================
//$card_status[platNo][cardNo]    due to: refresh time,Layer1,Layer2,cpuLoad,0-normal 1-abnormal
//$card_refreshTime[platNo][cardNo]
//$card_clock[platNo][cardNo]
//$card_sync[platNo][cardNo]
//$card_version[platNo][cardNo]
//$card_HWaddr[platNo][cardNo]
//$card_type[platNo][cardNo]
for($i=0;$i<2;$i++)
{
	for($j=0;$j<16;$j++)
	{
		$card_status[$i][$j]="--";
		$card_refreshTime[$i][$j]="--";
		$card_refreshTime_full[$i][$j]="--";
		$card_clock[$i][$j]="--";
		$card_sync[$i][$j]="--";
		$card_version[$i][$j]="--";
		$card_HWaddr[$i][$j]="--";
		$card_type[$i][$j]="--";
	}
}
//$port_e1Install[platNo][cardNo][portNo]  port enable or disable
//$port_layer1[platNo][cardNo][portNo]
//$port_layer2[platNo][cardNo][portNo]
//$port_echoCanceller[platNo][cardNo][portNo]
//$port_channel[platNo][cardNo][portNo]
//$port_type[platNo][cardNo][portNo]
for($i=0;$i<2;$i++)
{
	for($j=0;$j<16;$j++)
	{
		for($k=0;$k<8;$k++)
		{
	
			$port_layer1[$i][$j][$k]="--";
			$port_layer2[$i][$j][$k]="--";
			$port_echoCanceller[$i][$j][$k]="--";
			$port_channel[$i][$j][$k]="--";
			$port_type[$i][$j][$k]="--";
			
			$port_e1Install[$i][$j][$k]="--";
			$port_e1L2Install[$i][$j][$k]="--";
		}
	}
}


//===============================initial==================================================
$database=$omc_db;
$table_name="sysStat";
$dueDate = date("Y-m-d H:i:s",mktime(date("H"),date("i"),date("s")-$heatbeat_overtime,date("m"),date("d"),date("Y")));
//echo "heatbeat_overtime:$heatbeat_overtime<br>";
//echo "$database--$table_name--$dueDate<br>";
//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 layer2(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
$ch_bgn		=	31; 
$att_bgn	=	39;

$HWaddr_bgn	=	17;
$msc_bgn_byt=19;

//========================Get the data from database sysTypeNo=111============================

$selSql = " SELECT sysTypeNo,sysNo,subSysNo,detailStat,updateTime FROM OMC_PUB.sysStat 
			WHERE sysTypeNo=111 AND (sysNo='0' OR sysNo='1')";
			
$selRes = @mysqli_query($pubConn,$selSql);
$selRow = @mysqli_fetch_array($selRes);
echo mysqli_error($pubConn);

do{
	//If there is not any card,then break
	if(!$selRow)
		break;
	$platNo = $selRow[sysNo];
	$cardNo = $selRow[subSysNo];
	$hex_mes = $selRow[detailStat];
	$bin_mes='';
	if($DEBUG) echo "<br>hex_mes=$hex_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";
	//=============card status===============
	$card_status[$platNo][$cardNo] = 0;
	//==============card refresh time==============
	$card_refreshTime[$platNo][$cardNo]=$selRow[updateTime];
	$card_refreshTime_full[$platNo][$cardNo]=$selRow[updateTime];
	if($card_refreshTime[$platNo][$cardNo] <= $dueDate)
	{
		$card_status[$platNo][$cardNo]=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);

	$card_version[$platNo][$cardNo]= $dec_ver_0.".".$dec_ver_1.".".$dec_ver_2;
	


	//===============card type==================
	$bin_typ = substr($bin_mes,$typ_bgn*8,8);
	$card_type[$platNo][$cardNo]= BinDec($bin_typ);

	//==================e1 install===============
	for($i=0;$i<8;$i++){
		$bin_ins=substr($bin_mes,$ins_bgn*8+7-$i,1);
		$port_e1Install[$platNo][$cardNo][$i]=BinDec($bin_ins);		
	}


	//==============e1 layer2 install==============
	for($i=0;$i<8;$i++)
	{
		$bin_inl=substr($bin_mes,$inl_bgn*8+7-$i,1);
		$port_e1L2Install[$platNo][$cardNo][$i]=BinDec($bin_inl);
	}

	//================e1 layer1=============
	for($i=0;$i<8;$i++){
		$bin_phy=substr($bin_mes,$phy_bgn*8+7-$i,1);
		$port_layer1[$platNo][$cardNo][$i] = BinDec($bin_phy);
		
		if($port_e1Install[$platNo][$cardNo][$i] == 0){
			$port_layer1[$platNo][$cardNo][$i]=2;
		}

		if($port_layer1[$platNo][$cardNo][$i] == 1){
			$card_status[$platNo][$cardNo]=1;
		}
	}

	//=============e1 layer2================
	for($i=0;$i<8;$i++) {
		$bin_tra=substr($bin_mes,$tra_bgn*8+7-$i,1);
		$port_layer2[$platNo][$cardNo][$i]=BinDec($bin_tra);
		if($port_e1Install[$platNo][$cardNo][$i] == 0 || $port_e1L2Install[$platNo][$cardNo][$i] == 0){
			$port_layer2[$platNo][$cardNo][$i]=2;
		}
		if($port_layer2[$platNo][$cardNo][$i] == 0){
			$card_status[$platNo][$cardNo]=1;
		}
	}

	//===========echo canceller status=========
	for($i=0;$i<8;$i++){
		$bin_can=substr($bin_mes,$can_bgn*8+7-$i,1);
		$port_echoCanceller[$platNo][$cardNo][$i]=BinDec($bin_can);
		if($port_e1Install[$platNo][$cardNo][$i] == 0){
			$port_echoCanceller[$platNo][$cardNo][$i] = 0;
		}
  }

	//============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){
		$card_status[$platNo][$cardNo] = 1;
	}

  //===========card sync================
	$bin_loc = substr($bin_mes,$loc_bgn*8,8);
	$card_sync[$platNo][$cardNo] = BinDec($bin_loc);

	//===========master clock=============
	$bin_mas = substr($bin_mes,$pow_bgn*8+7,1);
	$card_clock[$platNo][$cardNo] = BinDec($bin_mas);

}while($selRow = @mysqli_fetch_array($selRes));



//==========================Get the data from database sysTypeNo=112=========================
$selSql = " SELECT sysTypeNo,sysNo,subSysNo,detailStat,updateTime FROM OMC_PUB.sysStat 
			WHERE sysTypeNo=112";
$selRes = @mysqli_query($pubConn,$selSql);
$selRow = @mysqli_fetch_array($selRes);
echo mysqli_error($pubConn);

do{
	if(!$selRow)
		break;
	$platNo = $selRow[sysNo];
	$cardNo = $selRow[subSysNo];
	$hex_mes = $selRow[detailStat];
	if($DEBUG) echo "<br>hex_mes=$hex_mes";

	$card_HWaddr[$platNo][$cardNo] = substr($hex_mes,$HWaddr_bgn*2,12);
}while($selRow = @mysqli_fetch_array($selRes));



//===========================Get the data from database sysTypeNo=320=======================


$selSql = " SELECT sysNo,subSysNo,detailStat,updateTime FROM OMC_PUB.sysStat 
			WHERE sysTypeNo=320 AND (sysNo='0' OR sysNo='1')";
$selRes = @mysqli_query($pubConn,$selSql);
$selRow = @mysqli_fetch_array($selRes);
echo mysqli_error($pubConn);


do
{
	if(!$selRow)
		break;
	$platNo = $selRow[sysNo];
	$hex_mes = $selRow[detailStat];
	if($DEBUG) echo "<br>hex_mes=$hex_mes";
	
	$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";


	for($i=0;$i<128;$i++)
	{
		$cardNo = floor($i/8);
		$portNo=$i%8;
		//=================port type========================
		if($DEBUG)echo "<br>i=$i";
		$BinStatus=substr($bin_mes,($msc_bgn_byt+24)*8+$i*8,3);
		$DecStatus=BinDec($BinStatus);
		if($DEBUG)echo "<br>DecStatus=$DecStatus";
		$port_type[$platNo][$cardNo][$portNo]=$DecStatus;
		//===============port channel======================
		$BinAttribute=substr($bin_mes,($msc_bgn_byt+24)*8+$i*8+3,5);
		$DecAttribute=BinDec($BinAttribute);
		if($DEBUG)
			echo "<br>DecAttribute=$DecAttribute";
		if($port_e1Install[$platNo][$cardNo][$portNo]=="--")
		{
			$port_channel[$platNo][$cardNo][$portNo]="--";
		}
		else
			$port_channel[$platNo][$cardNo][$portNo]=$DecAttribute;
		
	}

}while($selRow = @mysqli_fetch_array($selRes));

//==============================format the data======================================

$card_status_format=array(0=>"Y",1=>"N","--"=>"--");
$card_clock_format=array(0=>"Slave",1=>"Master","--"=>"--");
$card_sync_format=array(0=>"Init",1=>"Search",2=>"Locked",3=>"Threshold",4=>"Adjust",5=>"HoldOver",6=>"StopAtOppm",7=>"Idle","--"=>"--");
$card_type_format=array(0=>"E1",1=>"T1","--"=>"--");
for($i=0;$i<2;$i++)
{
	for($j=0;$j<16;$j++)
	{
		$card_status[$i][$j]=$card_status_format[$card_status[$i][$j]];
		$card_clock[$i][$j]=$card_clock_format[$card_clock[$i][$j]];
		$card_sync[$i][$j]=$card_sync_format[$card_sync[$i][$j]];
		
		if(strlen($card_refreshTime[$i][$j])>5)
			$card_refreshTime[$i][$j]=substr($card_refreshTime[$i][$j],11,8);

		if(strlen($card_refreshTime[$i][$j])<3)
		{
			$card_HWaddr[$i][$j]="--";
		}
		else
		{
			if(strlen($card_HWaddr[$i][$j])>5)
			{
				$temp="";
				for($z=0;$z<5;$z++)
				{
					$temp.=substr($card_HWaddr[$i][$j],$z*2,2);
					$temp.=":";
				}
				$temp.=substr($card_HWaddr[$i][$j],10,2);
				$card_HWaddr[$i][$j]=$temp;
				
			}
		}	
		$card_type[$i][$j]=$card_type_format[$card_type[$i][$j]];
	}
}


$port_enable_format=array(0=>"--",1=>"Y","--"=>"--");
$port_layer1_format=array(0=>"Y",1=>"N",2=>"--","--"=>"--");
$port_layer2_format=array(0=>"N",1=>"Y",2=>"--","--"=>"--");
$port_echoCanceller_format=array(0=>"--",1=>"Y","--"=>"--");
$port_type_format=array(0=>"TUP",1=>"ISUP",2=>"AIF",3=>"ISDN-NT",4=>"ISDN-LT",5=>"CI-CNF",6=>"CI-INT",7=>"--","--"=>"--");
for($i=0;$i<2;$i++)
{
	for($j=0;$j<16;$j++)
	{
		for($k=0;$k<8;$k++)
		{
			if($card_status[$i][$j] == "--")
			{
				$port_e1Install[$i][$j][$k]="--";
				$port_layer1[$i][$j][$k]="--";
				$port_layer2[$i][$j][$k]="--";
				$port_echoCanceller[$i][$j][$k]="--";
				$port_type[$i][$j][$k]="--";
			}
			else
			{
				$port_e1Install[$i][$j][$k]=$port_enable_format[$port_e1Install[$i][$j][$k]];
				$port_layer1[$i][$j][$k]=$port_layer1_format[$port_layer1[$i][$j][$k]];
				$port_layer2[$i][$j][$k]=$port_layer2_format[$port_layer2[$i][$j][$k]];
				$port_echoCanceller[$i][$j][$k]=$port_echoCanceller_format[$port_echoCanceller[$i][$j][$k]];
				$port_type[$i][$j][$k]=$port_type_format[$port_type[$i][$j][$k]];
			}
		}
	}
}

//==========================test the data===================================================
/*
echo "==================card attribute=================<br>";
for($i=0;$i<2;$i++)
{
	for($j=0;$j<16;$j++)
	{	
		echo "CSC-$i-Card-$j-status:{$card_status[$i][$j]}<br>";
		echo "CSC-$i-Card-$j-refreshTime:{$card_refreshTime[$i][$j]}<br>";
		echo "CSC-$i-Card-$j-clock:{$card_clock[$i][$j]}<br>";
		echo "CSC-$i-Card-$j-sync:{$card_sync[$i][$j]}<br>";
		echo "CSC-$i-Card-$j-version:{$card_version[$i][$j]}<br>";
		echo "CSC-$i-Card-$j-HWaddr:{$card_HWaddr[$i][$j]}<br>";
		echo "CSC-$i-Card-$j-type:{$card_type[$i][$j]}<br>";
	}
}

echo "==================port attribute=================<br>";
for($i=0;$i<2;$i++)
{
	for($j=0;$j<16;$j++)
	{
		for($k=0;$k<8;$k++)
		{
			
			//echo "CSC-$i-Card-$j-Port-$k-enable:{$port_e1Install[$i][$j][$k]}<br>";
			//echo "CSC-$i-Card-$j-Port-$k-layer1:{$port_layer1[$i][$j][$k]}<br>";
			//echo "CSC-$i-Card-$j-Port-$k-layer2:{$port_layer2[$i][$j][$k]}<br>";
			//echo "CSC-$i-Card-$j-Port-$k-echoCanceller:{$port_echoCanceller[$i][$j][$k]}<br>";
			echo "CSC-$i-Card-$j-Port-$k-channel:{$port_channel[$i][$j][$k]}<br>";
			//echo "CSC-$i-Card-$j-Port-$k-type:{$port_type[$i][$j][$k]}<br>";
			
			//$port_e1Install[$i][$j][$k]="--";
			//$port_e1L2Install[$i][$j][$k]="--";
		}
	}
}
*/


//=========================send the data to csuStatus_show page==============================

echo "<script LANGUAGE=\"JavaScript\">";
		//refresh the half element
		$i=$refresh_flag%2;
		for($j=0;$j<16;$j++)
		{	
			//=========card status==================
			$tempV=$card_status[$i][$j];
			$tempN="plat".$i."card".$j."status";
			if($card_status[$i][$j]=="N")
				$tempC="#FF0000";
			else if($card_status[$i][$j]=="Y")
				$tempC="#0000FF";	
			else	
				$tempC="#000000";		
			echo "\nparent.show_frame.document.csuStatusForm.$tempN.value='$tempV'";
			echo "\nparent.show_frame.document.csuStatusForm.$tempN.style.color='$tempC'";
			//==========card refresh time==================
			$tempV=$card_refreshTime[$i][$j];
			$tempN="plat".$i."card".$j."refreshtime";
			
			$tmp_total=explode(" ",$card_refreshTime_full[$i][$j]);
			$tmp_year_month_day=explode("-",$tmp_total[0]);
			$tmp_hour_minute_second=explode(":",$tmp_total[1]);
			$tmp_now=time();
			$tmp_fresh=mktime($tmp_hour_minute_second[0],$tmp_hour_minute_second[1],$tmp_hour_minute_second[2],$tmp_year_month_day[1],$tmp_year_month_day[2],$tmp_year_month_day[0]);
	
				
			$slot=$tmp_now-$tmp_fresh;
			if(strlen($card_refreshTime[$i][$j])>5)
			{
				//if($card_refreshTime[$i][$j]>$dueDate)
				if($slot<=40)
					$tempC="#0000FF";
				else
					$tempC="#FF0000";
			}
			else
				$tempC="#000000";
			echo "\nparent.show_frame.document.csuStatusForm.$tempN.value='$tempV'";
			echo "\nparent.show_frame.document.csuStatusForm.$tempN.style.color='$tempC'";		
			//==========card clock card sync=======================
			$tempV=$card_clock[$i][$j];
			//$tempN="plat".$i."card".$j."clock";
			if($card_clock[$i][$j]=="--")
				$tempC="#000000";
			else	
				$tempC="#0000FF";
			//echo "\nparent.show_frame.document.csuStatusForm.$tempN.value='$tempV'";
			//echo "\nparent.show_frame.document.csuStatusForm.$tempN.style.color='$tempC'";	
			if($card_sync[$i][$j]!="--")
				$tempV=$tempV."/".$card_sync[$i][$j];
			else
				$tempV="--";
			$tempN="plat".$i."card".$j."clocksync";
			if($card_sync[$i][$j]=="--")
				$tempC="#000000";
			else	
				$tempC="#0000FF";
			echo "\nparent.show_frame.document.csuStatusForm.$tempN.value='$tempV'";
			echo "\nparent.show_frame.document.csuStatusForm.$tempN.style.color='$tempC'";	
			//=========== card version======================
			$tempV=$card_version[$i][$j];
			$tempN="plat".$i."card".$j."version";
			if($card_version[$i][$j]=="--")
				$tempC="#000000";
			else	
				$tempC="#0000FF";
			echo "\nparent.show_frame.document.csuStatusForm.$tempN.value='$tempV'";
			echo "\nparent.show_frame.document.csuStatusForm.$tempN.style.color='$tempC'";	
			//============card HWaddr======================
			$tempV=$card_HWaddr[$i][$j];
			$tempN="plat".$i."card".$j."hwaddr";
			if($card_HWaddr[$i][$j]=="--")
				$tempC="#000000";
			else	
				$tempC="#0000FF";
			echo "\nparent.show_frame.document.csuStatusForm.$tempN.value='$tempV'";
			echo "\nparent.show_frame.document.csuStatusForm.$tempN.style.color='$tempC'";	
			//=============card type=======================
			$tempV=$card_type[$i][$j];
			$tempN="plat".$i."card".$j."type";
			if($card_type[$i][$j]=="--")
				$tempC="#000000";
			else	
				$tempC="#0000FF";
			echo "\nparent.show_frame.document.csuStatusForm.$tempN.value='$tempV'";
			echo "\nparent.show_frame.document.csuStatusForm.$tempN.style.color='$tempC'";				
		}
	
	

	for($i=0;$i<2;$i++)
	{
		for($j=0;$j<16;$j++)
		{
			for($k=0;$k<8;$k++)
			{
				//=============port status=======================
				if($refresh_flag==0)
				{
				$tempV=$port_e1Install[$i][$j][$k];
				$tempN="plat".$i."card".$j."port".$k."status";
				if(strcmp($port_e1Install[$i][$j][$k],"Y")==0)
					$tempC="#0000FF";
				else if(strcmp($port_e1Install[$i][$j][$k],"N")==0)
					$tempC="#FF0000";	
				else	
					$tempC="#000000";	
				echo "\nparent.show_frame.document.csuStatusForm.$tempN.value='$tempV'";
				echo "\nparent.show_frame.document.csuStatusForm.$tempN.style.color='$tempC'";	
				}
				//=============port layer1=========================
				if($refresh_flag==1)
				{
				$tempV=$port_layer1[$i][$j][$k];
				$tempN="plat".$i."card".$j."port".$k."layer1";
				if(strcmp($port_layer1[$i][$j][$k],"Y")==0)
					$tempC="#0000FF";
				else if(strcmp($port_layer1[$i][$j][$k],"N")==0)
					$tempC="#FF0000";
				else
				  $tempC="#000000";		
			  echo "\nparent.show_frame.document.csuStatusForm.$tempN.value='$tempV'";
				echo "\nparent.show_frame.document.csuStatusForm.$tempN.style.color='$tempC'";
				}
				//=============port layer2=========================
				if($refresh_flag==2)
				{
				$tempV=$port_layer2[$i][$j][$k];
				$tempN="plat".$i."card".$j."port".$k."layer2";
				if(strcmp($port_layer2[$i][$j][$k],"Y")==0)
					$tempC="#0000FF";
				else if(strcmp($port_layer2[$i][$j][$k],"N")==0)
					$tempC="#FF0000";
				else
				  $tempC="#000000";		
			  echo "\nparent.show_frame.document.csuStatusForm.$tempN.value='$tempV'";
				echo "\nparent.show_frame.document.csuStatusForm.$tempN.style.color='$tempC'";
				}
				//=============port echo canceller=================
				if($refresh_flag==3)
				{
				$tempV=$port_echoCanceller[$i][$j][$k];
				$tempN="plat".$i."card".$j."port".$k."echocanceller";
				if(strcmp($port_echoCanceller[$i][$j][$k],"Y")==0)
					$tempC="#0000FF";
				else if(strcmp($port_echoCanceller[$i][$j][$k],"N")==0)
					$tempC="#FF0000";
				else
				  $tempC="#000000";
				echo "\nparent.show_frame.document.csuStatusForm.$tempN.value='$tempV'";
				echo "\nparent.show_frame.document.csuStatusForm.$tempN.style.color='$tempC'"; 
				} 
				//=============port channel========================
				if($refresh_flag==4)
				{
				$tempV=$port_channel[$i][$j][$k];
				//$tempN="plat0card".$i."port".$j."channel";
				$tempN="plat".$i."card".$j."port".$k."channel";
				
				if(strcmp($port_channel[$i][$j][$k],"--")==0)
					$tempC="#000000";
				else
				  $tempC="#0000FF";	
				  
				echo "\nparent.show_frame.document.csuStatusForm.$tempN.value='$tempV'";
				echo "\nparent.show_frame.document.csuStatusForm.$tempN.style.color='$tempC'"; 	
				}
				//=============port type===========================
				if($refresh_flag==5)
				{
				$tempV=$port_type[$i][$j][$k];
				$tempN="plat".$i."card".$j."port".$k."type";
				if(strcmp($port_type[$i][$j][$k],"--")==0)
					$tempC="#000000";
				else
				  $tempC="#0000FF";
				echo "\nparent.show_frame.document.csuStatusForm.$tempN.value='$tempV'";
				echo "\nparent.show_frame.document.csuStatusForm.$tempN.style.color='$tempC'"; 
				}
			}
		}
	}


echo "\n</script>"; 
?>
</body>