
      //initialize
      var idepth
      var ithickness
      var iwidth
      var ilength = 1; ilength <= 3; ilength       
      var icubicyards
      function calculateSlabPour()
      {
        //starting values
        ithickness = document.SlabCalculator.Thickness.value
        iwidth = document.SlabCalculator.Width.value;
        ilength = document.SlabCalculator.Length.value; 
        icubicyards = "";
        
        //assume the worst
        var isGood = false;
        
        //check correct user entry
        isGood = isNumber('slab');
        
        if (isGood)
        {
           //massage floating point values                                                               
           ithickness = ithickness / 12;
		
		   icubicyards = floatFix(ithickness * iwidth * ilength / 27, 2);
		
		   //assign
           document.SlabCalculator.CubicYards.value = icubicyards;
		 }
	   }
       
      function calculateFootingPour()
      {
        //starting values
        idepth = document.FootingCalculator.Depth.value;
        iwidth = document.FootingCalculator.Width.value;
        ilength = document.FootingCalculator.Length.value; 
        icubicyards = "";
        
        //assume the worst
        var isGood = false;
        
        //check correct user entry
        isGood = isNumber('footing');
        
        if (isGood)
        {
           //massage floating point values                                                               
           idepth = floatFix(idepth / 12, 2);
           iwidth = floatFix(iwidth / 12, 2);
		   icubicyards = floatFix(((iwidth * idepth) * ilength) / 27, 2);
		
		   //assign
           document.FootingCalculator.CubicYards.value = icubicyards;
		 }
	   }
       
       function isNumber(theForm)
       {
		 if (theForm == 'slab')
		 {
		   if ((isNaN(ithickness) == true) || (ithickness == ''))
		   {
		     alert ("Please enter a number value in inches for the thickness.");
		     document.SlabCalculator.Thickness.value = '';
		     document.SlabCalculator.Thickness.focus();
		     return false;
		   }
		 } else {
		   if ((isNaN(idepth) == true) || (idepth == ''))
		   {
		     alert ("Please enter a number value in inches for the depth.");
		     document.FootingCalculator.Depth.value = '';
		     document.FootingCalculator.Depth.focus();
		     return false;
		   }
		 }
		 
		 if ((isNaN(iwidth) == true) || (iwidth == ''))
		 {
		   if (theForm == 'slab')
		   {
		     alert ("Please enter a number value in feet for the width.");
		     document.SlabCalculator.Width.value = '';
		     document.SlabCalculator.Width.focus();
		   } else {
		     alert ("Please enter a number value in inches for the width.");
		     document.FootingCalculator.Width.value = '';
		     document.FootingCalculator.Width.focus();
		   }
		   return false;
		 }
		 
		 if ((isNaN(ilength) == true) || (ilength == ''))
		 {
		   if (theForm == 'slab')
		   {
		     alert ("Please enter a number value in feet for the length.");
		     document.SlabCalculator.Length.value = '';
		     document.SlabCalculator.Length.focus();
		   } else {
		     alert ("Please enter a number value in feet for the length.");
		     document.FootingCalculator.Length.value = '';
		     document.FootingCalculator.Length.focus();
		   }
		   return false;
		 }
		 return true;
	   }
	   
       function floatFix(value, places)
       {
	
           outstring = Math.round(value*100)/100  
         return (outstring);
       }
