// WallCalc.js
//
// JavaScript file

/* This file should be used in conjunction with WallCalcLib.js.
   The corresponding library file includes the following functions:

   function needPainting() 
	this function checks if customer needs a paint job.

   function ourPaint() 
	this function checks if we need to supply the paint.

   function getSqfeet(i) 
	this function returns the square feet that need painting. 

   function needSheetrock() 
	this function checks if customer needs minor sheetrock repair.

   function depaperRoom(i) 
	this function checks if customer needs this room to be 
        dewallpapered.

   function halfWall() 
	this function checks if dining is half or full wallpaper.

   function getBathrooms(i)
	this function returns how many bathrooms need dewallpapering.

   function putPainttotal(amount) 
	this function enters total in subtotal text field.
*/
function calcPaintTotal() {
	var total = 0;
        var painttotal;

    	if (needPainting()) {
	   if (ourPaint()) {
	       total = total + .16*getSqfeet(4);
           } else {
               total = total + .12*getSqfeet(4);
             }
        }
	if (needSheetrock()) {
           total = total + 15*getSqfeet(7);
        }
	if (needResurfacing()) {
	   total = total + 65;
	}
	if (depaperRoom(10)) {
	   total = total + 74.95;
	}
	if (depaperRoom(11)) {
           if (halfWall()) {
               total = total + 41.95;
           } else {
	       total = total + 41.95*2;
             }
	}
	if (depaperRoom(14)) {
	       total = total + 41.95*getBathrooms(15);
	}
	putPainttotal(total);
}