Allow selection of which chart to display for patients 2 years or old.
[openemr.git] / interface / forms / vitals / templates / vitals / general_new.html
blob580326574fea03334885762de07f939707c4f3e9
1 <html>
2 <head>
3 {php}html_header_show();{/php}
5 <style type="text/css">@import url({$FORM_ACTION}/library/dynarch_calendar.css);</style>
6 <script type="text/javascript" src="{$FORM_ACTION}/library/dialog.js"></script>
7 <script type="text/javascript" src="{$FORM_ACTION}/library/textformat.js"></script>
8 <script type="text/javascript" src="{$FORM_ACTION}/library/dynarch_calendar.js"></script>
9 {php} include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); {/php}
10 <script type="text/javascript" src="{$FORM_ACTION}/library/dynarch_calendar_setup.js"></script>
12 <script type="text/javascript">
13 var mypcc = '{php} echo $GLOBALS['phone_country_code'] {/php}';
14 {literal}
15 // Only load jquery if not already closing. This page serves two purposes now,
16 // for entring of vitals and for graphing/trending previous vitals by being embedded
17 // in the interface/patient_file/encounter/trend_form.php page.
18 if (typeof jQuery == 'undefined') {
19 document.write("<script type='text/javascript' src='{/literal}{php}echo $GLOBALS['webroot'];{/php}{literal}/library/js/jquery.js'><\/script>")
21 </script>
22 <style type="text/css" title="mystyles" media="all">
23 .title {
24 font-size: 120%;
25 font-weight: bold;
27 .currentvalues {
28 border-right: 1px solid black;
29 padding-right:5px;
30 text-align: left;
32 .valuesunfocus {
33 border-right: 1px solid black;
34 padding-right:5px;
35 background-color: #ccc;
36 text-align: left;
38 .unfocus {
39 background-color: #ccc;
41 .historicalvalues {
42 background-color: #ccc;
43 border-bottom: 1px solid #ddd;
44 border-right: 1px solid #ddd;
45 text-align: right;
47 table {
48 border-collapse: collapse;
50 td,th {
51 padding-right: 10px;
52 padding-left: 10px;
54 .hide {
55 display:none;
57 .readonly {
58 display:none;
60 </style>
61 {/literal}
63 </head>
64 <body bgcolor="{$STYLE.BGCOLOR2}">
65 <p><table><tr><td><span class="title">{xl t="Vitals"}</span></td><td>&nbsp;&nbsp;&nbsp;<a href="../summary/demographics.php" class="readonly css_button_small" onclick="top.restoreSession()"> <span>{xl t="View Patient"}</span></a></td></tr></table></p>
66 <form name="vitals" method="post" action="{$FORM_ACTION}/interface/forms/vitals/save.php" onSubmit="return top.restoreSession()">
67 <div id="chart"></div>
68 <table>
69 <tr><th align="left">{xl t="Name"}</th><th align="left">{xl t="Unit"}</th>
70 <th class='currentvalues' title='{xl t='Date and time of this observation'}'>
71 <input type='text' size='14' name='date' id='date'
72 value='{$vitals->get_date()|date_format:"%Y-%m-%d %H:%M"}'
73 onkeyup='datekeyup(this,mypcc,true)' onblur='dateblur(this,mypcc,true)' />
74 <img src='{$FORM_ACTION}/interface/pic/show_calendar.gif' id='img_date' align='absbottom'
75 width='24' height='22' border='0' alt='[?]' style='cursor:pointer' />
76 </th>
77 {foreach item=result from=$results}
78 <th class='historicalvalues'>{$result.date|date_format:"%Y-%m-%d %H:%M"}</th>
79 {/foreach}</tr>
81 {if $units_of_measurement == 4}<tr class="hide">{else}<tr>{/if}
82 {if $units_of_measurement == 2}<td class="unfocus graph" id="weight">{else}<td class="graph" id="weight">{/if}{xl t="Weight"}</td>
83 {if $units_of_measurement == 2}<td class="unfocus">{else}<td>{/if}{xl t="lbs"}</td>
84 {if $units_of_measurement == 2}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
85 <input type="text" size='5' name='weight' id='weight_input' value="{if $vitals->get_weight() != 0}{$vitals->get_weight()}{/if}" onChange="convLbtoKg('weight_input');" title='{xl t="Decimal pounds or pounds and ounces separated by #(e.g. 5#4)"}'/>
86 </td>
87 {foreach item=result from=$results}
88 <td class='historicalvalues'>{$vitals->display_weight($result.weight)}</td>
89 {/foreach}</tr>
91 {if $units_of_measurement == 3}<tr class="hide">{else}<tr>{/if}
92 {if $units_of_measurement == 1}<td class="unfocus graph" id="weight_metric">{else}<td class="graph" id="weight_metric">{/if}{xl t="Weight"}</td>
93 {if $units_of_measurement == 1}<td class="unfocus">{else}<td>{/if}{xl t="kg"}</td>
94 {if $units_of_measurement == 1}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
95 <input type="text" size='5' id='weight_input_metric' value="{if $vitals->get_weight() != 0}{math equation="number * constant" number=$vitals->get_weight() constant=0.45359237 format="%.2f"}{/if}" onChange="convKgtoLb('weight_input');"/>
96 </td>
97 {foreach item=result from=$results}
98 <td class='historicalvalues'>{if $result.weight != 0}{math equation="number * constant" number=$result.weight constant=0.45359237 format="%.2f"}{/if}</td>
99 {/foreach}</tr>
101 {if $units_of_measurement == 4}<tr class="hide">{else}<tr>{/if}
102 {if $units_of_measurement == 2}<td class="unfocus graph" id="height">{else}<td class="graph" id="height">{/if}{xl t="Height"}</td>
103 {if $units_of_measurement == 2}<td class="unfocus">{else}<td>{/if}{xl t="in"}</td>
104 {if $units_of_measurement == 2}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
105 <input type="text" size='5' name='height' id='height_input' value="{if $vitals->get_height() != 0}{$vitals->get_height()}{/if}" onChange="convIntoCm('height_input');"/>
106 </td>
107 {foreach item=result from=$results}
108 <td class='historicalvalues'>{if $result.height != 0}{$result.height}{/if}</td>
109 {/foreach}</tr>
111 {if $units_of_measurement == 3}<tr class="hide">{else}<tr>{/if}
112 {if $units_of_measurement == 1}<td class="unfocus graph" id="height_metric">{else}<td class="graph" id="height_metric">{/if}{xl t="Height"}</td>
113 {if $units_of_measurement == 1}<td class="unfocus">{else}<td>{/if}{xl t="cm"}</td>
114 {if $units_of_measurement == 1}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
115 <input type="text" size='5' id='height_input_metric' value="{if $vitals->get_height() != 0}{math equation="number * constant" number=$vitals->get_height() constant=2.54 format="%.2f"}{/if}" onChange="convCmtoIn('height_input');"/>
116 </td>
117 {foreach item=result from=$results}
118 <td class='historicalvalues'>{if $result.height != 0}{math equation="number * constant" number=$result.height constant=2.54 format="%.2f"}{/if}</td>
119 {/foreach}</tr>
121 <tr><td class="graph" id="bps">{xl t="BP Systolic"}</td><td>{xl t="mmHg"}</td>
122 <td class='currentvalues'><input type="text" size='5'
123 name='bps' id='bps_input' value="{$vitals->get_bps()}"/></td>
124 {foreach item=result from=$results}
125 <td class='historicalvalues'>{$result.bps}</td>
126 {/foreach}</tr>
127 <tr><td class="graph" id="bpd">{xl t="BP Diastolic"}</td><td>{xl t="mmHg"}</td>
128 <td class='currentvalues'><input type="text" size='5'
129 name='bpd' id='bpd_input' value="{$vitals->get_bpd()}"/></td>
130 {foreach item=result from=$results}
131 <td class='historicalvalues'>{$result.bpd}</td>
132 {/foreach}</tr>
133 <tr><td class="graph" id="pulse">{xl t="Pulse"}</td><td>{xl t="per min"}</td>
134 <td class='currentvalues'><input type="text" size='5'
135 name='pulse' id='pulse_input' value="{if $vitals->get_pulse() != 0}{$vitals->get_pulse()|string_format:"%.0f"}{/if}"/></td>
136 {foreach item=result from=$results}
137 <td class='historicalvalues'>{if $result.pulse != 0}{$result.pulse|string_format:"%.0f"}{/if}</td>
138 {/foreach}</tr>
139 <tr><td class="graph" id="respiration">{xl t="Respiration"}</td><td>{xl t="per min"}</td>
140 <td class='currentvalues'><input type="text" size='5'
141 name='respiration' id='respiration_input' value="{if $vitals->get_respiration() != 0}{$vitals->get_respiration()|string_format:"%.0f"}{/if}"/></td>
142 {foreach item=result from=$results}
143 <td class='historicalvalues'>{if $result.respiration != 0}{$result.respiration|string_format:"%.0f"}{/if}</td>
144 {/foreach}</tr>
146 {if $units_of_measurement == 4}<tr class="hide">{else}<tr>{/if}
147 {if $units_of_measurement == 2}<td class="unfocus graph" id="temperature">{else}<td class="graph" id="temperature">{/if}{xl t="Temperature"}</td>
148 {if $units_of_measurement == 2}<td class="unfocus">{else}<td>{/if}{xl t="F"}</td>
149 {if $units_of_measurement == 2}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
150 <input type="text" size='5' name='temperature' id='temperature_input' value="{if $vitals->get_temperature() != 0}{$vitals->get_temperature()}{/if}" onChange="convFtoC('temperature_input');"/>
151 </td>
152 {foreach item=result from=$results}
153 <td class='historicalvalues'>{if $result.temperature != 0}{$result.temperature}{/if}</td>
154 {/foreach}</tr>
156 {if $units_of_measurement == 3}<tr class="hide">{else}<tr>{/if}
157 {if $units_of_measurement == 1}<td class="unfocus graph" id="temperature_metric">{else}<td class="graph" id="temperature_metric">{/if}{xl t="Temperature"}</td>
158 {if $units_of_measurement == 1}<td class="unfocus">{else}<td>{/if}{xl t="C"}</td>
159 {if $units_of_measurement == 1}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
160 <input type="text" size='5' id='temperature_input_metric' value="{if $vitals->get_temperature() != 0}{math equation="(number - constant2 ) * constant" number=$vitals->get_temperature() constant=0.5556 constant2=32 format="%.2f"}{/if}" onChange="convCtoF('temperature_input');"/>
161 </td>
162 {foreach item=result from=$results}
163 <td class='historicalvalues'>{if $result.temperature != 0}{math equation="(number - constant2 ) * constant" number=$result.temperature constant=0.5556 constant2=32 format="%.2f"}{/if}</td>
164 {/foreach}</tr>
166 <tr><td>{xl t="Temp Location"}<td></td></td>
167 <td class='currentvalues'><select name="temp_method" id='temp_method'/><option value=""> </option>
168 <option value="Oral" {if $vitals->get_temp_method() == "Oral" || $vitals->get_temp_method() == 2 } selected{/if}>{xl t="Oral"}
169 <option value="Tympanic Membrane" {if $vitals->get_temp_method() == "Tympanic Membrane" || $vitals->get_temp_method() == 1 } selected{/if}>{xl t="Tympanic Membrane"}
170 <option value="Rectal" {if $vitals->get_temp_method() == "Rectal" || $vitals->get_temp_method() == 3 } selected{/if}>{xl t="Rectal"}
171 <option value="Axillary" {if $vitals->get_temp_method() == "Axillary" || $vitals->get_temp_method() == 4 } selected{/if}>{xl t="Axillary"}
172 <option value="Temporal Artery" {if $vitals->get_temp_method() == "Temporal Artery" } selected{/if}>{xl t="Temporal Artery"}
173 </select></td>
174 {foreach item=result from=$results}
175 <td class='historicalvalues'>{if $result.temp_method}{xl t=$result.temp_method}{/if}</td>
176 {/foreach}</tr>
178 <tr><td class="graph" id="oxygen_saturation">{xl t="Oxygen Saturation"}</td><td>{xl t="%"}</td>
179 <td class='currentvalues'><input type="text" size='5'
180 name='oxygen_saturation' id='oxygen_saturation_input' value="{if $vitals->get_oxygen_saturation() != 0}{$vitals->get_oxygen_saturation()|string_format:"%.0f"}{/if}"/></td>
181 {foreach item=result from=$results}
182 <td class='historicalvalues'>{if $result.oxygen_saturation != 0}{$result.oxygen_saturation|string_format:"%.0f"}{/if}</td>
183 {/foreach}</tr>
185 {if $units_of_measurement == 4}<tr class="hide">{else}<tr>{/if}
186 {if $units_of_measurement == 2}<td class="unfocus graph" id="head_circ">{else}<td class="graph" id="head_circ">{/if}{xl t="Head Circumference"}</td>
187 {if $units_of_measurement == 2}<td class="unfocus">{else}<td>{/if}{xl t="in"}</td>
188 {if $units_of_measurement == 2}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
189 <input type="text" size='5' name='head_circ' id='head_circ_input' value="{if $vitals->get_head_circ() != 0}{$vitals->get_head_circ()}{/if}" onChange="convIntoCm('head_circ_input');"/>
190 </td>
191 {foreach item=result from=$results}
192 <td class='historicalvalues'>{if $result.head_circ != 0}{$result.head_circ}{/if}</td>
193 {/foreach}</tr>
195 {if $units_of_measurement == 3}<tr class="hide">{else}<tr>{/if}
196 {if $units_of_measurement == 1}<td class="unfocus graph" id="head_circ_metric">{else}<td class="graph" id="head_circ_metric">{/if}{xl t="Head Circumference"}</td>
197 {if $units_of_measurement == 1}<td class="unfocus">{else}<td>{/if}{xl t="cm"}</td>
198 {if $units_of_measurement == 1}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
199 <input type="text" size='5' id='head_circ_input_metric' value="{if $vitals->get_head_circ() != 0}{math equation="number * constant" number=$vitals->get_head_circ() constant=2.54 format="%.2f"}{/if}" onChange="convCmtoIn('head_circ_input');"/>
200 </td>
201 {foreach item=result from=$results}
202 <td class='historicalvalues'>{if $result.head_circ != 0}{math equation="number * constant" number=$result.head_circ constant=2.54 format="%.2f"}{/if}</td>
203 {/foreach}</tr>
205 {if $units_of_measurement == 4}<tr class="hide">{else}<tr>{/if}
206 {if $units_of_measurement == 2}<td class="unfocus graph" id="waist_circ">{else}<td class="graph" id="waist_circ">{/if}{xl t="Waist Circumference"}</td>
207 {if $units_of_measurement == 2}<td class="unfocus">{else}<td>{/if}{xl t="in"}</td>
208 {if $units_of_measurement == 2}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
209 <input type="text" size='5' name='waist_circ' id='waist_circ_input' value="{if $vitals->get_waist_circ() != 0}{$vitals->get_waist_circ()}{/if}" onChange="convIntoCm('waist_circ_input');"/>
210 </td>
211 {foreach item=result from=$results}
212 <td class='historicalvalues'>{if $result.waist_circ != 0}{$result.waist_circ}{/if}</td>
213 {/foreach}</tr>
215 {if $units_of_measurement == 3}<tr class="hide">{else}<tr>{/if}
216 {if $units_of_measurement == 1}<td class="unfocus graph" id="waist_circ_metric">{else}<td class="graph" id="waist_circ_metric">{/if}{xl t="Waist Circumference"}</td>
217 {if $units_of_measurement == 1}<td class="unfocus">{else}<td>{/if}{xl t="cm"}</td>
218 {if $units_of_measurement == 1}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
219 <input type="text" size='5' id='waist_circ_input_metric' value="{if $vitals->get_waist_circ() != 0}{math equation="number * constant" number=$vitals->get_waist_circ() constant=2.54 format="%.2f"}{/if}" onChange="convCmtoIn('waist_circ_input');"/>
220 </td>
221 {foreach item=result from=$results}
222 <td class='historicalvalues'>{if $result.waist_circ != 0}{math equation="number * constant" number=$result.waist_circ constant=2.54 format="%.2f"}{/if}</td>
223 {/foreach}</tr>
225 <tr><td class="graph" id="BMI">{xl t="BMI"}</td><td>{xl t="kg/m^2"}</td>
226 <td class='currentvalues'><input type="text" size='5'
227 name='BMI' id='BMI_input' value="{if $vitals->get_BMI() != 0}{$vitals->get_BMI()|substr:0:5}{/if}"/></td>
228 {foreach item=result from=$results}
229 <td class='historicalvalues'>{if $result.BMI != 0}{$result.BMI|substr:0:5}{/if}</td>
230 {/foreach}</tr>
232 <tr><td>{xl t="BMI Status"}</td><td>{xl t="Type"}</td>
233 <td class='currentvalues'><input type="text" size='15'
234 name="BMI_status" id="BMI_status' value="{$vitals->get_BMI_status()}"/></td>
235 {foreach item=result from=$results}
236 <td class='historicalvalues'>{if $result.BMI_status}{xl t=$result.BMI_status}{/if}</td>
237 {/foreach}
238 </tr>
240 <tr><td>{xl t="Other Notes"}<td></td></td>
241 <td class='currentvalues'><input type="text" size='20'
242 name="note" id='note' value="{$vitals->get_note()}" /></td>
243 {foreach item=result from=$results}
244 <td class='historicalvalues'>{$result.note}</td>
245 {/foreach}</tr>
247 <tr>
248 <td colspan='3' style='text-align:center'>
249 {if $patient_age <= 20 || (preg_match('/month/', $patient_age))}
250 <!-- only show growth-chart button for patients < 20 years old -->
251 <!-- <input type="button" id="growthchart" value="{xl t="Growth-Chart"}" style='margin-left: 20px;'> -->
252 <input type="button" id="pdfchart" value="{xl t="Growth-Chart"} ({xl t="PDF"})" style='margin-left: 20px;'>
253 <input type="button" id="htmlchart" value="{xl t="Growth-Chart"} ({xl t="HTML"})" style='margin-left: 20px;'>
254 {/if}
255 </td>
256 </tr>
257 <tr><td colspan='3' style='text-align:center'>&nbsp;</td></tr>
258 <tr>
259 <td colspan='3' style='text-align:center'>
260 <input type="submit" class="editonly" name="Submit" value="{xl t="Save Form"}">
261 <input type="button" class="editonly" id="cancel" value="{xl t="Don't Save"}">
262 </td>
263 </tr>
264 </table>
265 <br><br>
266 <input type="hidden" name="id" id='id' value="{$vitals->get_id()}" />
267 <input type="hidden" name="activity" id='activity' value="{$vitals->get_activity()}">
268 <input type="hidden" name="pid" id='pid' value="{$vitals->get_pid()}">
269 <input type="hidden" name="process" id='process' value="true">
270 </form>
271 </body>
273 <script language="javascript">
274 var formdate = '{$vitals->get_date()|date_format:"%Y%m%d"}';
275 // vitals array elements are in the format:
276 // date-height-weight-head_circumference
277 var vitals = new Array();
278 // get values from the current form elements
279 vitals[0] = formdate+'-{$vitals->get_height()}-{$vitals->get_weight()}-{$vitals->get_head_circ()}';
280 // historic values
281 {foreach item=result from=$results}
282 vitals[vitals.length] = '{$result.date|date_format:"%Y%m%d"}-{$result.height}-{$result.weight}-{$result.head_circ}';
283 {/foreach}
284 var patientAge='{$patient_age}';
285 var patient_dob='{$patient_dob}';
286 var webroot = '{$FORM_ACTION}';
287 var pid = '{$vitals->get_pid()}';
288 var cancellink = '{$DONT_SAVE_LINK}';
289 var birth_xl='{xl t="Birth-24 months"}'
290 var older_xl='{xl t="2-20 years"}';
291 {literal}
292 function addGCSelector()
294 var options=new Array();
295 var birth={'display':birth_xl,'param':'birth'};
296 var age2={'display':older_xl,'param':'2-20'}
297 if((patientAge.indexOf('24 month')>=0) || (patientAge.indexOf('month')==-1))
299 var dob_data=patient_dob.split("-");
300 var dob_date=new Date(dob_data[0],parseInt(dob_data[1])-1,dob_data[2]);
301 options[0]=age2;
302 for(var idx=0;idx<vitals.length;idx++)
304 var str_data_date=vitals[idx].split("-")[0];
305 var data_date=new Date(str_data_date.substr(0,4),parseInt(str_data_date.substr(4,2))-1,str_data_date.substr(6,2));
306 if(((data_date-dob_date)/86400000)<=2*365)
308 idx=vitals.length;
309 options[1]=birth
313 else
315 options[0]=birth;
317 var chart_buttons_cell=$("#pdfchart").parent("td");
318 var select=$("<select id='chart_type'></select>");
319 chart_buttons_cell.prepend(select);
320 for(idx=0;idx<options.length;idx++)
322 var option=$("<option value='"+options[idx].param+"'>"+options[idx].display+"</option>");
323 select.append(option);
325 select.find("option:first").attr("selected","true");
326 if(options.length<2)
328 select.css("display","none");
332 $(document).ready(function(){
333 $("#growthchart").click(function() { ShowGrowthchart(); });
334 $("#pdfchart").click(function() { ShowGrowthchart(1); });
335 $("#htmlchart").click(function() { ShowGrowthchart(2); });
336 $("#cancel").click(function() { location.href=cancellink; });
337 addGCSelector();
340 function ShowGrowthchart(doPDF) {
341 // get values from the current form elements
342 {/literal}
343 vitals[0] = formdate+'-'+$("#height_input").val()+'-'+$("#weight_input").val()+'-'+$("#head_circ_input").val();
344 {literal}
345 // build the data string
346 var datastring = "";
347 for(var i=0; i<vitals.length; i++) {
348 datastring += vitals[i]+"~";
350 newURL = webroot+'/interface/forms/vitals/growthchart/chart.php?pid='+pid+'&data='+datastring;
351 if (doPDF == 1) newURL += "&pdf=1";
352 if (doPDF == 2) newURL += "&html=1";
353 newURL+="&chart_type="+$("#chart_type").val();
354 // do the new window stuff
355 top.restoreSession();
356 window.open(newURL, '_blank', "menubar=1,toolbar=1,scrollbars=1,resizable=1,width=600,height=450");
359 function convLbtoKg(name) {
360 var lb = $("#"+name).val();
361 var hash_loc=lb.indexOf("#");
362 if(hash_loc>=0)
364 var pounds=lb.substr(0,hash_loc);
365 var ounces=lb.substr(hash_loc+1);
366 var num=parseInt(pounds)+parseInt(ounces)/16;
367 lb=num;
368 $("#"+name).val(lb);
370 if (lb == "0") {
371 $("#"+name+"_metric").val("0");
373 else if (lb == parseFloat(lb)) {
374 kg = lb*0.45359237;
375 kg = kg.toFixed(2);
376 $("#"+name+"_metric").val(kg);
378 else {
379 $("#"+name+"_metric").val("");
382 if (name == "weight") {
383 calculateBMI();
387 function convKgtoLb(name) {
388 var kg = $("#"+name+"_metric").val();
390 if (kg == "0") {
391 $("#"+name).val("0");
393 else if (kg == parseFloat(kg)) {
394 lb = kg/0.45359237;
395 lb = lb.toFixed(2);
396 $("#"+name).val(lb);
398 else {
399 $("#"+name).val("");
402 if (name == "weight_input") {
403 calculateBMI();
407 function convIntoCm(name) {
408 var inch = $("#"+name).val();
410 if (inch == "0") {
411 $("#"+name+"_metric").val("0");
413 else if (inch == parseFloat(inch)) {
414 cm = inch*2.54;
415 cm = cm.toFixed(2);
416 $("#"+name+"_metric").val(cm);
418 else {
419 $("#"+name+"_metric").val("");
422 if (name == "height_input") {
423 calculateBMI();
427 function convCmtoIn(name) {
428 var cm = $("#"+name+"_metric").val();
430 if (cm == "0") {
431 $("#"+name).val("0");
433 else if (cm == parseFloat(cm)) {
434 inch = cm/2.54;
435 inch = inch.toFixed(2);
436 $("#"+name).val(inch);
438 else {
439 $("#"+name).val("");
442 if (name == "height_input") {
443 calculateBMI();
447 function convFtoC(name) {
448 var Fdeg = $("#"+name).val();
449 if (Fdeg == "0") {
450 $("#"+name+"_metric").val("0");
452 else if (Fdeg == parseFloat(Fdeg)) {
453 Cdeg = (Fdeg-32)*0.5556;
454 Cdeg = Cdeg.toFixed(2);
455 $("#"+name+"_metric").val(Cdeg);
457 else {
458 $("#"+name+"_metric").val("");
462 function convCtoF(name) {
463 var Cdeg = $("#"+name+"_metric").val();
464 if (Cdeg == "0") {
465 $("#"+name).val("0");
467 else if (Cdeg == parseFloat(Cdeg)) {
468 Fdeg = (Cdeg/0.5556)+32;
469 Fdeg = Fdeg.toFixed(2);
470 $("#"+name).val(Fdeg);
472 else {
473 $("#"+name).val("");
477 function calculateBMI() {
478 var bmi = 0;
479 var height = $("#height_input").val();
480 var weight = $("#weight_input").val();
481 if(height == 0 || weight == 0) {
482 $("#BMI").val("");
484 else if((height == parseFloat(height)) && (weight == parseFloat(weight))) {
485 bmi = weight/height/height*703;
486 bmi = bmi.toFixed(1);
487 $("#BMI_input").val(bmi);
489 else {
490 $("#BMI_input").val("");
494 Calendar.setup({inputField:"date", ifFormat:"%Y-%m-%d %H:%M", button:"img_date", showsTime:true});
496 </script>
497 {/literal}
499 </html>