
<!--	// hiding

//check email data
function checkit(){
	var validity = true;
	if (document.estimate.name_first.value == ""){
		alert('Please enter your first name.');
		document.estimate.name_first.focus();
		validity = false;
	} else if (document.estimate.name_last.value == ""){
		alert('Please enter your last name.');
		document.estimate.name_last.focus();
		validity = false;
	} else if (document.estimate.address.value == ""){
		alert('Please enter your address.');
		document.estimate.address.focus();
		validity = false;
	 } else if (document.estimate.city.value == ""){
		alert('Please enter your city.');
		document.estimate.city.focus();
		validity = false;
	 } else if (document.estimate.state.value == ""){
		alert('Please enter your state.');
		document.estimate.state.focus();
		validity = false;
	 } else if (document.estimate.zip.value == ""){
		alert('Please enter your Zip Code.');
		document.estimate.zip.focus();
		validity = false;
	 } else if (document.estimate.email.value == ""){
		alert('Please enter your email address.');
		document.estimate.email.focus();
		validity = false;
	 } else if (document.estimate.vemail.value == ""){
		alert('Please enter your email verification address.');
		document.estimate.vemail.focus();
		validity = false;
	 } else if (document.estimate.email.value != document.estimate.vemail.value){
		alert('Your email address and verification do not match!');
		document.estimate.email.focus();
		validity = false;
	 } else if (document.estimate.dphone.value == ""){
		alert('Please enter your day time phone.');
		document.estimate.dphone.focus();
		validity = false;	
	}
	if (validity) {
		document.estimate.prog_com.value = "estimate";
		document.estimate.submit();
	}
}

function verify_estimate(){
	document.estimate.subtype.value = "Estimate";
	checkit();
}

function purchase_estimate(){
	document.estimate.subtype.value = "Purchase";
	checkit();
}

function print_estimate(){
	document.estimate.prog_com.value = "printit";
	document.estimate.submit();
}

function newbuilding(){
	if (document.estimate.building.value == "Custom"){
		newprice1();
	} else if (document.estimate.building.value == "Single Carport"){
		document.estimate.gauge.value = "12";
		document.estimate.width.value = "18";
		document.estimate.length.value = "21";
		document.estimate.leg_height.value = "8";
		document.estimate.style.value = "standard";
		document.estimate.gable_front.value = "yes";
		document.estimate.gable_back.value = "yes";
		document.estimate.bayleft.value = "0";
		document.estimate.sheet_36.value = "0";
		document.estimate.sheet_41.value = "0";
		document.estimate.close_right.value = "no";
		document.estimate.close_left.value = "no";
		document.estimate.close_front.value = "no";
		document.estimate.close_back.value = "no";
		document.estimate.wdoor.value = "0"
		document.estimate.window.value = "0"
		document.estimate.gdoor_10x10.value = "0"
		newprice1();
	} else if (document.estimate.building.value == "Multiple Carports"){
		document.estimate.gauge.value = "12";
		document.estimate.width.value = "18";
		document.estimate.length.value = "36";
		document.estimate.leg_height.value = "8";
		document.estimate.style.value = "A-Frame";
		document.estimate.gable_front.value = "yes";
		document.estimate.gable_back.value = "yes";
		document.estimate.bayleft.value = "3";
		document.estimate.sheet_36.value = "2";
		document.estimate.sheet_41.value = "0";
		document.estimate.close_right.value = "no";
		document.estimate.close_left.value = "no";
		document.estimate.close_front.value = "no";
		document.estimate.close_back.value = "no";
		document.estimate.wdoor.value = "0"
		document.estimate.window.value = "0"
		document.estimate.gdoor_10x10.value = "0"
		newprice1();
	} else if (document.estimate.building.value == "RV Cover"){
		document.estimate.gauge.value = "12";
		document.estimate.width.value = "12";
		document.estimate.length.value = "41";
		document.estimate.leg_height.value = "12";
		document.estimate.style.value = "standard";
		document.estimate.gable_front.value = "yes";
		document.estimate.gable_back.value = "yes";
		document.estimate.bayleft.value = "0";
		document.estimate.sheet_36.value = "0";
		document.estimate.sheet_41.value = "0";
		document.estimate.close_right.value = "no";
		document.estimate.close_left.value = "no";
		document.estimate.close_front.value = "no";
		document.estimate.close_back.value = "no";
		document.estimate.wdoor.value = "0"
		document.estimate.window.value = "0"
		document.estimate.gdoor_10x10.value = "0"
		newprice1();
	} else if (document.estimate.building.value == "Garage"){
		document.estimate.gauge.value = "12";
		document.estimate.width.value = "28";
		document.estimate.length.value = "31";
		document.estimate.leg_height.value = "12";
		document.estimate.style.value = "standard";
		document.estimate.gable_front.value = "no";
		document.estimate.gable_back.value = "no";
		document.estimate.bayleft.value = "0";
		document.estimate.sheet_36.value = "0";
		document.estimate.sheet_41.value = "0";
		document.estimate.close_right.value = "yes";
		document.estimate.close_left.value = "yes";
		document.estimate.close_front.value = "yes";
		document.estimate.close_back.value = "yes";
		document.estimate.wdoor.value = "1"
		document.estimate.window.value = "1"
		document.estimate.gdoor_10x10.value = "2"
		newprice1();
	}
}

function newprice(){
	//temporary
	document.estimate.direct_price.value = "";
	newprice1();
	newprice1();
	newprice1();
}

function newprice1(){
	if (document.estimate.est_num.value == ""){
		rquote();
	}
	var bprice = 0;
	document.estimate.entry_error.value = "";
	if (document.estimate.style.value == "standard"){		//standard = round

			if (document.estimate.gauge.value == "14"){
				//gauge = 14
				if (document.estimate.width.value == 12){
					if (document.estimate.length.value == 21 || document.estimate.length.value == 20){
						bprice = bprice + 795;
					} else if (document.estimate.length.value == 26 || document.estimate.length.value == 25){
						bprice = bprice + 1095;
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 1295;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 1595;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 40){
						bprice = bprice + 1895;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require minimum width of 26 ft and 12 gauge! - Changing to this.');
						document.estimate.width.value = "26";
						document.estimate.gauge.value = "12";
					}
				} else if (document.estimate.width.value <= 18 && document.estimate.width.value >= 13){
					if (document.estimate.length.value == 21 || document.estimate.length.value == 20){
						bprice = bprice + 1095;
					} else if (document.estimate.length.value == 26 || document.estimate.length.value == 25){
						bprice = bprice + 1395;
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 1695;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 1995;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 40){
						bprice = bprice + 2195;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require minimum width of 26 ft and 12 gauge! - Changing to this.');
						document.estimate.width.value = "26";
						document.estimate.gauge.value = "12";
					}
				} else if (document.estimate.width.value == 20 || document.estimate.width.value == 19){
					if (document.estimate.length.value == 21 || document.estimate.length.value == 20){
						bprice = bprice + 1295;
					} else if (document.estimate.length.value == 26 || document.estimate.length.value == 25){
						bprice = bprice + 1595;
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 1895;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 2195;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 40){
						bprice = bprice + 2595;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require minimum width of 26 ft and 12 gauge! - Changing to this.');
						document.estimate.width.value = "26";
						document.estimate.gauge.value = "12";
					}
				} else if (document.estimate.width.value == 22 || document.estimate.width.value == 21){
					if (document.estimate.length.value == 21 || document.estimate.length.value == 20){
						bprice = bprice + 1495;
					} else if (document.estimate.length.value == 26 || document.estimate.length.value == 25){
						bprice = bprice + 1795;
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 2195;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 2595;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 40){
						bprice = bprice + 2995;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require minimum width of 26 ft and 12 gauge! - Changing to this.');
						document.estimate.width.value = "26";
						document.estimate.gauge.value = "12";
					}
				} else if (document.estimate.width.value == 24 || document.estimate.width.value == 23){
					if (document.estimate.length.value == 21 || document.estimate.length.value == 20){
						bprice = bprice + 1695;
					} else if (document.estimate.length.value == 26 || document.estimate.length.value == 25){
						bprice = bprice + 2095;
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 2595;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 2995;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 40){
						bprice = bprice + 3395;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require minimum width of 26 ft and 12 gauge! - Changing to this.');
						document.estimate.width.value = "26";
						document.estimate.gauge.value = "12";
					}

				} else if (document.estimate.width.value >= 25){
						alert('Widths above 24 feet require 12 gauge! - Changing to 12 qauge.');
						document.estimate.gauge.value = "12";
				}
			} else {
				//gauge = 12
				if (document.estimate.width.value == 12){
					if (document.estimate.length.value == 21 || document.estimate.length.value == 20){
						bprice = bprice + 1095;
					} else if (document.estimate.length.value == 26 || document.estimate.length.value == 25){
						bprice= bprice + 1395;
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 1595;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 1895;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 40){
						bprice = bprice + 2295;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require a minimum width of 26 ft! - Changing to this.');
						document.estimate.width.value = "26";
					}
				} else if (document.estimate.width.value <= 18 && document.estimate.width.value >= 13){
					if (document.estimate.length.value == 21 || document.estimate.length.value == 20){
						bprice = bprice + 1295;
					} else if (document.estimate.length.value == 26 || document.estimate.length.value == 25){
						bprice = bprice + 1595;
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 1995;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 2395;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 40){
						bprice = bprice + 2595;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require a minimum width of 26 ft! - Changing to this.');
						document.estimate.width.value = "26";
					}
				} else if (document.estimate.width.value == 20 || document.estimate.width.value == 19){
					if (document.estimate.length.value == 21 || document.estimate.length.value == 20){
						bprice = bprice + 1495;
					} else if (document.estimate.length.value == 26 || document.estimate.length.value == 25){
						bprice = bprice + 1895;
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 2195;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 2495;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 40){
						bprice = bprice + 2895;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require a minimum width of 26 ft! - Changing to this.');
						document.estimate.width.value = "26";
					}
				} else if (document.estimate.width.value == 22 || document.estimate.width.value == 21){
					if (document.estimate.length.value == 21 || document.estimate.length.value == 20){
						bprice = bprice + 1695;
					} else if (document.estimate.length.value == 26 || document.estimate.length.value == 25){
						bprice = bprice + 2095;
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 2495;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 2895;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 40){
						bprice = bprice + 3395;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require a minimum width of 26 ft! - Changing to this.');
						document.estimate.width.value = "26";
					}
				} else if (document.estimate.width.value == 24 || document.estimate.width.value == 23){
					if (document.estimate.length.value == 21 || document.estimate.length.value == 20){
						bprice = bprice + 1895;
					} else if (document.estimate.length.value == 26 || document.estimate.length.value == 25){
						bprice = bprice + 2395;
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 2895;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 3295;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 40){
						bprice = bprice + 3795;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require a minimum width of 26 ft! - Changing to this.');
						document.estimate.width.value = "26";
					}
				} else if (document.estimate.width.value == 26 || document.estimate.width.value == 25){
					if (document.estimate.length.value < 31){
						alert('Widths above 24 ft require a length at least 31 ft - changing length to 31 ft');
						document.estimate.length.value = "31";
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 3695;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 4205;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 41){
						bprice = bprice + 4720;
					} else if (document.estimate.length.value == 46 || document.estimate.length.value == 45){
						bprice = bprice + 5230;
					} else if (document.estimate.length.value == 51 || document.estimate.length.value == 50){
						bprice = bprice + 5740;
					}
				} else if (document.estimate.width.value == 28 || document.estimate.width.value == 27){
					if (document.estimate.length.value < 31){
						alert('Widths above 24 ft require a length at least 31 ft - changing length to 31 ft');
						document.estimate.length.value = "31";
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 3895;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 4440;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 40){
						bprice = bprice + 4985;
					} else if (document.estimate.length.value == 46 || document.estimate.length.value == 45){
						bprice = bprice + 5530;
					} else if (document.estimate.length.value == 51 || document.estimate.length.value == 50){
						bprice = bprice + 6070;
					}
				} else if (document.estimate.width.value == 30 || document.estimate.width.value == 20){
					if (document.estimate.length.value < 31){
						alert('Widths above 24 ft require a length at least 31 ft - changing length to 31 ft');
						document.estimate.length.value = "31";
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 4095;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 4675;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 40){
						bprice = bprice + 5250;
					} else if (document.estimate.length.value == 46 || document.estimate.length.value == 45){
						bprice = bprice + 5825;
					} else if (document.estimate.length.value == 51 || document.estimate.length.value == 50){
						bprice = bprice + 6405;
					}
				}
		}
	} else if (document.estimate.style.value == "vertical"){

			if (document.estimate.gauge.value == "14"){
				//gauge = 14
				if (document.estimate.width.value == 12){
					if (document.estimate.length.value == 20 || document.estimate.length.value == 21){
						bprice = bprice + 1245;
					} else if (document.estimate.length.value == 25 || document.estimate.length.value == 26){
						bprice = bprice + 1495;
					} else if (document.estimate.length.value == 30 || document.estimate.length.value == 31){
						bprice = bprice + 1745;
					} else if (document.estimate.length.value == 35 || document.estimate.length.value == 36){
						bprice = bprice + 2225;
					} else if (document.estimate.length.value == 40 || document.estimate.length.value == 41){
						bprice = bprice + 2595;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require minimum width of 26 ft and 12 gauge! - Changing to this.');
						document.estimate.width.value = "26";
						document.estimate.gauge.value = "12";
					}
				} else if (document.estimate.width.value <= 18 && document.estimate.width.value >= 13){
					if (document.estimate.length.value == 20 || document.estimate.length.value == 21){
						bprice = bprice + 1495;
					} else if (document.estimate.length.value == 25 || document.estimate.length.value == 26){
						bprice= bprice + 1875;
					} else if (document.estimate.length.value == 30 || document.estimate.length.value == 31){
						bprice = bprice + 2245;
					} else if (document.estimate.length.value == 35 || document.estimate.length.value == 36){
						bprice = bprice + 2625;
					} else if (document.estimate.length.value == 40 || document.estimate.length.value == 41){
						bprice = bprice + 3095;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require minimum width of 26 ft and 12 gauge! - Changing to this.');
						document.estimate.width.value = "26";
						document.estimate.gauge.value = "12";
					}
				} else if (document.estimate.width.value == 20 || document.estimate.width.value == 19){
					if (document.estimate.length.value == 20 || document.estimate.length.value == 21){
						bprice = bprice + 1745;
					} else if (document.estimate.length.value == 25 || document.estimate.length.value == 26){
						bprice = bprice + 2125;
					} else if (document.estimate.length.value == 30 || document.estimate.length.value == 31){
						bprice = bprice + 2495;
					} else if (document.estimate.length.value == 35 || document.estimate.length.value == 36){
						bprice = bprice + 2875;
					} else if (document.estimate.length.value == 40 || document.estimate.length.value == 41){
						bprice = bprice + 3595;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require minimum width of 26 ft and 12 gauge! - Changing to this.');
						document.estimate.width.value = "26";
						document.estimate.gauge.value = "12";
					}
				} else if (document.estimate.width.value == 22 || document.estimate.width.value == 21){
					if (document.estimate.length.value == 20 || document.estimate.length.value == 21){
						bprice = bprice + 1995;
					} else if (document.estimate.length.value == 25 || document.estimate.length.value == 26){
						bprice = bprice + 2395;
					} else if (document.estimate.length.value == 30 || document.estimate.length.value == 31){
						bprice = bprice + 2895;
					} else if (document.estimate.length.value == 35 || document.estimate.length.value == 36){
						bprice = bprice + 3375;
					} else if (document.estimate.length.value == 40 || document.estimate.length.value == 41){
						bprice = bprice + 4095;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require minimum width of 26 ft and 12 gauge! - Changing to this.');
						document.estimate.width.value = "26";
						document.estimate.gauge.value = "12";
					}
				} else if (document.estimate.width.value == 24 || document.estimate.width.value == 23){
					if (document.estimate.length.value == 20 || document.estimate.length.value == 21){
						bprice = bprice + 2245;
					} else if (document.estimate.length.value == 25 || document.estimate.length.value == 26){
						bprice = bprice + 2745;
					} else if (document.estimate.length.value == 30 || document.estimate.length.value == 31){
						bprice = bprice + 3375;
					} else if (document.estimate.length.value == 35 || document.estimate.length.value == 36){
						bprice = bprice + 3995;
					} else if (document.estimate.length.value == 40 || document.estimate.length.value == 41){
						bprice = bprice + 4595;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require minimum width of 26 ft and 12 gauge! - Changing to this.');
						document.estimate.width.value = "26";
						document.estimate.gauge.value = "12";
					}
				} else if (document.estimate.width.value >= 25){
						alert('Widths above 24 feet require 12 gauge! - Changing to 12 qauge.');
						document.estimate.gauge.value = "12";
				}
			} else {
				//gauge = 12
				if (document.estimate.width.value == 12){
					if (document.estimate.length.value == 20 || document.estimate.length.value == 21){
						bprice = bprice + 1495;
					} else if (document.estimate.length.value == 25 || document.estimate.length.value == 26){
						bprice = bprice + 1745;
					} else if (document.estimate.length.value == 30 || document.estimate.length.value == 31){
						bprice = bprice + 1995;
					} else if (document.estimate.length.value == 35 || document.estimate.length.value == 36){
						bprice = bprice + 2375;
					} else if (document.estimate.length.value == 40 || document.estimate.length.value == 41){
						bprice = bprice + 3095;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require a minimum width of 26 ft! - Changing to this.');
						document.estimate.width.value = "26";
					}
				} else if (document.estimate.width.value <= 18 && document.estimate.width.value >= 13){
					if (document.estimate.length.value == 20 || document.estimate.length.value == 21){
						bprice = bprice + 1745;
					} else if (document.estimate.length.value == 25 || document.estimate.length.value == 26){
						bprice = bprice + 2125;
					} else if (document.estimate.length.value == 30 || document.estimate.length.value == 31){
						bprice = bprice + 2495;
					} else if (document.estimate.length.value == 35 || document.estimate.length.value == 36){
						bprice = bprice + 3095;
					} else if (document.estimate.length.value == 40 || document.estimate.length.value == 41){
						bprice = bprice + 3595;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require a minimum width of 26 ft! - Changing to this.');
						document.estimate.width.value = "26";
					}
				} else if (document.estimate.width.value == 20 || document.estimate.width.value == 19){
					if (document.estimate.length.value == 20 || document.estimate.length.value == 21){
						bprice = bprice + 1995;
					} else if (document.estimate.length.value == 25 || document.estimate.length.value == 26){
						bprice = bprice + 2495;
					} else if (document.estimate.length.value == 30 || document.estimate.length.value == 31){
						bprice = bprice + 2895;
					} else if (document.estimate.length.value == 35 || document.estimate.length.value == 36){
						bprice = bprice + 3245;
					} else if (document.estimate.length.value == 40 || document.estimate.length.value == 41){
						bprice = bprice + 4095;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require a minimum width of 26 ft! - Changing to this.');
						document.estimate.width.value = "26";
					}
				} else if (document.estimate.width.value == 22 || document.estimate.width.value == 21){
					if (document.estimate.length.value == 20 || document.estimate.length.value == 21){
						bprice = bprice + 2245;
					} else if (document.estimate.length.value == 25 || document.estimate.length.value == 26){
						bprice = bprice + 2745;
					} else if (document.estimate.length.value == 30 || document.estimate.length.value == 31){
						bprice = bprice + 3245;
					} else if (document.estimate.length.value == 35 || document.estimate.length.value == 36){
						bprice = bprice + 3745;
					} else if (document.estimate.length.value == 40 || document.estimate.length.value == 41){
						bprice = bprice + 4595;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require a minimum width of 26 ft! - Changing to this.');
						document.estimate.width.value = "26";
					}
				} else if (document.estimate.width.value == 24 || document.estimate.width.value == 23){
					if (document.estimate.length.value == 20 || document.estimate.length.value == 21){
						bprice = bprice + 2495;
					} else if (document.estimate.length.value == 25 || document.estimate.length.value == 26){
						bprice = bprice + 3125;
					} else if (document.estimate.length.value == 30 || document.estimate.length.value == 31){
						bprice = bprice + 3745;
					} else if (document.estimate.length.value == 35 || document.estimate.length.value == 36){
						bprice = bprice + 4445;
					} else if (document.estimate.length.value == 40 || document.estimate.length.value == 41){
						bprice = bprice + 5095;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require a minimum width of 26 ft! - Changing to this.');
						document.estimate.width.value = "26";
					}
				} else if (document.estimate.width.value == 26 || document.estimate.width.value == 25){
					if (document.estimate.length.value < 30){
						alert('Widths above 24 ft require a length at least 30 ft - changing length to 30 ft');
						document.estimate.length.value = "30";
					} else if (document.estimate.length.value == 30 || document.estimate.length.value == 31){
						bprice = bprice + 4675;
					} else if (document.estimate.length.value == 35 || document.estimate.length.value == 36){
						bprice = bprice + 5295;
					} else if (document.estimate.length.value == 40 || document.estimate.length.value == 41){
						bprice = bprice + 5925;
					} else if (document.estimate.length.value == 45 || document.estimate.length.value == 46){
						bprice = bprice + 6520;
					} else if (document.estimate.length.value == 50 || document.estimate.length.value == 51){
						bprice = bprice + 7125;
					}
				} else if (document.estimate.width.value == 28 || document.estimate.width.value == 27){
					if (document.estimate.length.value < 30){
						alert('Widths above 24 ft require a length at least 30 ft - changing length to 30 ft');
						document.estimate.length.value = "30";
					} else if (document.estimate.length.value == 30 || document.estimate.length.value == 31){
						bprice = bprice + 4905;
					} else if (document.estimate.length.value == 35 || document.estimate.length.value == 36){
						bprice = bprice + 5565;
					} else if (document.estimate.length.value == 40 || document.estimate.length.value == 41){
						bprice = bprice + 6225;
					} else if (document.estimate.length.value == 45 || document.estimate.length.value == 46){
						bprice = bprice + 6875;
					} else if (document.estimate.length.value == 50 || document.estimate.length.value == 51){
						bprice = bprice + 7525;
					}
				} else if (document.estimate.width.value == 30 || document.estimate.width.value == 29){
					if (document.estimate.length.value < 30){
						alert('Widths above 24 ft require a length at least 30 ft - changing length to 30 ft');
						document.estimate.length.value = "30";
					} else if (document.estimate.length.value == 30 || document.estimate.length.value == 31){
						bprice = bprice + 5155;
					} else if (document.estimate.length.value == 35 || document.estimate.length.value == 36){
						bprice = bprice + 5850;
					} else if (document.estimate.length.value == 40 || document.estimate.length.value == 41){
						bprice = bprice + 6540;
					} else if (document.estimate.length.value == 45 || document.estimate.length.value == 46){
						bprice = bprice + 7230;
					} else if (document.estimate.length.value == 50 || document.estimate.length.value == 51){
						bprice = bprice + 7925;
					}
				}
			
			}
			
	} else {
		//Style = A-Frame or Leanto with no vertical roof

			if (document.estimate.gauge.value == "14"){
				//gauge = 14
				if (document.estimate.width.value == 12){
					if (document.estimate.length.value == 21 || document.estimate.length.value == 20){
						bprice = bprice + 895;
					} else if (document.estimate.length.value == 26 || document.estimate.length.value == 25){
						bprice = bprice + 1195;
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 1395;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 1695;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 40){
						bprice = bprice + 2195;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require minimum width of 26 ft and 12 gauge! - Changing to this.');
						document.estimate.width.value = "26";
						document.estimate.gauge.value = "12";
					}
				} else if (document.estimate.width.value <= 18 && document.estimate.width.value >=13){
					if (document.estimate.length.value == 21 || document.estimate.length.value == 20){
						bprice = bprice + 1195;
					} else if (document.estimate.length.value == 26 || document.estimate.length.value == 25){
						bprice = bprice + 1495;
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 1795;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 2095;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 40){
						bprice = bprice + 2495;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require minimum width of 26 ft and 12 gauge! - Changing to this.');
						document.estimate.width.value = "26";
						document.estimate.gauge.value = "12";
					}
				} else if (document.estimate.width.value == 20 || document.estimate.width.value == 19){
					if (document.estimate.length.value == 21 || document.estimate.length.value == 20){
						bprice = bprice + 1395;
					} else if (document.estimate.length.value == 26 || document.estimate.length.value == 25){
						bprice = bprice + 1695;
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 1995;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 2295;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 40){
						bprice = bprice + 2895;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require minimum width of 26 ft and 12 gauge! - Changing to this.');
						document.estimate.width.value = "26";
						document.estimate.gauge.value = "12";
					}
				} else if (document.estimate.width.value == 22 || document.estimate.width.value == 21){
					if (document.estimate.length.value == 21 || document.estimate.length.value == 20){
						bprice = bprice + 1595;
					} else if (document.estimate.length.value == 26 || document.estimate.length.value == 25){
						bprice = bprice + 1895;
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 2295;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 2695;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 40){
						bprice = bprice + 3295;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require minimum width of 26 ft and 12 gauge! - Changing to this.');
						document.estimate.width.value = "26";
						document.estimate.gauge.value = "12";
					}
				} else if (document.estimate.width.value == 24 || document.estimate.width.value == 23){
					if (document.estimate.length.value == 21 || document.estimate.length.value == 20){
						bprice = bprice + 1795;
					} else if (document.estimate.length.value == 26 || document.estimate.length.value == 25){
						bprice = bprice + 2195;
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 2695;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 3195;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 40){
						bprice = bprice + 3695;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require minimum width of 26 ft and 12 gauge! - Changing to this.');
						document.estimate.width.value = "26";
						document.estimate.gauge.value = "12";
					}
				} else if (document.estimate.width.value >= 25){
						alert('Widths above 24 feet require 12 gauge! - Changing to 12 qauge.');
						document.estimate.gauge.value = "12";
				}
			} else {
				//gauge = 12
				if (document.estimate.width.value == 12){
					if (document.estimate.length.value == 21 || document.estimate.length.value == 20){
						bprice = 1195;
					} else if (document.estimate.length.value == 26 || document.estimate.length.value == 25){
						bprice = bprice + 1595;
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 1795;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 1095;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 40){
						bprice = bprice + 2495;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require a minimum width of 26 ft! - Changing to this.');
						document.estimate.width.value = "26";
					}
				} else if (document.estimate.width.value <=18 && document.estimate.width.value >=13){
					if (document.estimate.length.value == 21 || document.estimate.length.value == 20){
						bprice = bprice + 1395;
					} else if (document.estimate.length.value == 26 || document.estimate.length.value == 25){
						bprice = bprice + 1695;
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 2195;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 2495;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 40){
						bprice = bprice + 2895;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require a minimum width of 26 ft! - Changing to this.');
						document.estimate.width.value = "26";
					}
				} else if (document.estimate.width.value == 20 || document.estimate.width.value == 19){
					if (document.estimate.length.value == 21 || document.estimate.length.value == 20){
						bprice = bprice + 1595;
					} else if (document.estimate.length.value == 26 || document.estimate.length.value == 25){
						bprice = bprice + 1995;
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 2295;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 2595;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 40){
						bprice = bprice + 3195;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require a minimum width of 26 ft! - Changing to this.');
						document.estimate.width.value = "26";
					}
				} else if (document.estimate.width.value == 22 || document.estimate.width.value == 21){
					if (document.estimate.length.value == 21 || document.estimate.length.value == 20){
						bprice = bprice + 1795;
					} else if (document.estimate.length.value == 26 || document.estimate.length.value == 25){
						bprice = bprice + 2195;
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 2595;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 2995;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 40){
						bprice = bprice + 3595;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require a minimum width of 26 ft! - Changing to this.');
						document.estimate.width.value = "26";
					}
				} else if (document.estimate.width.value == 24 || document.estimate.width.value == 23){
					if (document.estimate.length.value == 21 || document.estimate.length.value == 20){
						bprice = bprice + 1995;
					} else if (document.estimate.length.value == 26 || document.estimate.length.value == 25){
						bprice = bprice + 2495;
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 2995;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 3495;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 40){
						bprice = bprice + 3995;
					} else if (document.estimate.length.value >= 42){
						alert('Lengths above 41 feet require a minimum width of 26 ft! - Changing to this.');
						document.estimate.width.value = "26";
					}
				} else if (document.estimate.width.value == 26 || document.estimate.width.value == 25){
					if (document.estimate.length.value < 30){
						alert('Widths above 24 ft require a length at least 30 ft - changing length to 30 ft');
						document.estimate.length.value = "30";
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 3895;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 4405;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 40){
						bprice = bprice + 4920;
					} else if (document.estimate.length.value == 46 || document.estimate.length.value == 45){
						bprice = bprice + 5430;
					} else if (document.estimate.length.value == 51 || document.estimate.length.value == 50){
						bprice = bprice + 5940;
					}
				} else if (document.estimate.width.value == 28 || document.estimate.width.value == 27){
					if (document.estimate.length.value < 30){
						alert('Widths above 24 ft require a length at least 30 ft - changing length to 30 ft');
						document.estimate.length.value = "30";
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 4095;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 4640;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 40){
						bprice = bprice + 5185;
					} else if (document.estimate.length.value == 46 || document.estimate.length.value == 45){
						bprice = bprice + 5730;
					} else if (document.estimate.length.value == 51 || document.estimate.length.value == 50){
						bprice = bprice + 6270;
					}
				} else if (document.estimate.width.value == 30){
					if (document.estimate.length.value < 30){
						alert('Widths above 24 ft require a length at least 30 ft - changing length to 30 ft');
						document.estimate.length.value = "30";
					} else if (document.estimate.length.value == 31 || document.estimate.length.value == 30){
						bprice = bprice + 4295;
					} else if (document.estimate.length.value == 36 || document.estimate.length.value == 35){
						bprice = bprice + 4875;
					} else if (document.estimate.length.value == 41 || document.estimate.length.value == 40){
						bprice = bprice + 5450;
					} else if (document.estimate.length.value == 46 || document.estimate.length.value == 45){
						bprice = bprice + 6025;
					} else if (document.estimate.length.value == 51 || document.estimate.length.value == 50){
						bprice = bprice + 6605;
					}
				}
			}

	}

	//calculate for leg heigth

	var ladd = 0;		
	if (document.estimate.width.value <= 24){
		//leg costs are same for all types of units
			if ((document.estimate.length.value == 20) || (document.estimate.length.value == 21)){		
				if (document.estimate.leg_height.value == 6){
						ladd = 0;
				} else if (document.estimate.leg_height.value == 7){
						ladd = 60;
				} else if (document.estimate.leg_height.value == 8){
						ladd = 120;
				} else if (document.estimate.leg_height.value == 9){
						ladd = 180;
				} else if (document.estimate.leg_height.value == 10){
						ladd = 240;
				} else if (document.estimate.leg_height.value == 11){
						ladd = 300;
				} else if (document.estimate.leg_height.value == 12){
						ladd = 3600;
				}
			} else if ((document.estimate.length.value == 25) || (document.estimate.length.value == 26)){		
				if (document.estimate.leg_height.value == 6){
						ladd = 0;
				} else if (document.estimate.leg_height.value == 7){
						ladd = 70;
				} else if (document.estimate.leg_height.value == 8){
						ladd = 140;
				} else if (document.estimate.leg_height.value == 9){
						ladd = 210;
				} else if (document.estimate.leg_height.value == 10){
						ladd = 280;
				} else if (document.estimate.leg_height.value == 11){
						ladd = 350;
				} else if (document.estimate.leg_height.value == 12){
						ladd = 420;
				}
			} else if ((document.estimate.length.value == 30) || (document.estimate.length.value == 31)){		
				if (document.estimate.leg_height.value == 6){
						ladd = 0;
				} else if (document.estimate.leg_height.value == 7){
						ladd = 80;
				} else if (document.estimate.leg_height.value == 8){
						ladd = 160;
				} else if (document.estimate.leg_height.value == 9){
						ladd = 240;
				} else if (document.estimate.leg_height.value == 10){
						ladd = 320;
				} else if (document.estimate.leg_height.value == 11){
						ladd = 400;
				} else if (document.estimate.leg_height.value == 12){
						ladd = 480;
				}
			} else if ((document.estimate.length.value == 35) || (document.estimate.length.value == 36)){		
				if (document.estimate.leg_height.value == 6){
						ladd = 0;
				} else if (document.estimate.leg_height.value == 7){
						ladd = 90;
				} else if (document.estimate.leg_height.value == 8){
						ladd = 180;
				} else if (document.estimate.leg_height.value == 9){
						ladd = 270;
				} else if (document.estimate.leg_height.value == 10){
						ladd = 360;
				} else if (document.estimate.leg_height.value == 11){
						ladd = 450;
				} else if (document.estimate.leg_height.value == 12){
						ladd = 540;
				}
			} else if ((document.estimate.length.value == 40) || (document.estimate.length.value == 41)){		
				if (document.estimate.leg_height.value == 6){
						ladd = 0;
				} else if (document.estimate.leg_height.value == 7){
						ladd = 120;
				} else if (document.estimate.leg_height.value == 8){
						ladd = 240;
				} else if (document.estimate.leg_height.value == 9){
						ladd = 360;
				} else if (document.estimate.leg_height.value == 10){
						ladd = 480;
				} else if (document.estimate.leg_height.value == 11){
						ladd = 600;
				} else if (document.estimate.leg_height.value == 12){
						ladd = 720;
				}
			}
	} else {
		//Width is 26 ft or more
		if ((document.estimate.length.value == 30) || (document.estimate.length.value == 31)){	
			if (document.estimate.leg_height.value == 6){
					ladd = 0;
			} else if (document.estimate.leg_height.value == 7){
					ladd = 230;
			} else if (document.estimate.leg_height.value == 8){
					ladd = 360;
			} else if (document.estimate.leg_height.value == 9){
					ladd = 490;
			} else if (document.estimate.leg_height.value == 10){
					ladd = 620;
			} else if (document.estimate.leg_height.value == 11){
					ladd = 750;
			} else if (document.estimate.leg_height.value == 12){
					ladd = 880;
			}
		} else if ((document.estimate.length.value == 35) || (document.estimate.length.value == 36)){		
			if (document.estimate.leg_height.value == 6){
					ladd = 0;
			} else if (document.estimate.leg_height.value == 7){
					ladd = 255;
			} else if (document.estimate.leg_height.value == 8){
					ladd = 405;
			} else if (document.estimate.leg_height.value == 9){
					ladd = 555;
			} else if (document.estimate.leg_height.value == 10){
					ladd = 705;
			} else if (document.estimate.leg_height.value == 11){
					ladd = 855;
			} else if (document.estimate.leg_height.value == 12){
					ladd = 1005;
			}
		} else if ((document.estimate.length.value == 40) || (document.estimate.length.value == 41)){		
			if (document.estimate.leg_height.value == 6){
					ladd = 0;
			} else if (document.estimate.leg_height.value == 7){
					ladd = 275;
			} else if (document.estimate.leg_height.value == 8){
					ladd = 450;
			} else if (document.estimate.leg_height.value == 9){
					ladd = 620;
			} else if (document.estimate.leg_height.value == 10){
					ladd = 795;
			} else if (document.estimate.leg_height.value == 11){
					ladd = 970;
			} else if (document.estimate.leg_height.value == 12){
					ladd = 1145;
			}
		} else if ((document.estimate.length.value == 45) || (document.estimate.length.value == 46)){		
			if (document.estimate.leg_height.value == 6){
					ladd = 0;
			} else if (document.estimate.leg_height.value == 7){
					ladd = 295;
			} else if (document.estimate.leg_height.value == 8){
					ladd = 490;
			} else if (document.estimate.leg_height.value == 9){
					ladd = 685;
			} else if (document.estimate.leg_height.value == 10){
					ladd = 880;
			} else if (document.estimate.leg_height.value == 11){
					ladd = 1075;
			} else if (document.estimate.leg_height.value == 12){
					ladd = 1270;
			}
		} else if ((document.estimate.length.value == 50) || (document.estimate.length.value == 51)){		
			if (document.estimate.leg_height.value == 6){
					ladd = 0;
			} else if (document.estimate.leg_height.value == 7){
					ladd = 315;
			} else if (document.estimate.leg_height.value == 8){
					ladd = 535;
			} else if (document.estimate.leg_height.value == 9){
					ladd = 750;
			} else if (document.estimate.leg_height.value == 10){
					ladd = 965;
			} else if (document.estimate.leg_height.value == 11){
					ladd = 1180;
			} else if (document.estimate.leg_height.value == 12){
					ladd = 1395;
			}					
		}
	}
	var newnum = bprice + ladd;
	document.estimate.baseprice.value = fix(newnum);

	//calculate close sides option
	var sideadd = 0;
	//calculate side add
	if (document.estimate.width.value <= 24){
		if ((document.estimate.length.value == 20) || (document.estimate.length.value == 21)){
			if ((document.estimate.leg_height.value == 6) || (document.estimate.leg_height.value == 5)){
				sideadd = 375;
			} else if (document.estimate.leg_height.value == 7){
				sideadd = 465;
			} else if (document.estimate.leg_height.value == 8){
				sideadd = 555;
			} else if (document.estimate.leg_height.value == 9){
				sideadd = 555;
			} else if (document.estimate.leg_height.value == 10){
				sideadd = 645;
			} else if (document.estimate.leg_height.value == 11){
				sideadd = 750;
			} else if (document.estimate.leg_height.value == 12){
				sideadd = 750;
			}
		} else if ((document.estimate.length.value == 25) || (document.estimate.length.value == 26)){
			if ((document.estimate.leg_height.value == 6) || (document.estimate.leg_height.value == 5)){
				sideadd = 460;
			} else if (document.estimate.leg_height.value == 7){
				sideadd = 570;
			} else if (document.estimate.leg_height.value == 8){
				sideadd = 680;
			} else if (document.estimate.leg_height.value == 9){
				sideadd = 680;
			} else if (document.estimate.leg_height.value == 10){
				sideadd = 790;
			} else if (document.estimate.leg_height.value == 11){
				sideadd = 920;
			} else if (document.estimate.leg_height.value == 12){
				sideadd = 920;
			}
		} else if ((document.estimate.length.value == 30) || (document.estimate.length.value == 31)){
			if ((document.estimate.leg_height.value == 6) || (document.estimate.leg_height.value == 5)){
				sideadd = 560;
			} else if (document.estimate.leg_height.value == 7){
				sideadd = 720;
			} else if (document.estimate.leg_height.value == 8){
				sideadd = 850;
			} else if (document.estimate.leg_height.value == 9){
				sideadd = 850;
			} else if (document.estimate.leg_height.value == 10){
				sideadd = 980;
			} else if (document.estimate.leg_height.value == 11){
				sideadd = 1110;
			} else if (document.estimate.leg_height.value == 12){
				sideadd = 1110;
			}
		} else if ((document.estimate.length.value == 35) || (document.estimate.length.value == 36)){
			if ((document.estimate.leg_height.value == 6) || (document.estimate.leg_height.value == 5)){
				sideadd = 615;
			} else if (document.estimate.leg_height.value == 7){
				sideadd = 765;
			} else if (document.estimate.leg_height.value == 8){
				sideadd = 915;
			} else if (document.estimate.leg_height.value == 9){
				sideadd = 915;
			} else if (document.estimate.leg_height.value == 10){
				sideadd = 1065;
			} else if (document.estimate.leg_height.value == 11){
				sideadd = 1230;
			} else if (document.estimate.leg_height.value == 12){
				sideadd = 1230;
			}
		} else if ((document.estimate.length.value == 40) || (document.estimate.length.value == 41)){
			if ((document.estimate.leg_height.value == 6) || (document.estimate.leg_height.value == 5)){
				sideadd = 750;
			} else if (document.estimate.leg_height.value == 7){
				sideadd = 930;
			} else if (document.estimate.leg_height.value == 8){
				sideadd = 1110;
			} else if (document.estimate.leg_height.value == 9){
				sideadd = 1110;
			} else if (document.estimate.leg_height.value == 10){
				sideadd = 1290;
			} else if (document.estimate.leg_height.value == 11){
				sideadd = 1500;
			} else if (document.estimate.leg_height.value == 12){
				sideadd = 1500;
			}
		}
	} else {
		//width > 24 ft
		if ((document.estimate.length.value == 30) || (document.estimate.length.value == 31)){
			if ((document.estimate.leg_height.value == 6) || (document.estimate.leg_height.value == 5)){
				sideadd = 580;
			} else if (document.estimate.leg_height.value == 7){
				sideadd = 700;
			} else if (document.estimate.leg_height.value == 8){
				sideadd = 820;
			} else if (document.estimate.leg_height.value == 9){
				sideadd = 820;
			} else if (document.estimate.leg_height.value == 10){
				sideadd = 940;
			} else if (document.estimate.leg_height.value == 11){
				sideadd = 1060;
			} else if (document.estimate.leg_height.value == 12){
				sideadd = 1180;
			}
		} else if ((document.estimate.length.value == 35) || (document.estimate.length.value == 36)){
			if ((document.estimate.leg_height.value == 6) || (document.estimate.leg_height.value == 5)){
				sideadd = 660;
			} else if (document.estimate.leg_height.value == 7){
				sideadd = 800;
			} else if (document.estimate.leg_height.value == 8){
				sideadd = 940;
			} else if (document.estimate.leg_height.value == 9){
				sideadd = 940;
			} else if (document.estimate.leg_height.value == 10){
				sideadd = 1080;
			} else if (document.estimate.leg_height.value == 11){
				sideadd = 1220;
			} else if (document.estimate.leg_height.value == 12){
				sideadd = 1360;
			}
		} else if ((document.estimate.length.value == 40) || (document.estimate.length.value == 41)){
			if ((document.estimate.leg_height.value == 6) || (document.estimate.leg_height.value == 5)){
				sideadd = 740;
			} else if (document.estimate.leg_height.value == 7){
				sideadd = 900;
			} else if (document.estimate.leg_height.value == 8){
				sideadd = 1060;
			} else if (document.estimate.leg_height.value == 9){
				sideadd = 1060;
			} else if (document.estimate.leg_height.value == 10){
				sideadd = 1220;
			} else if (document.estimate.leg_height.value == 11){
				sideadd = 1380;
			} else if (document.estimate.leg_height.value == 12){
				sideadd = 1540;
			}
		} else if ((document.estimate.length.value == 45) || (document.estimate.length.value == 46)){
			if ((document.estimate.leg_height.value == 6) || (document.estimate.leg_height.value == 5)){
				sideadd = 820;
			} else if (document.estimate.leg_height.value == 7){
				sideadd = 1000;
			} else if (document.estimate.leg_height.value == 8){
				sideadd = 1180;
			} else if (document.estimate.leg_height.value == 9){
				sideadd = 1180;
			} else if (document.estimate.leg_height.value == 10){
				sideadd = 1360;
			} else if (document.estimate.leg_height.value == 11){
				sideadd = 1540;
			} else if (document.estimate.leg_height.value == 12){
				sideadd = 1720;
			}
		} else if ((document.estimate.length.value == 50) || (document.estimate.length.value == 51)){
			if ((document.estimate.leg_height.value == 6) || (document.estimate.leg_height.value == 5)){
				sideadd = 900;
			} else if (document.estimate.leg_height.value == 7){
				sideadd = 1100;
			} else if (document.estimate.leg_height.value == 8){
				sideadd = 1300;
			} else if (document.estimate.leg_height.value == 9){
				sideadd = 1300;
			} else if (document.estimate.leg_height.value == 10){
				sideadd = 1500;
			} else if (document.estimate.leg_height.value == 11){
				sideadd = 1700;
			} else if (document.estimate.leg_height.value == 12){
				sideadd = 1900;
			}
		}
	}
	sideadd = sideadd/2;		//calculate for 1 side
	//Check if vertical metal wanted for sides
	if (document.estimate.vert_metal.value == "yes"){
		sideadd = sideadd + (0.5 * sideadd);
	}
	var sidenum = fix(sideadd);
	if (document.estimate.close_left.value == "yes"){
		document.estimate.closeleft.value = sidenum;
	} else if (document.estimate.close_left.value == "no"){
		document.estimate.closeleft.value = 0;
	}
	if (document.estimate.close_right.value == "yes"){
		document.estimate.closeright.value = sidenum;
	} else if (document.estimate.close_right.value == "no"){
		document.estimate.closeright.value = 0;
	}

	//calculate close ends option
	var endadd = 0;
	//calculate endadd
	if (document.estimate.width.value <= 24){
		if (document.estimate.width.value == 12){
			if ((document.estimate.leg_height.value == 6) || (document.estimate.leg_height.value == 5)){
				endadd = 400;
			} else if (document.estimate.leg_height.value == 7){
				endadd = 485;
			} else if (document.estimate.leg_height.value == 8){
				endadd = 495;
			} else if (document.estimate.leg_height.value == 9){
				endadd = 505;
			} else if (document.estimate.leg_height.value == 10){
				endadd = 590;
			} else if (document.estimate.leg_height.value == 11){
				endadd = 675;
			} else if (document.estimate.leg_height.value == 12){
				endadd = 760;
			}
		} else if (document.estimate.width.value == 18){
			if ((document.estimate.leg_height.value == 6) || (document.estimate.leg_height.value == 5)){
				endadd = 500;
			} else if (document.estimate.leg_height.value == 7){
				endadd = 585;
			} else if (document.estimate.leg_height.value == 8){
				endadd = 595;
			} else if (document.estimate.leg_height.value == 9){
				endadd = 605;
			} else if (document.estimate.leg_height.value == 10){
				endadd = 690;
			} else if (document.estimate.leg_height.value == 11){
				endadd = 775;
			} else if (document.estimate.leg_height.value == 12){
				endadd = 860;
			}
		} else if (document.estimate.width.value == 20){
			if ((document.estimate.leg_height.value == 6) || (document.estimate.leg_height.value == 5)){
				endadd = 600;
			} else if (document.estimate.leg_height.value == 7){
				endadd = 685;
			} else if (document.estimate.leg_height.value == 8){
				endadd = 695;
			} else if (document.estimate.leg_height.value == 9){
				endadd = 705;
			} else if (document.estimate.leg_height.value == 10){
				endadd = 790;
			} else if (document.estimate.leg_height.value == 11){
				endadd = 875;
			} else if (document.estimate.leg_height.value == 12){
				endadd = 960;
			}
		} else if (document.estimate.width.value == 22){
			if ((document.estimate.leg_height.value == 6) || (document.estimate.leg_height.value == 5)){
				endadd = 700;
			} else if (document.estimate.leg_height.value == 7){
				endadd = 785;
			} else if (document.estimate.leg_height.value == 8){
				endadd = 795;
			} else if (document.estimate.leg_height.value == 9){
				endadd = 805;
			} else if (document.estimate.leg_height.value == 10){
				endadd = 890;
			} else if (document.estimate.leg_height.value == 11){
				endadd = 975;
			} else if (document.estimate.leg_height.value == 12){
				endadd = 1060;
			}
		} else if (document.estimate.width.value == 24){
			if ((document.estimate.leg_height.value == 6) || (document.estimate.leg_height.value == 5)){
				endadd = 800;
			} else if (document.estimate.leg_height.value == 7){
				endadd = 885;
			} else if (document.estimate.leg_height.value == 8){
				endadd = 895;
			} else if (document.estimate.leg_height.value == 9){
				endadd = 905;
			} else if (document.estimate.leg_height.value == 10){
				endadd = 990;
			} else if (document.estimate.leg_height.value == 11){
				endadd = 1075;
			} else if (document.estimate.leg_height.value == 12){
				endadd = 1160;
			}
		}
	} else {
		//width > 24 ft
		if (document.estimate.width.value == 26){
			if ((document.estimate.leg_height.value == 6) || (document.estimate.leg_height.value == 5)){
				endadd = 1000;
			} else if (document.estimate.leg_height.value == 7){
				endadd = 1110;
			} else if (document.estimate.leg_height.value == 8){
				endadd = 1120;
			} else if (document.estimate.leg_height.value == 9){
				endadd = 1135;
			} else if (document.estimate.leg_height.value == 10){
				endadd = 1225;
			} else if (document.estimate.leg_height.value == 11){
				endadd = 1315;
			} else if (document.estimate.leg_height.value == 12){
				endadd = 1405;
			}
		} else if (document.estimate.width.value == 28){
			if ((document.estimate.leg_height.value == 6) || (document.estimate.leg_height.value == 5)){
				endadd = 1050;
			} else if (document.estimate.leg_height.value == 7){
				endadd = 1160;
			} else if (document.estimate.leg_height.value == 8){
				endadd = 1170;
			} else if (document.estimate.leg_height.value == 9){
				endadd = 1185;
			} else if (document.estimate.leg_height.value == 10){
				endadd = 1275;
			} else if (document.estimate.leg_height.value == 11){
				endadd = 1365;
			} else if (document.estimate.leg_height.value == 12){
				endadd = 1455;
			}
		} else if (document.estimate.width.value == 30){
			if ((document.estimate.leg_height.value == 6) || (document.estimate.leg_height.value == 5)){
				endadd = 1100;
			} else if (document.estimate.leg_height.value == 7){
				endadd = 1210;
			} else if (document.estimate.leg_height.value == 8){
				endadd = 1225;
			} else if (document.estimate.leg_height.value == 9){
				endadd = 1225;
			} else if (document.estimate.leg_height.value == 10){
				endadd = 1325;
			} else if (document.estimate.leg_height.value == 11){
				endadd = 1415;
			} else if (document.estimate.leg_height.value == 12){
				endadd = 1505;
			}
		}
	}

	//Check if vertical metal wanted for front/back
	if (document.estimate.vert_metal.value == "yes"){
		endadd = endadd + (0.5 * endadd);
	}
	var endnum = fix(endadd);
	if ((document.estimate.close_back.value == "yes") && (document.estimate.gable_back.value == "yes")){
		document.estimate.gable_back.value = "no";
		alert('Back gable not needed if back is closed in.');
		document.estimate.closeback.value = endnum;
		document.estimate.close_back.focus();
	} else {
		if (document.estimate.close_back.value == "yes"){
			document.estimate.closeback.value = endnum;
		} else if (document.estimate.close_back.value == "no"){
			document.estimate.closeback.value = 0;
		}
	}
	if ((document.estimate.close_front.value == "yes") && (document.estimate.gable_front.value == "yes")){
		document.estimate.gable_front.value = "no";
		alert('Front gable not needed if front is closed in.');
		document.estimate.closefront.value = endnum;
		document.estimate.gable_front.focus();
	} else {
		if (document.estimate.close_front.value == "yes"){
			document.estimate.closefront.value = endnum;
		} else if (document.estimate.close_front.value == "no"){
			document.estimate.closefront.value = 0;
		}
	}

	//Calculate Gable Ends
	var gable_num = 0;
	if ((document.estimate.close_back.value == "yes") && (document.estimate.gable_back.value == "yes")){
		document.estimate.gable_back.value = "no";
		alert('Back gable not needed if back is closed in.');
		document.estimate.gable_back.focus();
	} else {
		if ((document.estimate.gable_back.value == "yes") && (document.estimate.width.value <= 20)){
			gable_num = 150;
		}
		if ((document.estimate.gable_back.value == "yes") && ((document.estimate.width.value >= 21) && (document.estimate.width.value <= 24))){
			gable_num = 175;
		}
		if ((document.estimate.gable_back.value == "yes") && ((document.estimate.width.value >= 25) && (document.estimate.width.value <= 26))){
			gable_num = 225;
		}
		if ((document.estimate.gable_back.value == "yes") && ((document.estimate.width.value >= 27) && (document.estimate.width.value <= 28))){
			gable_num = 250;
		}
		if ((document.estimate.gable_back.value == "yes") && ((document.estimate.width.value >= 29) && (document.estimate.width.value <= 30))){
			gable_num = 300;
		}
	}
	if ((document.estimate.close_front.value == "yes") && (document.estimate.gable_front.value == "yes")){
		document.estimate.gable_front.value = "no";
		alert('Front gable not needed if front is closed in.');
		document.estimate.gable_front.focus();
	} else {	
		if ((document.estimate.gable_front.value == "yes") && (document.estimate.width.value <= 20)){
			gable_num = gable_num + 150;
		}
		if ((document.estimate.gable_front.value == "yes") && ((document.estimate.width.value >= 21) && (document.estimate.width.value <= 24))){
			gable_num = gable_num + 175;
		}
		if ((document.estimate.gable_front.value == "yes") && ((document.estimate.width.value >= 25) && (document.estimate.width.value <= 26))){
			gable_num = gable_num + 225;
		}
		if ((document.estimate.gable_front.value == "yes") && ((document.estimate.width.value >= 27) && (document.estimate.width.value <= 28))){
			gable_num = gable_num + 250;
		}
		if ((document.estimate.gable_front.value == "yes") && ((document.estimate.width.value >= 29) && (document.estimate.width.value <= 30))){
			gable_num = gable_num + 300;
		}
		//Check if vertical metal wanted for gables
		if (document.estimate.vert_metal.value == "yes"){
			gable_num = gable_num + (0.5 * gable_num);
		}
		gable_price = fix(gable_num);
		document.estimate.gableends.value = gable_price;
	}

	//Add in Accessories
	//Braces
	var brace_quan = parseInt(document.estimate.brace.value);
	if (document.estimate.width.value <= 20){
		brace_num = 7.5 * brace_quan;
	} else if ((document.estimate.width.value >= 21) && (document.estimate.width.value <= 24)){
		brace_num = 15 * brace_quan;
	} else if (document.estimate.width.value >= 25){
		brace_num = 15 * brace_quan;
	}
	brace_price = fix(brace_num);
	document.estimate.xbraces.value = brace_price;

	//Extra Bows
	var bow_quan = parseInt(document.estimate.bow.value);
	if (document.estimate.width.value <= 20){
		bow_num = 150 * bow_quan;
	} else if ((document.estimate.width.value >= 22) && (document.estimate.width.value <= 24)){
		bow_num = 175 * bow_quan;
	} else if (document.estimate.width.value >= 25){
		bow_num = 250 * bow_quan;	
	}	
	bow_price = fix(bow_num);
	document.estimate.xbows.value = bow_price;

	//Walk In Doors
	var wdoor_quan = parseInt(document.estimate.wdoor.value);
	wdoor_num = 200 * wdoor_quan;	
	wdoor_price = fix(wdoor_num);
	document.estimate.p_doors.value = wdoor_price;
	//Windows
	var window_quan = parseInt(document.estimate.window.value);
	window_num = 150 * window_quan;	
	window_price = fix(window_num);
	document.estimate.p_windows.value = window_price;
	//6x7 garage door
	var g1_quan = parseInt(document.estimate.gdoor_6x7.value);
	if (document.estimate.width.value <= 24){
		g1_num = 300 * g1_quan;
	} else {
		g1_num = 300 * g1_quan;	
	}		
	//8x7 garage door
	var g2_quan = parseInt(document.estimate.gdoor_8x7.value);
	g2_num = 350 * g2_quan;
	//9x7 garage door
	var g3_quan = parseInt(document.estimate.gdoor_9x7.value);
	g3_num = 400 * g3_quan;
	//10x8 garage door
	var g4_quan = parseInt(document.estimate.gdoor_10x8.value);
	g4_num = 450 * g4_quan;
	//10x10 garage door
	var g5_quan = parseInt(document.estimate.gdoor_10x10.value);
	g5_num = 500 * g5_quan;
	var tprice = g1_num + g2_num + g3_num + g4_num + g5_num;
	gdoor_price = fix(tprice);
	document.estimate.g_doors.value = gdoor_price;

	//Bay Openings
	var g6_quan = parseInt(document.estimate.bayleft.value) + parseInt(document.estimate.bayright.value) + parseInt(document.estimate.bayfront.value) + parseInt(document.estimate.bayback.value);
	g6_num = 200 * g6_quan;
	var bprice = fix(g6_num);
	document.estimate.bayprice.value = bprice;

	//Additional Achors
	var a_quan = parseInt(document.estimate.anchor.value);	
	a_num = 25 * a_quan;
	var a_price = fix(a_num);
	document.estimate.anc_price.value = a_price;

	//Calculate extra Sheet Metal
	var p_sheet = parseInt(document.estimate.sheet_21.value) * 90 + parseInt(document.estimate.sheet_26.value) * 110 + parseInt(document.estimate.sheet_31.value) * 130 + parseInt(document.estimate.sheet_36.value) * 150 + parseInt(document.estimate.sheet_41.value) * 180          ;
	var price_sheet = fix(p_sheet);
	document.estimate.sheet_price.value = price_sheet;


	//Total Building Cost with no vertical (style = None)
	var total_cost_nov = parseFloat(document.estimate.baseprice.value) + parseFloat(document.estimate.closeright.value) + parseFloat(document.estimate.closeleft.value) + parseFloat(document.estimate.closeback.value) + parseFloat(document.estimate.closefront.value) + parseFloat(document.estimate.gableends.value) + parseFloat(document.estimate.xbraces.value) + parseFloat(document.estimate.xbows.value) + parseFloat(document.estimate.p_doors.value) + parseFloat(document.estimate.p_windows.value) + parseFloat(document.estimate.g_doors.value) + parseFloat(document.estimate.bayprice.value) + parseFloat(document.estimate.anc_price.value) + parseFloat(document.estimate.sheet_price.value);


	//Set Total Cost
	var total_cost = total_cost_nov;
	var dis_cost = .90 * total_cost;		//10% Discounted Cost
	var deposit = .1 * dis_cost;
	document.estimate.tmpcost.value = fix(total_cost);
	document.estimate.tcost.value = fix(dis_cost);
	document.estimate.deposit.value = fix(deposit);
	document.estimate.balancedue.value = fix(dis_cost-deposit);


	//temporary fix for needed pricing
	if (document.estimate.direct_price.value == "none"){
		document.estimate.tcost.value = "Call Us";
	}
}

//format a decimal number to 2 digits and convert to string
function fix(num){
	num = num + 0.005		//round the last digit
	string = "" + num;
	if(string.indexOf('.',0) == -1){
		return string + '.00';
	}
	separation = string.length - string.indexOf('.',0);
	if (separation > 3){
		return string.substring(0,string.length - separation + 3);
	} else if (separation == 2){
		return string + '0';
	}
	return string;
}

function gable(){
	var page = "gable.html";
	newWindow = open(page,"gablewindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=200,height=200");
}

function braces(){
	var page = "braces.html";
	newWindow = open(page,"bracewindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=200,height=150");
}

function bows(){
	var page = "bows.html";
	newWindow = open(page,"bowwindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=200,height=150");
}

function style_def(){
	var page = "style.html";
	newWindow = open(page,"stylewindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=200,height=150");
}

function bay(){
	var page = "bay.html";
	newWindow = open(page,"baywindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=380,height=450");
}

function frameout(){
	var page = "frameout.html";
	newWindow = open(page,"baywindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=380,height=460");
}

function vertical(){
	var page = "vertical.html";
	newWindow = open(page,"verticalwindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=200,height=170");
}

function b_eves(){
	var page = "boxeves.html";
	newWindow = open(page,"boxeveswindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=200,height=150");
}

//generate random quote number - 6 digits long
function rquote(){
	//generate random number between 0 and 999999 to select photo
	var rannum = Math.floor(Math.random() * 999999);
	document.estimate.est_num.value = rannum;
}


//generate random quote number - 6 digits long
function EstPrint(){
	//generate random number between 0 and 999999 to select photo
	window.print();
}

// end mask -->



