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

Annotation of /templates/bmi.tpl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Tue Sep 25 15:38:05 2001 UTC (22 years, 7 months ago) by ravilov
Branch: MAIN
Major changes. Too numeruous to mention all here.

1 ravilov 1.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=1 cellspacing=0 cellpadding=5 bgcolor="#E0E0E0" width="90%"><tr><td>
57     <table border=0 cellspacing=0 cellpadding=2 width="100%">
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>
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>
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>
61     <tr><td align=center valign=middle colspan=3><hr width="90%" size=2></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>
63     {if ($poruka)}<tr><td align=left valign=middle colspan=3><br><i>{$poruka}</i></td></tr>{/if}
64     </table>
65     </td></tr></table>
66     <br>
67     <br>
68     <br>
69     <table border=1 cellspacing=0 cellpadding=5 bgcolor="#E0E0E0" width="100%"><tr><td>
70     <table border=0 cellspacing=0 cellpadding=4 width="100%">
71     <tr><th align=left valign=middle colspan=3><big>Interpretacija vrijednosti</big></th></tr>
72     <tr><td align=center valign=middle colspan=2><br></td></tr>
73     <tr><th align=center valign=top>M</th><th align=center valign=top>®</th><td>&nbsp;</td></tr>
74     {section name=i loop=$poruke}
75     <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>
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>
78     <td align=left valign=top>{$i/poruke.s}</td>
79     </tr>
80     {/section}
81     </table>
82     </td></tr></table>
83     </center>
84     <br>&nbsp;

  ViewVC Help
Powered by ViewVC 1.1.26