<?php
//Include the head file
require("../../inc/header.inc");
?>

<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 e1no=document.myform.e1_no.value;
		var in_out=document.myform.sel_in_out.value;
		var on_top=parent.e1_detail_down.document.myform.on_top_index.value;
		
		var scrolly=document.body.scrollTop;
		if(down_date_from<=down_date_to)
			down_date_to=down_date_from;
		
		//alert(ser_type);
		var urll='<?php echo"$PHP_SELF";?>?sel_date_from='+down_date_from+'&sel_date_to='+down_date_to+'&e1_no='+e1no+"&on_top_index="+on_top+"&scroll_y="+scrolly+"&sel_in_out="+in_out;
		window.location.href=urll;
		
	}
</script>
<base target="e1_detail_down">
<?php
	echo "<div style=\"position:absolute;top:0;left:840;\">";
	$helpId="3.2.3";
	showHelp($helpId);
	echo "</div>";
	//=================================test=======================================
	//echo "e1_no:$e1_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><tr><td><nobr>";
	echo "$strTitlePerformance > MSC > E1";
	echo "</td>";
	echo "</tr></table>";
	//=======================data initial==========================================
	if(!isset($sel_date_from))
		$sel_date_from=0;
	if(!isset($sel_date_to))
		$sel_date_to=0;
	if(!isset($e1_no))
		$e1_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")));	
	
	//===================the back link button======================================
	echo "<div style=\"position:absolute;top=90;left:790;\">";
	echo "<a target=\"_parent\" href=\"../../performance/mscCsta/e1_general_index.php?sel_date_from=$old_sel_date_from&sel_date_to=$old_sel_date_to&scroll_y=0&sel_in_out=$old_sel_in_out\"><img src=\"../../images/left.gif\" border=0 align=\"left\">back</img></a>";
	echo "</div>";
?>		
<form name="myform" action="e1_detail_down.php" method="post">
	<table><tr>
		<!--==================the trunk no hidden==============================-->
		<td>
			<?php
				echo "<input type=\"hidden\" name=\"e1_no\" value=$e1_no>";
			?>
		</td>
		<!--=========================in&out selection=============================-->
		<td>
			<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>
		</td>
		<td>
			
			<!--=========================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>to
		</td>
		<td>
			<!--=========================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>
		</td>
		<td>
			<!--=========================the search button============================-->
			<div onClick="javascript:myform.submit()" style="cursor:hand">
					<IMG align=absBottom border=0 src="../../images/search.gif" ><?php echo "$strSearch"; ?>
			<div>
		</td>
		<?php
			//add the blank-space 
			for($i=0;$i<60;$i++)
			{
				echo "<td>&nbsp</td>";
			}
		?>
	</tr></table>
	<!--==========================the print button=============================-->
			<div onClick="window.print();" style="position:absolute;top:90;left:840;cursor:hand">
				<img align=absBottom border=0 src="../../images/printer.gif" width="16" height="16">
			</div>