<link href="wstyle.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<div align="center">
<? if ($_GET['stat'] == '' ) { ?>
  <p><a href="index.php?page=14&stat=addtech" class="link">Add New Time</a></p>
  <table width="80%" border="0">
    <tr>
      <td class="td1"><div align="center">Time</div></td>
      <td class="td1"><div align="center">Max Number</div></td>
      <td width="10%" class="td1"><div align="center">Edit</div></td>
    </tr>
    <?	
                        $result = mysql_query('select * from p1_default_time'); 
                        while($row = mysql_fetch_array($result)){ 
                ?>
    <tr>
      <td class="td2"><div align="center"><? echo $row['time_name']?></div></td>
      <td class="td2"><div align="center"><? echo $row['max_number']?></div></td>
      <td class="td3"><div align="center"><a href="index.php?page=14&stat=edit&tid=<? echo $row['tid'] ?>" class="td3">Edit</a></div></td>
    </tr>
    <?
          }
    ?>
  </table>
<? } if ($_GET['stat'] == 'addtech' ) { ?>
<form id="form1" name="form1" method="post" action="index.php?page=14&stat=add">
  <table width="80%" border="0">
    <tr>
      <td width="20%" class="td1"><div align="center">
        <div align="center">Time</div>
      </div></td>
      <td width="30%" class="td2"><div align="center"><span id="sprytextfield1">
      <label>
      <input type="text" name="time_name" id="time_name" />
      </label>
      <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></div></td>
      </tr>
    <tr>
      <td class="td1"><div align="center">Max Number</div></td>
      <td class="td2"><div align="center"><span id="sprytextfield3">
        <input type="text" name="max_number" id="max_number" />
        <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></div></td>
    </tr>
  </table>
    <p>
      <input name="Submit" type="submit" class="Submit" id="Submit" value="   Save   " />
    </p>
</form>

<? } if ($_GET['stat'] == 'edit' ) { 
		$tid = $_GET['tid'];
		$query = mysql_query("SELECT * FROM p1_default_time where tid = $tid"); 		

?>

  	<form id="form2" name="form1" method="post" action="index.php?page=14&stat=update&tid=<? echo $tid ?>">
      <table width="80%" border="0">
        <tr>
          <td width="20%" class="td1"><div align="center">Time</div></td>
          <td width="30%" class="td2"><div align="center"><span id="sprytextfield2">
          <label>
          <input type="text" name="time_name" id="time_name" value="<? echo mysql_result($query,0,"time_name"); ?>" />
          </label>
          <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></div></td>
        </tr>
        <tr>
          <td class="td1"><div align="center">Max Number</div></td>
          <td class="td2"><div align="center"><span id="sprytextfield3">
            <input type="text" name="max_number" id="max_number" value="<? echo mysql_result($query,0,"max_number"); ?>" />
          <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></div></td>
        </tr>
</table>
      <p>
        <input name="Submit2" type="submit" class="Submit" id="Submit2" value="   Update   " />
      </p>
      <table width="80%" border="0">
      </table>
  </form>
  
  	<p>&nbsp;</p>
  <? } ?>  
</div>
<script type="text/javascript">
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "time", {format:"HH:mm:ss"});
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "time", {format:"HH:mm:ss"});
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "integer", {useCharacterMasking:true});
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "integer", {useCharacterMasking:true});
//-->
</script>
