// JavaScript Document 


function doField(form) 
{ 
len = (form.room_length.value); 
width = (form.room_width.value); 
height = (form.room_height.value); 
spill_volume = (form.spill_vol.value); 
expansion = (document.form.material.options[document.form.material.selectedIndex].value); 
if ((expansion < .4)) { 
alert('Please select a Spill Type.'); 
} 
else { 
if (isNaN(height)) { 
alert('Please enter a numerical value for Room Height.'); 
document.form.room_height.focus(); 
document.form.room_height.select(); 
} 
else { 
if (isNaN(width)) { 
alert('Please enter a numerical value for Room Width.'); 
document.form.room_width.focus(); 
document.form.room_width.select(); 
} 
else { 
if (isNaN(len)) { 
alert('Please enter a numerical value for Room Length.'); 
document.form.room_length.focus(); 
document.form.room_length.select(); 
} 
else { 
if (isNaN(spill_volume)) { 
alert('Please enter a numerical value for Spill Volume.'); 
document.form.spill_vol.focus(); 
document.form.spill_vol.select(); 
} 
else
{ 
room_volume = len*width*height; 
form.room_volume.value = Math.round(room_volume*10)/10 + " m3"; 
gas_volume = (spill_volume * expansion); 
form.gas_volume.value = Math.round(gas_volume*10)/10 + " m3"; 
o2_volume = .2095 * (room_volume - gas_volume); 
form.o2_volume.value = Math.round(o2_volume*10)/10 + " m3"; 
o2_percent = 100 * (o2_volume/room_volume); 

if (o2_percent<0) 
{ 
o2_percent=0; 
} 
form.o2_percent.value = Math.round(o2_percent*10)/10 + " %"; 
} 

} 
} 
} 
} 
} 
