
//Javascript for Calculator Page

//Foam Calculator

<!-- Begin
function foamCalculation(form) {
				
var FoamWidth = form.txtFoamWidth.value
var FoamDepth = form.txtFoamDepth.value
var FoamLength = form.txtFoamLength.value	

if (FoamWidth=="")
{}
else if (FoamDepth=="")
{}
else if (FoamLength=="")
{}
else
{
	//FoamOutcome equals FoamWidth x FoamDepth x FoamLength
	form.txtFoamOutcome.value = FoamWidth*FoamDepth*FoamLength;
	
	//FoamINeedFrom equals FoamOutcome /(0.75*40*1000) then rounds to nearest number
	var FoamINeedFrom = (form.txtFoamOutcome.value/(0.75*40*1000));
	form.txtFoamINeedFrom.value = Math.round(FoamINeedFrom*100)/100;
	
	//txtFoamINeedTo equals FoamOutcome /(0.75*35*1000) then rounds to nearest number
	var FoamINeedTo = (form.txtFoamOutcome.value/(0.75*35*1000));
	form.txtFoamINeedTo.value = Math.round(FoamINeedTo*100)/100;
}

}
// End Foam Calculator-->

//******************************************************************************//

// Sealant Indicator

<!-- Begin
function round(number,X) {
// rounds number to X decimal places, defaults to 2
    X = (!X ? 2 : X);
    return Math.round(number*Math.pow(10,X))/Math.pow(10,X);
}

function do_calc(form) {
a=eval(form.width.value)
b=eval(form.depth.value)

if (form.width.value > null) {
	if (form.depth.value > null) {
		c1=310/(a * b)
		c=round(c1,2)
		form.catridge.value = c
		d1=600/(a * b)
		d=round(d1,2)
		form.foilbag.value=d
	}
}

}
// End Sealant Indicator -->