<?php
//Include the head file
require("../../inc/header.inc");
?>
<base target="trunk_detail_down">
<script language="JavaScript">
	function page_refresh()
	{
		//sel_date_from,sel_date_to,scroll_y,on_top_index
		
		var down_date_from=document.myform.sel_date_from.value;
		var down_date_to=document.myform.sel_date_to.value;
		var trunkno=document.myform.trunk_no.value;
		var in_out=document.myform.sel_in_out.value;
		var on_top=parent.trunk_detail_down.document.myform.on_top_index.value;
		
		
		var scrolly=document.getElementById('content_down').scrollTop;
		if(down_date_from<=down_date_to)
			down_date_to=down_date_from;
		
		
		var urll='<?php echo"$PHP_SELF";?>?sel_date_from='+down_date_from+'&sel_date_to='+down_date_to+'&trunk_no='+trunkno+"&on_top_index="+on_top+"&scroll_y="+scrolly+"&sel_in_out="+in_out;
		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 name="myform" action="trunk_detail_down.php" method="post">
<?php
adjust_head_frame("up");
adjust_title_head_frame("up");
	//=================================test=======================================
	//echo "trunk_no:$trunk_no<br>";
	//echo "sel_date_from:$sel_date_from<br>";
	//echo "sel_date_to:$sel_date_to<br>";
	//echo "in_out:$sel_in_out<br>";
	//==================get the parameter the previous transfer====================
	$old_sel_date_from=$sel_date_from;
	$old_sel_date_to=$sel_date_to;
	$old_sel_in_out=$sel_in_out;
	//===========================page title========================================
	echo "<table id=\"table_up\" width=\"100%\" border=0>";
	echo "<tr>";
	echo "<td width=50% align=\"left\"><nobr>";
	echo "$strTitlePerformance > MSC > Trunk group";
	echo "</td>";
	echo "<td width=50% align=\"right\">";
	$helpId="3.2.2";
	showHelp($helpId);
	echo "</td>";
	echo "</tr>";
	echo "<tr>";
	echo "<td align=\"left\">";
	
	//=======================data initial==========================================
	if(!isset($sel_date_from))
		$sel_date_from=0;
	if(!isset($sel_date_to))
		$sel_date_to=0;
	if(!isset($trunk_no))
		$trunk_no=0;	
	if(!isset($sel_in_out))
		$sel_in_out=0;
	if(!isset($on_top_index))
		$on_top_index=0;	
	//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")));	
	
	echo "<input type=\"hidden\" name=\"trunk_no\" value=$trunk_no>";
?>
<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;
<!--=========================date from selection=================================-->
<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;
<!--=========================date to selection=================================-->
<select name="sel_date_to">
			<?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>
<a href=# onClick="javascript:myform.submit()" style="cursor:hand">
	<IMG border=0 src="../../images/search.gif" ><?php echo "$strSearch"; ?>
</a>
<?php
	
			
	echo "</td>";
	echo "<td align=\"right\">";
	//===================the back link button======================================
	echo "<a target=\"_parent\" href=\"../../performance/mscCsta/trunk_general_index.php?sel_date_from=$old_sel_date_from&sel_date_to=$old_sel_date_to&sel_in_out=$old_sel_in_out\"><img src=\"../../images/left.gif\" border=0></img>back</a>";
?>

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

?>	


	