﻿function calculate(){
 	var doc = document.Calc;
	var gal = 0;
 	var SqFt = doc.sf.value;
    var thick= doc.thickness.value;
    var galvol=231;
    var sfinches = 144;
	var volneeded=" ";
	var WarnSF= "Please enter SF as Number.";
	var WarnThick="Please enter decimal Thickness";
	var WarnBoth="Please enter SF & Thickness";
	doc.warning.value= " ";
	doc.comment.value= " ";

	//error check
	if (isNaN(SqFt) == true){ // check to see if SF is a number
		doc.warning.value = WarnSF;  // if NaN send a warning
		} 
	if (isNaN(thick) == true) { //check to see if a thickness was entered
		doc.warning.value = WarnThick; //warn is NaN
		}
	 if (isNaN(SqFt)+isNaN(thick) == 2){
		doc.warning.value= WarnBoth;
		}

	volneeded  = ((SqFt * sfinches) * thick);
	gal = (volneeded/galvol);
 	var galround = (Math.round(gal*1000)/1000);
 //	alert(galround);
	doc.result.value = galround;
 	if (thick < .0625){
	 	alert("CAUTION:Your thickness is < 1/16 inch. You may want to consider one of our other products. Call Epoxy.com Technical Support for assistance.");	
	 	}
 
 	if (thick > .5) {
	 	
	 	alert("Caution: Your thickness is over 1/2 inch.  You will want to pour in 3/8 to 1/2 inch lifts. Call Epoxy.com Technical Support with your questions");
	 	}
	
}

