/[health_html]/templates/bmi.tpl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /templates/bmi.tpl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by ravilov, Tue Sep 25 15:38:05 2001 UTC revision 1.2 by ravilov, Fri Sep 28 23:34:37 2001 UTC
# Line 1  Line 1 
1  {literal}  {literal}
2  <script type="text/javascript" language="JavaScript">  <script type="text/javascript" language="JavaScript">
3  <!-- // begin  <!-- // begin
4  function Zaokruzi(val, n) {  function Zaokruzi(val, n) {
5          if (!n) n = 1;          if (!n) n = 1;
6          var mul = 1;          var mul = 1;
7          for (var i = 0; i < n; i++) mul = mul * 10;          for (var i = 0; i < n; i++) mul = mul * 10;
8          return Math.ceil(val * mul) / mul;          return Math.ceil(val * mul) / mul;
9  }  }
10  function Izracunaj(form) {  function Izracunaj(form) {
11          var visina = form.elements["visina"] || form.visina;          var visina = form.elements["visina"] || form.visina;
12          var tezina = form.elements["tezina"] || form.tezina;          var tezina = form.elements["tezina"] || form.tezina;
13          var spol_obj = form.elements["spol"] || form.spol;          var spol_obj = form.elements["spol"] || form.spol;
14          var tez = parseFloat(String(tezina.value).replace(/,/, '.')) || "";          var tez = parseFloat(String(tezina.value).replace(/,/, '.')) || "";
15          var vis = parseFloat(String(visina.value).replace(/,/, '.')) || "";          var vis = parseFloat(String(visina.value).replace(/,/, '.')) || "";
16          var spol = "";          var spol = "";
17          if (spol_obj[0].checked) spol = "M";          if (spol_obj[0].checked) spol = "M";
18          if (spol_obj[1].checked) spol = "Z";          if (spol_obj[1].checked) spol = "Z";
19          visina.value = vis;          visina.value = vis;
20          tezina.value = tez;          tezina.value = tez;
21          if (!tez) { alert("Unesite svoju težinu u kg!"); tezina.focus(); return; }          if (!tez) { alert("Unesite svoju težinu u kg!"); tezina.focus(); return; }
22          if (!vis) { alert("Unesite svoju visinu u cm!"); visina.focus(); return; }          if (!vis) { alert("Unesite svoju visinu u cm!"); visina.focus(); return; }
23          // BMI = tezina[kg] / visina[m]^2          // BMI = tezina[kg] / visina[m]^2
24          vis = vis / 100;          vis = vis / 100;
25          var bmi = Zaokruzi(tez / (vis * vis));          var bmi = Zaokruzi(tez / (vis * vis));
26          var poruka = "";          var poruka = "";
27          var result = new Array();          var result = new Array();
28          if (spol == "M") result = new Array({/literal}{section name=i loop=$result_m}new Array({$i/result_m.l}, {$i/result_m.h}){if (%i.index% < %i.loop% - 1)}, {/if}{/section}{literal});          if (spol == "M") result = new Array({/literal}{section name=i loop=$result_m}new Array({$i/result_m.l}, {$i/result_m.h}){if (%i.index% < %i.loop% - 1)}, {/if}{/section}{literal});
29          if (spol == "Z") result = new Array({/literal}{section name=i loop=$result_z}new Array({$i/result_z.l}, {$i/result_z.h}){if (%i.index% < %i.loop% - 1)}, {/if}{/section}{literal});          if (spol == "Z") result = new Array({/literal}{section name=i loop=$result_z}new Array({$i/result_z.l}, {$i/result_z.h}){if (%i.index% < %i.loop% - 1)}, {/if}{/section}{literal});
30          var poruke = new Array({/literal}{section name=i loop=$poruke}"{$i/poruke.s}. {$i/poruke.l}"{if (%i.index% < %i.loop% - 1)}, {/if}{/section}{literal});          var poruke = new Array({/literal}{section name=i loop=$poruke}"{$i/poruke.s}. {$i/poruke.l}"{if (%i.index% < %i.loop% - 1)}, {/if}{/section}{literal});
31          for (var i = 0; i < result.length; i++) {          for (var i = 0; i < result.length; i++) {
32                  var l = result[i][0];                  var l = result[i][0];
33                  var h = result[i][1];                  var h = result[i][1];
34                  var this_msg = false;                  var this_msg = false;
35                  if (!this_msg && (l < 0) && (bmi < h)) this_msg = true;                  if (!this_msg && (l < 0) && (bmi < h)) this_msg = true;
36                  if (!this_msg && (h < 0) && (bmi > l)) this_msg = true;                  if (!this_msg && (h < 0) && (bmi > l)) this_msg = true;
37                  if (!this_msg && (bmi >= l && bmi <= h)) this_msg = true;                  if (!this_msg && (bmi >= l && bmi <= h)) this_msg = true;
38                  if (this_msg) poruka = poruke[i];                  if (this_msg) poruka = poruke[i];
39          }          }
40          if (poruka) poruka = "\n" + poruka;          if (poruka) poruka = "\n" + poruka;
41          alert("Vaš Body Mass Index (BMI) je:\n" + bmi + "\n" + poruka);          alert("Vaš Body Mass Index (BMI) je:\n" + bmi + "\n" + poruka);
42  }  }
43  document.onkeydown = function(e) {  document.onkeydown = function(e) {
44          var key = e ? e.which : window.event.keyCode;          var key = e ? e.which : window.event.keyCode;
45          return (key == 10 || key == 13) ? false : true;          return (key == 10 || key == 13) ? false : true;
46  }  }
47  if (document.captureEvents) document.captureEvents(Event.KEYDOWN);  if (document.captureEvents) document.captureEvents(Event.KEYDOWN);
48  // end -->  // end -->
49  </script>  </script>
50  {/literal}  {/literal}
51  <br>  <br>
52  Indeks tjelesne mase (eng. Body Mass Index - BMI) je popularni alat koji koriste liječnici za brzu procjenu optimalnosti tjelesne težine pojedinca. Vrlo je jednostavan i temelji se na odnosu tjelesne težine i visine osobe. Što je veći indeks, to je veći i rizik od oboljenja od raznih srčanih bolesti, dijabetesa i problema sa visokim tlakom. Naravno, ovo je samo jedna od metoda za procjenu je li Vaša težina u granicama poželjne i ne može se primijeniti jednoznačno za cijelu populaciju. Za potpunu i sigurnu procjenu, obratite se Vašem liječniku koji za razliku od ovog kalkulatora u obzir uzima i sve specifične faktore, te može poduzeti dodatne testove, koji su relevantni za svaki individualni slučaj.  Indeks tjelesne mase (eng. Body Mass Index - BMI) je popularni alat koji koriste liječnici za brzu procjenu optimalnosti tjelesne težine pojedinca. Vrlo je jednostavan i temelji se na odnosu tjelesne težine i visine osobe. Što je veći indeks, to je veći i rizik od oboljenja od raznih srčanih bolesti, dijabetesa i problema sa visokim tlakom. Naravno, ovo je samo jedna od metoda za procjenu je li Vaša težina u granicama poželjne i ne može se primijeniti jednoznačno za cijelu populaciju. Za potpunu i sigurnu procjenu, obratite se Vašem liječniku koji za razliku od ovog kalkulatora u obzir uzima i sve specifične faktore, te može poduzeti dodatne testove, koji su relevantni za svaki individualni slučaj.
53  <br><br>&nbsp;  <br><br>&nbsp;
54  <center>  <center>
55  <form name="input" method=post action="?section={$section}&amp;section_menu={$section_menu}&amp;section_menu2={$section_menu2}" onsubmit="Izracunaj(this); return false;">  <form name="input" method=post action="?section={$section}&amp;section_menu={$section_menu}&amp;section_menu2={$section_menu2}" onsubmit="Izracunaj(this); return false;">
56  <table border=1 cellspacing=0 cellpadding=5 bgcolor="#E0E0E0" width="90%"><tr><td>  <table border=0 cellspacing=0 cellpadding=0 bgcolor="#99CCFF">
57  <table border=0 cellspacing=0 cellpadding=2 width="100%">  <tr>
58  <tr><td align=left valign=middle width="40%">Težina:</td><td align=left valign=middle colspan=2><input type="text" name="tezina" value="{$tezina}" class="small" onfocus="select();">&nbsp;kg</td></tr>      <td width=160><img src="img/bmi.gif" border=0 alt="" width=160 height=200></td>
59  <tr><td align=left valign=middle>Visina:</td><td align=left valign=middle colspan=2><input type="text" name="visina" value="{$visina}" class="small" onfocus="select();">&nbsp;cm</td></tr>      <td align=center valign=middle><table border=0 cellspacing=0 cellpadding=4>
60  <tr><td align=left valign=middle>Spol:</td><td align=left valign=middle colspan=2><input type="radio" name="spol" value="M" class="small" id="_spol_M_"{if ($spol == "M")} checked{/if}>&nbsp;<label for="_spol_M_">Muško</label>&nbsp;&nbsp;&nbsp;<input type="radio" name="spol" value="Z" class="small" id="_spol_Z_"{if ($spol == "Z")} checked{/if}>&nbsp;<label for="_spol_Z_">Žensko</label></td></tr>          <tr><td align=center colspan=3><b>Unesite svoje podatke</b></td></tr>
61  <tr><td align=center valign=middle colspan=3><hr width="90%" size=2></td></tr>          <tr><td align=left>Težina:</td><td align=left><input type="text" name="tezina" value="{$tezina}" class="small" onfocus="select();"></td><td>kg</td></tr>
62  <tr><td align=left valign=top colspan=2>{if ($bmi)}Vaš Body Mass Index (BMI) je: <big><b>{$bmi}</b></big>{else}&nbsp;{/if}</td><td align=right valign=bottom><input type=submit name="izracunaj" value="Izračunaj BMI"></td></tr>          <tr><td align=left>Visina:</td><td align=left><input type="text" name="visina" value="{$visina}" class="small" onfocus="select();"></td><td>cm</td></tr>
63  {if ($poruka)}<tr><td align=left valign=middle colspan=3><br><i>{$poruka}</i></td></tr>{/if}          <tr><td align=left>Spol:</td><td align=center valign=middle><input type="radio" name="spol" value="M" class="small" id="_spol_M_"{if ($spol == "M")} checked{/if}>&nbsp;<label for="_spol_M_">M</label>&nbsp;&nbsp;<input type="radio" name="spol" value="Z" class="small" id="_spol_Z_"{if ($spol == "Z")} checked{/if}>&nbsp;<label for="_spol_Z_">Ž</label></td><td>&nbsp;</td></tr>
64  </table>          <tr><td colspan=3>&nbsp;</td></tr>
65  </td></tr></table>          <tr><td align=left>{if ($bmi)}BMI: <b>{$bmi}</b>{else}&nbsp;{/if}</td><td align=right><input type="image" name="izracunaj" src="img/izracunaj.gif" width="57" height="18" alt="" onclick="if (this.blur) this.blur(); return true;"></td><td>&nbsp;</td></tr>
66  <br>          <tr><td align=left valign=middle colspan=3>{if ($poruka)}<i>{$poruka}</i>{else}&nbsp;{/if}</td></tr>
67  <br>      </table></td>
68  <br>  </tr>
69  <table border=1 cellspacing=0 cellpadding=5 bgcolor="#E0E0E0" width="100%"><tr><td>  <tr>
70  <table border=0 cellspacing=0 cellpadding=4 width="100%">      <td bgcolor="#FFFFFF" colspan=2><img src="img/klir.gif" alt="" border=0 height="15">
71  <tr><th align=left valign=middle colspan=3><big>Interpretacija vrijednosti</big></th></tr>  </tr>
72  <tr><td align=center valign=middle colspan=2><br></td></tr>  <tr>
73  <tr><th align=center valign=top>M</th><th align=center valign=top>Ž</th><td>&nbsp;</td></tr>      <td align=center valign=middle colspan=2><table border=0 cellspacing=0 cellpadding=5 width="100%">
74  {section name=i loop=$poruke}          <tr><td colspan=4><b>Interpretacija vrijednosti</b></td></tr>
75  <tr>          <tr><td colspan=2 width="50%"><b>Muškarci</b></td><td colspan=2 width="50%"><b>Žene</b></td></tr>
76  <td align=center valign=top width="20%">{if ($i/result_m.l < 0)}&lt; {$i/result_m.h}{elseif ($i/result_m.h < 0)}&gt; {$i/result_m.l}{else}{$i/result_m.l} - {$i/result_m.h}{/if}</td>          {section name=i loop=$poruke}
77  <td align=center valign=top width="20%">{if ($i/result_z.l < 0)}&lt; {$i/result_z.h}{elseif ($i/result_z.h < 0)}&gt; {$i/result_z.l}{else}{$i/result_z.l} - {$i/result_z.h}{/if}</td>          <tr>
78  <td align=left valign=top>{$i/poruke.s}</td>              <td align=center valign=top width="20%"><small>{if ($i/result_m.l < 0)}&lt; {$i/result_m.h}{elseif ($i/result_m.h < 0)}&gt; {$i/result_m.l}{else}{$i/result_m.l}-{$i/result_m.h}{/if}</small></td>
79  </tr>              <td align=left valign=top><small>{$i/poruke.s}</small></td>
80  {/section}              <td align=center valign=top width="20%"><small>{if ($i/result_z.l < 0)}&lt; {$i/result_z.h}{elseif ($i/result_z.h < 0)}&gt; {$i/result_z.l}{else}{$i/result_z.l}-{$i/result_z.h}{/if}</small></td>
81  </table>              <td align=left valign=top><small>{$i/poruke.s}</small></td>
82  </td></tr></table>          </tr>
83  </center>          {/section}
84  <br>&nbsp;      </table></td>
85    </tr>
86    </table>
87    </center>
88    <br>&nbsp;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.26