
 function Fmt(x) { 
var v
if(x>=0) { v=''+(x+0.0005) } else { v=''+(x-0.0005) }
return v.substring(0,v.indexOf('.')+2) 
}

  function compute(form) {

if((form.sodium.value==null)||(form.sodium.value=="")||(isNaN(form.sodium.value))){
alert('Please enter the sodium (Na)value.');

return false;
}

if((form.chloride.value==null)||(form.chloride.value=="")||(isNaN(form.chloride.value))){
alert('Please enter the chloride (Cl)value.');

return false;
}

if((form.bicarbonate.value==null)||(form.bicarbonate.value=="")||(isNaN(form.bicarbonate.value))){
alert('Please enter the bicarbonate (HCO3-)value.');

return false;
}




form.aniongap.value =form.sodium.value-(1*form.chloride.value+1*form.bicarbonate.value);


form.deltagap.value = form.aniongap.value -12


}



