/[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

Contents of /templates/bmi.tpl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Fri Sep 28 23:34:37 2001 UTC (22 years, 7 months ago) by ravilov
Branch: MAIN
Changes since 1.1: +88 -84 lines
Added some new pages to PLIVAmed. Some bugfixes.

1 {literal}
2 <script type="text/javascript" language="JavaScript">
3 <!-- // begin
4 function Zaokruzi(val, n) {
5 if (!n) n = 1;
6 var mul = 1;
7 for (var i = 0; i < n; i++) mul = mul * 10;
8 return Math.ceil(val * mul) / mul;
9 }
10 function Izracunaj(form) {
11 var visina = form.elements["visina"] || form.visina;
12 var tezina = form.elements["tezina"] || form.tezina;
13 var spol_obj = form.elements["spol"] || form.spol;
14 var tez = parseFloat(String(tezina.value).replace(/,/, '.')) || "";
15 var vis = parseFloat(String(visina.value).replace(/,/, '.')) || "";
16 var spol = "";
17 if (spol_obj[0].checked) spol = "M";
18 if (spol_obj[1].checked) spol = "Z";
19 visina.value = vis;
20 tezina.value = tez;
21 if (!tez) { alert("Unesite svoju te¾inu u kg!"); tezina.focus(); return; }
22 if (!vis) { alert("Unesite svoju visinu u cm!"); visina.focus(); return; }
23 // BMI = tezina[kg] / visina[m]^2
24 vis = vis / 100;
25 var bmi = Zaokruzi(tez / (vis * vis));
26 var poruka = "";
27 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});
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});
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});
31 for (var i = 0; i < result.length; i++) {
32 var l = result[i][0];
33 var h = result[i][1];
34 var this_msg = false;
35 if (!this_msg && (l < 0) && (bmi < h)) this_msg = true;
36 if (!this_msg && (h < 0) && (bmi > l)) this_msg = true;
37 if (!this_msg && (bmi >= l && bmi <= h)) this_msg = true;
38 if (this_msg) poruka = poruke[i];
39 }
40 if (poruka) poruka = "\n" + poruka;
41 alert("Va¹ Body Mass Index (BMI) je:\n" + bmi + "\n" + poruka);
42 }
43 document.onkeydown = function(e) {
44 var key = e ? e.which : window.event.keyCode;
45 return (key == 10 || key == 13) ? false : true;
46 }
47 if (document.captureEvents) document.captureEvents(Event.KEYDOWN);
48 // end -->
49 </script>
50 {/literal}
51 <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.
53 <br><br>&nbsp;
54 <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;">
56 <table border=0 cellspacing=0 cellpadding=0 bgcolor="#99CCFF">
57 <tr>
58 <td width=160><img src="img/bmi.gif" border=0 alt="" width=160 height=200></td>
59 <td align=center valign=middle><table border=0 cellspacing=0 cellpadding=4>
60 <tr><td align=center colspan=3><b>Unesite svoje podatke</b></td></tr>
61 <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>Visina:</td><td align=left><input type="text" name="visina" value="{$visina}" class="small" onfocus="select();"></td><td>cm</td></tr>
63 <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 <tr><td colspan=3>&nbsp;</td></tr>
65 <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 <tr><td align=left valign=middle colspan=3>{if ($poruka)}<i>{$poruka}</i>{else}&nbsp;{/if}</td></tr>
67 </table></td>
68 </tr>
69 <tr>
70 <td bgcolor="#FFFFFF" colspan=2><img src="img/klir.gif" alt="" border=0 height="15">
71 </tr>
72 <tr>
73 <td align=center valign=middle colspan=2><table border=0 cellspacing=0 cellpadding=5 width="100%">
74 <tr><td colspan=4><b>Interpretacija vrijednosti</b></td></tr>
75 <tr><td colspan=2 width="50%"><b>Mu¹karci</b></td><td colspan=2 width="50%"><b>®ene</b></td></tr>
76 {section name=i loop=$poruke}
77 <tr>
78 <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 <td align=left valign=top><small>{$i/poruke.s}</small></td>
80 <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 <td align=left valign=top><small>{$i/poruke.s}</small></td>
82 </tr>
83 {/section}
84 </table></td>
85 </tr>
86 </table>
87 </center>
88 <br>&nbsp;

  ViewVC Help
Powered by ViewVC 1.1.26