Added option to omit circumferences in the Vitals form.
[openemr.git] / interface / forms / vitals / templates / vitals / general_new.html
blob7533ec57c1fba4da136c07a22a353be72afdef32
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>
128 <tr><td class="graph" id="bpd">{xl t="BP Diastolic"}</td><td>{xl t="mmHg"}</td>
129 <td class='currentvalues'><input type="text" size='5'
130 name='bpd' id='bpd_input' value="{$vitals->get_bpd()}"/></td>
131 {foreach item=result from=$results}
132 <td class='historicalvalues'>{$result.bpd}</td>
133 {/foreach}</tr>
135 <tr><td class="graph" id="pulse">{xl t="Pulse"}</td><td>{xl t="per min"}</td>
136 <td class='currentvalues'><input type="text" size='5'
137 name='pulse' id='pulse_input' value="{if $vitals->get_pulse() != 0}{$vitals->get_pulse()|string_format:"%.0f"}{/if}"/></td>
138 {foreach item=result from=$results}
139 <td class='historicalvalues'>{if $result.pulse != 0}{$result.pulse|string_format:"%.0f"}{/if}</td>
140 {/foreach}</tr>
142 <tr><td class="graph" id="respiration">{xl t="Respiration"}</td><td>{xl t="per min"}</td>
143 <td class='currentvalues'><input type="text" size='5'
144 name='respiration' id='respiration_input' value="{if $vitals->get_respiration() != 0}{$vitals->get_respiration()|string_format:"%.0f"}{/if}"/></td>
145 {foreach item=result from=$results}
146 <td class='historicalvalues'>{if $result.respiration != 0}{$result.respiration|string_format:"%.0f"}{/if}</td>
147 {/foreach}</tr>
149 {if $units_of_measurement == 4}<tr class="hide">{else}<tr>{/if}
150 {if $units_of_measurement == 2}<td class="unfocus graph" id="temperature">{else}<td class="graph" id="temperature">{/if}{xl t="Temperature"}</td>
151 {if $units_of_measurement == 2}<td class="unfocus">{else}<td>{/if}{xl t="F"}</td>
152 {if $units_of_measurement == 2}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
153 <input type="text" size='5' name='temperature' id='temperature_input' value="{if $vitals->get_temperature() != 0}{$vitals->get_temperature()}{/if}" onChange="convFtoC('temperature_input');"/>
154 </td>
155 {foreach item=result from=$results}
156 <td class='historicalvalues'>{if $result.temperature != 0}{$result.temperature}{/if}</td>
157 {/foreach}</tr>
159 {if $units_of_measurement == 3}<tr class="hide">{else}<tr>{/if}
160 {if $units_of_measurement == 1}<td class="unfocus graph" id="temperature_metric">{else}<td class="graph" id="temperature_metric">{/if}{xl t="Temperature"}</td>
161 {if $units_of_measurement == 1}<td class="unfocus">{else}<td>{/if}{xl t="C"}</td>
162 {if $units_of_measurement == 1}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
163 <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');"/>
164 </td>
165 {foreach item=result from=$results}
166 <td class='historicalvalues'>{if $result.temperature != 0}{math equation="(number - constant2 ) * constant" number=$result.temperature constant=0.5556 constant2=32 format="%.2f"}{/if}</td>
167 {/foreach}</tr>
169 <tr><td>{xl t="Temp Location"}<td></td></td>
170 <td class='currentvalues'><select name="temp_method" id='temp_method'/><option value=""> </option>
171 <option value="Oral" {if $vitals->get_temp_method() == "Oral" || $vitals->get_temp_method() == 2 } selected{/if}>{xl t="Oral"}
172 <option value="Tympanic Membrane" {if $vitals->get_temp_method() == "Tympanic Membrane" || $vitals->get_temp_method() == 1 } selected{/if}>{xl t="Tympanic Membrane"}
173 <option value="Rectal" {if $vitals->get_temp_method() == "Rectal" || $vitals->get_temp_method() == 3 } selected{/if}>{xl t="Rectal"}
174 <option value="Axillary" {if $vitals->get_temp_method() == "Axillary" || $vitals->get_temp_method() == 4 } selected{/if}>{xl t="Axillary"}
175 <option value="Temporal Artery" {if $vitals->get_temp_method() == "Temporal Artery" } selected{/if}>{xl t="Temporal Artery"}
176 </select></td>
177 {foreach item=result from=$results}
178 <td class='historicalvalues'>{if $result.temp_method}{xl t=$result.temp_method}{/if}</td>
179 {/foreach}</tr>
181 <tr><td class="graph" id="oxygen_saturation">{xl t="Oxygen Saturation"}</td><td>{xl t="%"}</td>
182 <td class='currentvalues'><input type="text" size='5'
183 name='oxygen_saturation' id='oxygen_saturation_input' value="{if $vitals->get_oxygen_saturation() != 0}{$vitals->get_oxygen_saturation()|string_format:"%.0f"}{/if}"/></td>
184 {foreach item=result from=$results}
185 <td class='historicalvalues'>{if $result.oxygen_saturation != 0}{$result.oxygen_saturation|string_format:"%.0f"}{/if}</td>
186 {/foreach}</tr>
188 {if $units_of_measurement == 4 || $gbl_vitals_options > 0}<tr class="hide">{else}<tr>{/if}
189 {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>
190 {if $units_of_measurement == 2}<td class="unfocus">{else}<td>{/if}{xl t="in"}</td>
191 {if $units_of_measurement == 2}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
192 <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');"/>
193 </td>
194 {foreach item=result from=$results}
195 <td class='historicalvalues'>{if $result.head_circ != 0}{$result.head_circ}{/if}</td>
196 {/foreach}</tr>
198 {if $units_of_measurement == 3 || $gbl_vitals_options > 0}<tr class="hide">{else}<tr>{/if}
199 {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>
200 {if $units_of_measurement == 1}<td class="unfocus">{else}<td>{/if}{xl t="cm"}</td>
201 {if $units_of_measurement == 1}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
202 <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');"/>
203 </td>
204 {foreach item=result from=$results}
205 <td class='historicalvalues'>{if $result.head_circ != 0}{math equation="number * constant" number=$result.head_circ constant=2.54 format="%.2f"}{/if}</td>
206 {/foreach}</tr>
208 {if $units_of_measurement == 4 || $gbl_vitals_options > 0}<tr class="hide">{else}<tr>{/if}
209 {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>
210 {if $units_of_measurement == 2}<td class="unfocus">{else}<td>{/if}{xl t="in"}</td>
211 {if $units_of_measurement == 2}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
212 <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');"/>
213 </td>
214 {foreach item=result from=$results}
215 <td class='historicalvalues'>{if $result.waist_circ != 0}{$result.waist_circ}{/if}</td>
216 {/foreach}</tr>
218 {if $units_of_measurement == 3 || $gbl_vitals_options > 0}<tr class="hide">{else}<tr>{/if}
219 {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>
220 {if $units_of_measurement == 1}<td class="unfocus">{else}<td>{/if}{xl t="cm"}</td>
221 {if $units_of_measurement == 1}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
222 <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');"/>
223 </td>
224 {foreach item=result from=$results}
225 <td class='historicalvalues'>{if $result.waist_circ != 0}{math equation="number * constant" number=$result.waist_circ constant=2.54 format="%.2f"}{/if}</td>
226 {/foreach}</tr>
228 <tr><td class="graph" id="BMI">{xl t="BMI"}</td><td>{xl t="kg/m^2"}</td>
229 <td class='currentvalues'><input type="text" size='5'
230 name='BMI' id='BMI_input' value="{if $vitals->get_BMI() != 0}{$vitals->get_BMI()|substr:0:5}{/if}"/></td>
231 {foreach item=result from=$results}
232 <td class='historicalvalues'>{if $result.BMI != 0}{$result.BMI|substr:0:5}{/if}</td>
233 {/foreach}</tr>
235 <tr><td>{xl t="BMI Status"}</td><td>{xl t="Type"}</td>
236 <td class='currentvalues'><input type="text" size='15'
237 name="BMI_status" id="BMI_status' value="{$vitals->get_BMI_status()}"/></td>
238 {foreach item=result from=$results}
239 <td class='historicalvalues'>{if $result.BMI_status}{xl t=$result.BMI_status}{/if}</td>
240 {/foreach}
241 </tr>
243 <tr><td>{xl t="Other Notes"}<td></td></td>
244 <td class='currentvalues'><input type="text" size='20'
245 name="note" id='note' value="{$vitals->get_note()}" /></td>
246 {foreach item=result from=$results}
247 <td class='historicalvalues'>{$result.note}</td>
248 {/foreach}</tr>
250 <tr>
251 <td colspan='3' style='text-align:center'>
252 {if $patient_age <= 20 || (preg_match('/month/', $patient_age))}
253 <!-- only show growth-chart button for patients < 20 years old -->
254 <!-- <input type="button" id="growthchart" value="{xl t="Growth-Chart"}" style='margin-left: 20px;'> -->
255 <input type="button" id="pdfchart" value="{xl t="Growth-Chart"} ({xl t="PDF"})" style='margin-left: 20px;'>
256 <input type="button" id="htmlchart" value="{xl t="Growth-Chart"} ({xl t="HTML"})" style='margin-left: 20px;'>
257 {/if}
258 </td>
259 </tr>
261 <tr><td colspan='3' style='text-align:center'>&nbsp;</td></tr>
262 <tr>
263 <td colspan='3' style='text-align:center'>
264 <input type="submit" class="editonly" name="Submit" value="{xl t="Save Form"}">
265 <input type="button" class="editonly" id="cancel" value="{xl t="Don't Save"}">
266 </td>
267 </tr>
268 </table>
269 <br><br>
270 <input type="hidden" name="id" id='id' value="{$vitals->get_id()}" />
271 <input type="hidden" name="activity" id='activity' value="{$vitals->get_activity()}">
272 <input type="hidden" name="pid" id='pid' value="{$vitals->get_pid()}">
273 <input type="hidden" name="process" id='process' value="true">
274 </form>
275 </body>
277 <script language="javascript">
278 var formdate = '{$vitals->get_date()|date_format:"%Y%m%d"}';
279 // vitals array elements are in the format:
280 // date-height-weight-head_circumference
281 var vitals = new Array();
282 // get values from the current form elements
283 vitals[0] = formdate+'-{$vitals->get_height()}-{$vitals->get_weight()}-{$vitals->get_head_circ()}';
284 // historic values
285 {foreach item=result from=$results}
286 vitals[vitals.length] = '{$result.date|date_format:"%Y%m%d"}-{$result.height}-{$result.weight}-{$result.head_circ}';
287 {/foreach}
288 var patientAge='{$patient_age}';
289 var patient_dob='{$patient_dob}';
290 var webroot = '{$FORM_ACTION}';
291 var pid = '{$vitals->get_pid()}';
292 var cancellink = '{$DONT_SAVE_LINK}';
293 var birth_xl='{xl t="Birth-24 months"}'
294 var older_xl='{xl t="2-20 years"}';
295 {literal}
296 function addGCSelector()
298 var options=new Array();
299 var birth={'display':birth_xl,'param':'birth'};
300 var age2={'display':older_xl,'param':'2-20'}
301 if((patientAge.indexOf('24 month')>=0) || (patientAge.indexOf('month')==-1))
303 var dob_data=patient_dob.split("-");
304 var dob_date=new Date(dob_data[0],parseInt(dob_data[1])-1,dob_data[2]);
305 options[0]=age2;
306 for(var idx=0;idx<vitals.length;idx++)
308 var str_data_date=vitals[idx].split("-")[0];
309 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));
310 if(((data_date-dob_date)/86400000)<=2*365)
312 idx=vitals.length;
313 options[1]=birth
317 else
319 options[0]=birth;
321 var chart_buttons_cell=$("#pdfchart").parent("td");
322 var select=$("<select id='chart_type'></select>");
323 chart_buttons_cell.prepend(select);
324 for(idx=0;idx<options.length;idx++)
326 var option=$("<option value='"+options[idx].param+"'>"+options[idx].display+"</option>");
327 select.append(option);
329 select.find("option:first").attr("selected","true");
330 if(options.length<2)
332 select.css("display","none");
336 $(document).ready(function(){
337 $("#growthchart").click(function() { ShowGrowthchart(); });
338 $("#pdfchart").click(function() { ShowGrowthchart(1); });
339 $("#htmlchart").click(function() { ShowGrowthchart(2); });
340 $("#cancel").click(function() { location.href=cancellink; });
341 addGCSelector();
344 function ShowGrowthchart(doPDF) {
345 // get values from the current form elements
346 {/literal}
347 vitals[0] = formdate+'-'+$("#height_input").val()+'-'+$("#weight_input").val()+'-'+$("#head_circ_input").val();
348 {literal}
349 // build the data string
350 var datastring = "";
351 for(var i=0; i<vitals.length; i++) {
352 datastring += vitals[i]+"~";
354 newURL = webroot+'/interface/forms/vitals/growthchart/chart.php?pid='+pid+'&data='+datastring;
355 if (doPDF == 1) newURL += "&pdf=1";
356 if (doPDF == 2) newURL += "&html=1";
357 newURL+="&chart_type="+$("#chart_type").val();
358 // do the new window stuff
359 top.restoreSession();
360 window.open(newURL, '_blank', "menubar=1,toolbar=1,scrollbars=1,resizable=1,width=600,height=450");
363 function convLbtoKg(name) {
364 var lb = $("#"+name).val();
365 var hash_loc=lb.indexOf("#");
366 if(hash_loc>=0)
368 var pounds=lb.substr(0,hash_loc);
369 var ounces=lb.substr(hash_loc+1);
370 var num=parseInt(pounds)+parseInt(ounces)/16;
371 lb=num;
372 $("#"+name).val(lb);
374 if (lb == "0") {
375 $("#"+name+"_metric").val("0");
377 else if (lb == parseFloat(lb)) {
378 kg = lb*0.45359237;
379 kg = kg.toFixed(2);
380 $("#"+name+"_metric").val(kg);
382 else {
383 $("#"+name+"_metric").val("");
386 if (name == "weight") {
387 calculateBMI();
391 function convKgtoLb(name) {
392 var kg = $("#"+name+"_metric").val();
394 if (kg == "0") {
395 $("#"+name).val("0");
397 else if (kg == parseFloat(kg)) {
398 lb = kg/0.45359237;
399 lb = lb.toFixed(2);
400 $("#"+name).val(lb);
402 else {
403 $("#"+name).val("");
406 if (name == "weight_input") {
407 calculateBMI();
411 function convIntoCm(name) {
412 var inch = $("#"+name).val();
414 if (inch == "0") {
415 $("#"+name+"_metric").val("0");
417 else if (inch == parseFloat(inch)) {
418 cm = inch*2.54;
419 cm = cm.toFixed(2);
420 $("#"+name+"_metric").val(cm);
422 else {
423 $("#"+name+"_metric").val("");
426 if (name == "height_input") {
427 calculateBMI();
431 function convCmtoIn(name) {
432 var cm = $("#"+name+"_metric").val();
434 if (cm == "0") {
435 $("#"+name).val("0");
437 else if (cm == parseFloat(cm)) {
438 inch = cm/2.54;
439 inch = inch.toFixed(2);
440 $("#"+name).val(inch);
442 else {
443 $("#"+name).val("");
446 if (name == "height_input") {
447 calculateBMI();
451 function convFtoC(name) {
452 var Fdeg = $("#"+name).val();
453 if (Fdeg == "0") {
454 $("#"+name+"_metric").val("0");
456 else if (Fdeg == parseFloat(Fdeg)) {
457 Cdeg = (Fdeg-32)*0.5556;
458 Cdeg = Cdeg.toFixed(2);
459 $("#"+name+"_metric").val(Cdeg);
461 else {
462 $("#"+name+"_metric").val("");
466 function convCtoF(name) {
467 var Cdeg = $("#"+name+"_metric").val();
468 if (Cdeg == "0") {
469 $("#"+name).val("0");
471 else if (Cdeg == parseFloat(Cdeg)) {
472 Fdeg = (Cdeg/0.5556)+32;
473 Fdeg = Fdeg.toFixed(2);
474 $("#"+name).val(Fdeg);
476 else {
477 $("#"+name).val("");
481 function calculateBMI() {
482 var bmi = 0;
483 var height = $("#height_input").val();
484 var weight = $("#weight_input").val();
485 if(height == 0 || weight == 0) {
486 $("#BMI").val("");
488 else if((height == parseFloat(height)) && (weight == parseFloat(weight))) {
489 bmi = weight/height/height*703;
490 bmi = bmi.toFixed(1);
491 $("#BMI_input").val(bmi);
493 else {
494 $("#BMI_input").val("");
498 Calendar.setup({inputField:"date", ifFormat:"%Y-%m-%d %H:%M", button:"img_date", showsTime:true});
500 </script>
501 {/literal}
503 </html>