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

<script language="JavaScript">
	function page_refresh()
	{
		var sel_date=document.up_form.sel_date.value;
		var sel_type=document.up_form.sel_type.value;
		parent.oprCstaDown.location.href="oprCstaDown.php?sel_date="+sel_date+"&sel_type="+sel_type;
	}
</script>	

<base target="oprCstaDown">
<body  leftmargin="15" rightmargin="10" onload="javascript:adjust_frame('up');" onresize="javascript:adjust_frame('up');" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;">

<?php
adjust_head_frame("up");
adjust_title_head_frame("up");

	//global variables
	$serviceFlag=array("00"=>"BothClose",
										 "01"=>"IMDXOpen",
										 "10"=>"OPROpen",
										 "11"=>"BothOpen");
	

	$oppsServiceStatus=getSystemState(375,94,2);
	if($DEBUG)echo "oppsServiceStatus=+$oppsServiceStatus+<br>";
	if($oppsServiceStatus=="")
	{
		//exit("<p>Can't receive the heartbeat of OPPS!<br>");
	}
	
	if($serviceFlag[$oppsServiceStatus] == "OPROpen")
		$type_label=array(0=>"OPR Registration",1=>"OPR Location Update",2=>"OPR Mode Switch");
	else if($serviceFlag[$oppsServiceStatus] == "IMDXOpen")
		$type_label=array(0=>"IMDX MO",1=>"IMDX Location Update");
	else if($serviceFlag[$oppsServiceStatus] == "BothOpen")
		$type_label=array(0=>"OPR Registration",1=>"OPR Location Update",2=>"OPR Mode Switch",3=>"IMDX MO",4=>"IMDX Location Update");
	else
	{
		$type_label=array(0=>"None");
		//echo "<br><br><br><br>";
		//exit("<p>No record!<br>");
	}
	//title
	echo "<table id=\"table_up\" border=\"0\" width=\"100%\">";
	echo "<tr>";
	echo "<td width=\"50%\" align=\"left\">";
	echo "$strTitlePerformance > OPPS";
	echo "</td>";
	echo "<td align=\"right\">";
	$helpId="3.10";
	showHelp($helpId);
	echo "</td>";
	echo "</tr>";
	echo "<tr>";
	echo "<td align=\"left\">";
	
	echo "<form name=\"up_form\" action=\"oprCstaDown.php\" method=\"post\">";
	//type selection
	echo "Type <select name=\"sel_type\">";
	for($i=0;$i<sizeof($type_label);$i++)
	{
		if($i==$sel_type)
			echo "<option selected value=$i>{$type_label[$i]}</option>";
		else
			echo "<option value=$i>{$type_label[$i]}</option>";
		
	}
	echo "</select>";
	//date selection
	$day0=date("Y-m-d",mktime(0,0,0,date("m"),date("d"),date("Y")));
	$day1=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-1,date("Y")));
	$day2=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-2,date("Y")));
	$day3=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-3,date("Y")));
	$day4=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-4,date("Y")));
	$day5=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-5,date("Y")));
	$day6=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-6,date("Y")));	
	echo "&nbsp;Date <select name=\"sel_date\">";
	for($i=0;$i<7;$i++)
	{
		if($i==$sel_date)
			echo "<option selected value=$i>${day.$i}</option>";
		else
			echo "<option value=$i>${day.$i}</option>";	
	}
	echo "</select>";
	//search
	echo "&nbsp;<a onClick=\"javascript:page_refresh();\" style=\"cursor:hand\">";
	echo "<IMG align=absBottom border=0 src=\"../../images/search.gif\" >";
	echo "$strSearch"; 
	echo "</a>";
	
	echo "</td>";
	echo "<td align=\"right\">&nbsp;";
	echo "</td>";
	echo "</tr>";
	echo "</table>";

adjust_title_tail_frame("up");
adjust_content_head_frame("up");
adjust_content_tail_frame("up");


	echo "</form>";
?>
