<?php
//Include the head file
require("../../inc/header.inc");
?>
<base target="trunk_general_down">
<script language="JavaScript">
	//the function is called when the page is refresh
	function  page_refresh()
	{
		//in&out,fromdate,todate,fromhour,fromminute,fromsecond,tohour,tominute,tosecond
		
		var down_date_from=document.myform.sel_date_from.value;
		var down_date_to=document.myform.sel_date_to.value;
		var in_out=document.myform.sel_in_out.value;
		var scrollY=document.getElementById('content_down').scrollTop;
		var from_h=document.myform.from_hour.value;
		var from_m=document.myform.from_minute.value;
		var from_s=document.myform.from_second.value;
		var to_h=document.myform.to_hour.value;
		var to_m=document.myform.to_minute.value;
		var to_s=document.myform.to_second.value;
		var secondsFrom=from_h*3600+from_m*60+from_s;
		var secondsTo=to_h*3600+to_m*60+to_s;
		if(secondsFrom>secondsTo)
			alert("Time error");
		else
		{	
			if(down_date_from<=down_date_to)
				down_date_to=down_date_from;
			var ur="&from_hour="+from_h+"&from_minute="+from_m+"&from_second="+from_s;
			ur=ur+"&to_hour="+to_h+"&to_minute="+to_m+"&to_second="+to_s+"&sel_in_out="+in_out;	
  		var urll='<?php echo"$PHP_SELF";?>?sel_date_from='+down_date_from+'&sel_date_to='+down_date_to+'&scroll_y='+scrollY+ur;
			window.location.href=urll;
		}
	}
</script>
<body  leftmargin="15" rightmargin="10" onload="javascript:adjust_frame('up');" onresize="javascript:adjust_frame('up');" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;">
<form action="trunk_general_down.php" method="post" name="myform">

<?php
adjust_head_frame("up");
adjust_title_head_frame("up");
echo "<table id=\"table_up\" border=\"0\" width=\"100%\">";
echo "<tr>";
echo "<td width=50% align=\"left\">";
echo "$strTitlePerformance > MSC > Trunk group";
echo "</td>";
echo "<td align=\"right\">";
$helpId = "3.2.2";
showHelp($helpId);
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td align=\"left\">";

if(!isset($scroll_y))
	$scroll_y=0;
if(!isset($sel_date_from))
	$sel_date_from=0;
if(!isset($sel_date_to))
	$sel_date_to=0;
if(!isset($sel_in_out))
	$sel_in_out=2;
if(!isset($from_hour))
	$from_hour="00";
if(!isset($from_minute))
	$from_minute="00";		
if(!isset($from_second))
	$from_second="00";
if(!isset($to_hour))
	$to_hour="24";
if(!isset($to_minute))
	$to_minute="00";
if(!isset($to_second))
	$to_second="00";			
//selection date define
$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")));	
?>

<select name="sel_in_out" onChange="javascript:page_refresh()">
				<?php
					$in_out_string=array("In","Out","In&Out");
					for($i=0;$i<3;$i++)
					{
						if($i==$sel_in_out)
							echo "<option selected value=$i>$in_out_string[$i]</option>";
						else
							echo "<option value=$i>$in_out_string[$i]</option>";	
					}
				?>
</select>&nbsp;
<select name="sel_date_from" onChange="javascript:page_refresh()">
			<?php
				for($i=0;$i<7;$i++)
		  	{
			 		if($i==$sel_date_from)
		  			echo "<option selected value=$i>${day.$i}</option>";			
		  		else
		  			echo "<option value=$i>${day.$i}</option>";
				}
			?>
</select>&nbsp;to&nbsp;
<select name="sel_date_to" onChange="javascript:page_refresh()">
			<?php
				for($i=0;$i<=$sel_date_from;$i++)
		  	{
			 		if($i==$sel_date_to)
		  			echo "<option selected value=$i>${day.$i}</option>";			
		  		else
		  			echo "<option value=$i>${day.$i}</option>";
				}
			?>
</select>
<span onClick="javascript:myform.submit();" style="cursor:hand">
<img border=0 src="../../images/search.gif">Search
</span>
<?php
			//========================wether the select time slot is one day==================
			$slot=$sel_date_from-$sel_date_to+1;
			//echo "slot:$slot<br>";
			if($slot==1)
			{
				
				//===============================from_hour text=================================
				echo "<input type=\"hidden\" name=\"from_hour\" value=$from_hour size=\"2\" maxLength=\"2\">";
				//===============================from_minute text================================
				echo "<input type=\"hidden\" name=\"from_minute\" value=$from_minute size=\"2\" maxLength=\"2\">";
				//===============================from_second text================================
				echo "<input type=\"hidden\" name=\"from_second\" value=$from_second size=\"2\" maxLength=\"2\">";
				//===============================to_hour text=====================================
				echo "<input type=\"hidden\" name=\"to_hour\" value=$to_hour size=\"2\" maxLength=\"2\">";
				//===============================to_minute text===================================
				echo "<input type=\"hidden\" name=\"to_minute\" value=$to_minute size=\"2\" maxLength=\"2\">";
				//==============================to_second text====================================
				echo "<input type=\"hidden\" name=\"to_second\" value=$to_second size=\"2\" maxLength=\"2\">";
			}
			else
			{
				//===============================from_hour hidden=================================
				echo "<input type=\"hidden\" name=\"from_hour\" value=$from_hour>";
				//===============================from_minute hidden================================
				echo "<input type=\"hidden\" name=\"from_minute\" value=$from_minute>";
				//===============================from_second hidden================================
				echo "<input type=\"hidden\" name=\"from_second\" value=$from_second>";
				//===============================to_hour hidden=====================================
				echo "<input type=\"hidden\" name=\"to_hour\" value=$to_hour>";
				//===============================to_minute hidden===================================
				echo "<input type=\"hidden\" name=\"to_minute\" value=$to_minute>";
				//==============================to_second hidden====================================
				echo "<input type=\"hidden\" name=\"to_second\" value=$to_second>";
			}
			
			
echo "</td>";
echo "<td align=\"right\">";
?>

<span onClick="window.print();" style="cursor:hand">
	<img align=absBottom border=0 src="../../images/printer.gif" width="16" height="16">
</span>
<?php
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</form>";
adjust_title_tail_frame("up");
adjust_content_head_frame("up");
adjust_content_tail_frame("up");

?>	


