<?php
include('../../inc/globals.php');
require('../../inc/sql_connect.php');
include('../../inc/template.php');
include('../../inc/lang/tirestest.php');


define('THIS_PAGE_ID', 140);

$user_info = user_logged_in();


function calculate_speed($t_laius, $t_aspekt, $t_suurus, $v_laius, $v_aspekt, $v_suurus, $kiirus) {
 global $LANG;

	$sheight = round(($t_aspekt * $t_laius / 100), 2);
	$nheight = round(($v_aspekt * $v_laius / 100), 2);
	$sdiameter = round((($t_suurus * 25.4) + 2 * $sheight), 2);
	$ndiameter = round((($v_suurus * 25.4) + 2 * $nheight), 2);
	$newspeed = round((($ndiameter / $sdiameter) * $kiirus), 2);
  ?>
<div style="width:96%; border:solid 1px silver; background-color:#F5F5F5;">
<br>
  <table width=475 cellpadding=3 cellspacing=0 border=0>
    <tr>
      <td>
        <b><?php echo $LANG[219].' '.$kiirus.' '.$LANG[220].' <u>'.$newspeed.' '.$LANG[221];?></u></b><br><br>
      </td>
    </tr>
  </table>
<br>
  <table width=475 cellpadding=3 cellspacing=0 border=0>
    <tr>
      <td width=50% class="field">
        <b><?php echo $LANG[222];?>:</b><br>
        <?php echo $LANG[223];?>: <?php echo $sheight.' '.$LANG[227];?><br> 
        <?php echo $LANG[224];?>: <?php echo $t_laius.' '.$LANG[227];?><br>
        <?php echo $LANG[225];?>: <?php echo $sdiameter.' '.$LANG[227];?><br><br>
		</td><td width=50% class="field">
        <b><?php echo $LANG[226];?>:</b><br>
        <?php echo $LANG[223];?>: <?php echo $nheight.' '.$LANG[227];?><br> 
        <?php echo $LANG[224];?>: <?php echo $v_laius.' '.$LANG[227];?><br> 
        <?php echo $LANG[225];?>: <?php echo $ndiameter.' '.$LANG[227];?><br><br>
      </td>
    </tr>
  </table>
</div>
  <?php
}



show_header("", "", "./");


?>
<center>
  <br><br>
  <B><font size=2><?php echo $LANG[218];?></font></B>
  <br><br>

  <br><br>
  <?php
  if (isset($_POST["CalculateSpeed"]))
  {
    calculate_speed($_POST["tehase_laius"], $_POST["tehase_aspekt"], $_POST["tehase_suurus"], $_POST["valitud_laius"], $_POST["valitud_aspekt"], $_POST["valitud_suurus"], $_POST["kiirus"]);
  }
  ?>

  <br><br>
  <P align="left" class="field">
  &nbsp;&nbsp;<?php echo $LANG[228];?><br>
  &nbsp;&nbsp;<?php echo $LANG[229];?>
  <br><br><br><br>
  </P>

  <form action="<?php echo $PHP_SELF;?>" method="POST">
    <table cellpadding=3 cellspacing=0 border=0>
      <tr>
        <td align="right">
          <?php echo $LANG[230];?>:
    		</td>
    		<td>
          <select class="field" name="tehase_laius">
          <?php
          for ($e=155; $e<=315; $e += 10)
          {
            echo '<option value='.$e;
            if ($e == $_POST["tehase_laius"])
              echo ' SELECTED';
            echo '>'.$e.'</option>';
          }
          ?>
          </select>
          /
          <select class="field" name="tehase_aspekt">
          <?php
          for ($e=30; $e<=85; $e += 5)
          {
            echo '<option value='.$e;
            if ($e == $_POST["tehase_aspekt"])
              echo ' SELECTED';
            echo '>'.$e.'</option>';
          }
          ?>
          </select>
          - R
          <select class="field" name="tehase_suurus">
          <?php
          for ($e=10; $e<=20; $e++)
          {
            echo '<option value='.$e;
            if ($e == $_POST["tehase_suurus"])
              echo ' SELECTED';
            echo '>'.$e.'</option>';
          }
          ?>
          </select><br>
        </td>
      </tr>
      <tr>
        <td align="right">
          <?php echo $LANG[231];?>:
		</td>
		<td>
          <select class="field" name="valitud_laius">
          <?php
          for ($e=155; $e<=315; $e += 10)
          {
            echo '<option value='.$e;
            if ($e == $_POST["valitud_laius"])
              echo ' SELECTED';
            echo '>'.$e.'</option>';
          }
          ?>
          </select>
          /
          <select class="field" name="valitud_aspekt">
          <?php
          for ($e=30; $e<=85; $e += 5)
          {
            echo '<option value='.$e;
            if ($e == $_POST["valitud_aspekt"])
              echo ' SELECTED';
            echo '>'.$e.'</option>';
          }
          ?>
          </select>
          - R
          <select class="field" name="valitud_suurus">
          <?php
          for ($e=10; $e<=20; $e++)
          {
            echo '<option value='.$e;
            if ($e == $_POST["valitud_suurus"])
              echo ' SELECTED';
            echo '>'.$e.'</option>';
          }
          ?>
          </select><br>
        </td>
      </tr>
      <tr>
        <td align="right" noWrap>
          <?php echo $LANG[232];?></td><td><input type="text" name="kiirus" value=100 class="field" size=6> <?php echo $LANG[221];?>
        </td>
      </tr>
      <tr>
        <td colSpan=2 align="center">
          <input type="submit" name="CalculateSpeed" value="<?php echo $LANG[464];?>" class="field">
        </td>
      </tr>
    </table>
  </form>
</center>
<?php


show_footer('../../inc/column/news.inc');
?>