//Automated Standard Class Flats Calculator
function saf_calculate() {
	
saf_total = document.savings_calculator_standard.saf_total.value	
saf_total = Number(saf_total)

saf_method = document.savings_calculator_standard.saf_method.value
saf_method = Number(saf_method)

saf_subclass = document.savings_calculator_standard.saf_subclass.value
saf_subclass = Number(saf_subclass)


switch (saf_method)
{
	case 1:
	five_saf = saf_total * .425
	three_saf = saf_total * .375
	adc_saf = saf_total * .15
	madc_saf = saf_total * .05
	break;
	
	case 2:
	five_saf = saf_total * .20
	three_saf = saf_total * .35
	adc_saf = saf_total * .30
	madc_saf = saf_total * .15
	break;
	
	case 3:
	five_saf = saf_total * .075
	three_saf = saf_total * .225
	adc_saf = saf_total * .425
	madc_saf = saf_total * .275
	break;	
}

document.savings_calculator_standard.five_saf.value = Math.round(five_saf)
document.savings_calculator_standard.three_saf.value = Math.round(three_saf)
document.savings_calculator_standard.adc_saf.value = Math.round(adc_saf)
document.savings_calculator_standard.madc_saf.value = Math.round(madc_saf)

switch (saf_subclass)
{
	case 1:
	five_discount_lb_saf = .725
	three_discount_lb_saf = .725
	adc_discount_lb_saf = .725
	madc_discount_lb_saf = .725
	
	five_discount_piecelb_saf = .196
	three_discount_piecelb_saf = .268
	adc_discount_piecelb_saf = .336
	madc_discount_piecelb_saf = .346
	break;
	
	case 2:
	five_discount_lb_saf = .725
	three_discount_lb_saf = .725
	adc_discount_lb_saf = .725
	madc_discount_lb_saf = .725
	
	five_discount_piecelb_saf = .217
	three_discount_piecelb_saf = .314
	adc_discount_piecelb_saf = .359
	madc_discount_piecelb_saf = .408
	break;
	
	case 3:
	five_discount_lb_saf = .628
	three_discount_lb_saf = .628
	adc_discount_lb_saf = .628
	madc_discount_lb_saf = .628
	
	five_discount_piecelb_saf = .082
	three_discount_piecelb_saf = .154
	adc_discount_piecelb_saf = .222
	madc_discount_piecelb_saf = .232
	break;
	
	case 4:
	five_discount_lb_saf = .628
	three_discount_lb_saf = .628
	adc_discount_lb_saf = .628
	madc_discount_lb_saf = .628
	
	five_discount_piecelb_saf = .103
	three_discount_piecelb_saf = .200
	adc_discount_piecelb_saf = .245
	madc_discount_piecelb_saf = .294
	break;
}

document.savings_calculator_standard.five_discount_lb_saf.value = "$" + five_discount_lb_saf
document.savings_calculator_standard.three_discount_lb_saf.value = "$" + three_discount_lb_saf
document.savings_calculator_standard.adc_discount_lb_saf.value = "$" + adc_discount_lb_saf
document.savings_calculator_standard.madc_discount_lb_saf.value = "$" + madc_discount_lb_saf

document.savings_calculator_standard.five_discount_piecelb_saf.value = "$" + five_discount_piecelb_saf
document.savings_calculator_standard.three_discount_piecelb_saf.value = "$" + three_discount_piecelb_saf
document.savings_calculator_standard.adc_discount_piecelb_saf.value = "$" + adc_discount_piecelb_saf
document.savings_calculator_standard.madc_discount_piecelb_saf.value = "$" + madc_discount_piecelb_saf

five_auto_rate = five_discount_lb_saf + five_discount_piecelb_saf
three_auto_rate = three_discount_lb_saf + three_discount_piecelb_saf
adc_auto_rate = adc_discount_lb_saf + adc_discount_piecelb_saf
madc_auto_rate = madc_discount_lb_saf + madc_discount_piecelb_saf

five_auto_saf = five_saf * five_auto_rate
three_auto_saf = three_saf * three_auto_rate
adc_auto_saf = adc_saf * adc_auto_rate
madc_auto_saf = madc_saf * madc_auto_rate

document.savings_calculator_standard.five_auto_saf.value = formatCurrency(five_auto_saf)
document.savings_calculator_standard.three_auto_saf.value = formatCurrency(three_auto_saf)
document.savings_calculator_standard.adc_auto_saf.value = formatCurrency(adc_auto_saf)
document.savings_calculator_standard.madc_auto_saf.value = formatCurrency(madc_auto_saf)

five_full_saf = five_saf * 1.90
three_full_saf = three_saf * 1.90
adc_full_saf = adc_saf * 1.90
madc_full_saf = madc_saf * 1.90


document.savings_calculator_standard.five_full_saf.value = formatCurrency(five_full_saf)
document.savings_calculator_standard.three_full_saf.value = formatCurrency(three_full_saf)
document.savings_calculator_standard.adc_full_saf.value = formatCurrency(adc_full_saf)
document.savings_calculator_standard.madc_full_saf.value = formatCurrency(madc_full_saf)

five_save_saf = five_full_saf - five_auto_saf
three_save_saf = three_full_saf - three_auto_saf
adc_save_saf = adc_full_saf - adc_auto_saf
madc_save_saf = madc_full_saf - madc_auto_saf

document.savings_calculator_standard.five_save_saf.value = formatCurrency(five_save_saf)
document.savings_calculator_standard.three_save_saf.value = formatCurrency(three_save_saf)
document.savings_calculator_standard.adc_save_saf.value = formatCurrency(adc_save_saf)
document.savings_calculator_standard.madc_save_saf.value = formatCurrency(madc_save_saf)

savings_day_saf = five_save_saf + three_save_saf + adc_save_saf + madc_save_saf
savings_week_saf = savings_day_saf * 5
savings_month_saf = savings_day_saf * 21
savings_year_saf = savings_day_saf * 21 * 12

document.savings_calculator_standard.savings_day_saf.value = formatCurrency(savings_day_saf)
document.savings_calculator_standard.savings_week_saf.value = formatCurrency(savings_week_saf)
document.savings_calculator_standard.savings_month_saf.value = formatCurrency(savings_month_saf)
document.savings_calculator_standard.savings_year_saf.value = formatCurrency(savings_year_saf)
}

//First Class Flats New Calculator
function new_fcf_calculate() {

fcf_total = document.savings_calculator_fcf.fcf_total.value
fcf_total = Number(fcf_total)

fcf_method = document.savings_calculator_fcf.fcf_method.value
fcf_method = Number(fcf_method)

switch (fcf_method)
{
	case 1:
	five_total_fcf = fcf_total * .425;
	three_total_fcf = fcf_total * .375;
	adc_total_fcf = fcf_total * .15;
	madc_total_fcf = fcf_total * .05;
	break;

	case 2:
	five_total_fcf = fcf_total * .20;
	three_total_fcf = fcf_total * .35;
	adc_total_fcf = fcf_total * .30;
	madc_total_fcf = fcf_total * .15;
	break;

	case 3:
	five_total_fcf = fcf_total * .075;
	three_total_fcf = fcf_total * .225;
	adc_total_fcf = fcf_total * .425;
	madc_total_fcf = fcf_total * .275;
	break;
}

document.savings_calculator_fcf.five_fcf.value = Math.round(five_total_fcf)
document.savings_calculator_fcf.three_fcf.value = Math.round(three_total_fcf)
document.savings_calculator_fcf.adc_fcf.value = Math.round(adc_total_fcf)
document.savings_calculator_fcf.madc_fcf.value = Math.round(madc_total_fcf)

five_auto_fcf = five_total_fcf * .380
three_auto_fcf = three_total_fcf * .542
adc_auto_fcf = adc_total_fcf * .603
madc_auto_fcf = madc_total_fcf * .725

document.savings_calculator_fcf.five_auto_fcf.value = formatCurrency(five_auto_fcf)
document.savings_calculator_fcf.three_auto_fcf.value = formatCurrency(three_auto_fcf)
document.savings_calculator_fcf.adc_auto_fcf.value = formatCurrency(adc_auto_fcf)
document.savings_calculator_fcf.madc_auto_fcf.value = formatCurrency(madc_auto_fcf)

five_full_fcf = five_total_fcf * .88
three_full_fcf = three_total_fcf * .88
adc_full_fcf = adc_total_fcf * .88
madc_full_fcf = madc_total_fcf * .88


document.savings_calculator_fcf.five_full_fcf.value = formatCurrency(five_full_fcf)
document.savings_calculator_fcf.three_full_fcf.value = formatCurrency(three_full_fcf)
document.savings_calculator_fcf.adc_full_fcf.value = formatCurrency(adc_full_fcf)
document.savings_calculator_fcf.madc_full_fcf.value = formatCurrency(madc_full_fcf)

five_save_fcf = five_full_fcf - five_auto_fcf
three_save_fcf = three_full_fcf - three_auto_fcf
adc_save_fcf = adc_full_fcf - adc_auto_fcf
madc_save_fcf = madc_full_fcf - madc_auto_fcf

document.savings_calculator_fcf.five_save_fcf.value = formatCurrency(five_save_fcf)
document.savings_calculator_fcf.three_save_fcf.value = formatCurrency(three_save_fcf)
document.savings_calculator_fcf.adc_save_fcf.value = formatCurrency(adc_save_fcf)
document.savings_calculator_fcf.madc_save_fcf.value = formatCurrency(madc_save_fcf)

savings_day_fcf = five_save_fcf + three_save_fcf + adc_save_fcf + madc_save_fcf
savings_week_fcf = savings_day_fcf * 5
savings_month_fcf = savings_day_fcf * 21
savings_year_fcf = savings_day_fcf * 21 * 12

document.savings_calculator_fcf.savings_day_fcf.value = formatCurrency(savings_day_fcf)
document.savings_calculator_fcf.savings_week_fcf.value = formatCurrency(savings_week_fcf)
document.savings_calculator_fcf.savings_month_fcf.value = formatCurrency(savings_month_fcf)
document.savings_calculator_fcf.savings_year_fcf.value = formatCurrency(savings_year_fcf)
}

//Barcoded Bound Printer Matter Flats Calculator
function bbpm_calculate() {

bbpm_total = document.savings_calculator_bbpm.bbpm_total.value
bbpm_total = Number(bbpm_total)

bbpm_method = document.savings_calculator_bbpm.bbpm_method.value
bbpm_method = Number(bbpm_method)

switch (bbpm_method)
{
	case 1:
	onetwo_bbpm = bbpm_total * .20;
	three_bbpm = bbpm_total * .10;
	four_bbpm = bbpm_total * .10;
	five_bbpm = bbpm_total * .10;
	six_bbpm = bbpm_total * .10;
	seven_bbpm = bbpm_total * .10;
	eight_bbpm = bbpm_total * .10;
	break;

	case 2:
	onetwo_bbpm = bbpm_total * .10;
	three_bbpm = bbpm_total * .10;
	four_bbpm = bbpm_total * .15;
	five_bbpm = bbpm_total * .15;
	six_bbpm = bbpm_total * .10;
	seven_bbpm = bbpm_total * .10;
	eight_bbpm = bbpm_total * .10;
	break;

	case 3:
	onetwo_bbpm = bbpm_total * .10;
	three_bbpm = bbpm_total * .10;
	four_bbpm = bbpm_total * .10;
	five_bbpm = bbpm_total * .10;
	six_bbpm = bbpm_total * .10;
	seven_bbpm = bbpm_total * .15;

	eight_bbpm = bbpm_total * .15;
	break;
}

document.savings_calculator_bbpm.onetwo_bbpm.value = Math.round(onetwo_bbpm)
document.savings_calculator_bbpm.three_bbpm.value = Math.round(three_bbpm)
document.savings_calculator_bbpm.four_bbpm.value = Math.round(four_bbpm)
document.savings_calculator_bbpm.five_bbpm.value = Math.round(five_bbpm)
document.savings_calculator_bbpm.six_bbpm.value = Math.round(six_bbpm)
document.savings_calculator_bbpm.seven_bbpm.value = Math.round(seven_bbpm)
document.savings_calculator_bbpm.eight_bbpm.value = Math.round(eight_bbpm)

onetwo_bbpm_full = onetwo_bbpm * 1.89
three_bbpm_full = three_bbpm * 1.93
four_bbpm_full = four_bbpm * 1.99
five_bbpm_full = five_bbpm * 2.08
six_bbpm_full = six_bbpm * 2.19
seven_bbpm_full = seven_bbpm * 2.25
eight_bbpm_full = eight_bbpm * 2.44

document.savings_calculator_bbpm.onetwo_bbpm_full.value = formatCurrency(onetwo_bbpm_full)
document.savings_calculator_bbpm.three_bbpm_full.value = formatCurrency(three_bbpm_full)
document.savings_calculator_bbpm.four_bbpm_full.value = formatCurrency(four_bbpm_full)
document.savings_calculator_bbpm.five_bbpm_full.value = formatCurrency(five_bbpm_full)
document.savings_calculator_bbpm.six_bbpm_full.value = formatCurrency(six_bbpm_full)
document.savings_calculator_bbpm.seven_bbpm_full.value = formatCurrency(seven_bbpm_full)
document.savings_calculator_bbpm.eight_bbpm_full.value = formatCurrency(eight_bbpm_full)

onetwo_bbpm_auto = onetwo_bbpm * (1.2160 + .1380)
three_bbpm_auto = three_bbpm * (1.2160 + .1580)
four_bbpm_auto = four_bbpm * (1.2160 + .2000)
five_bbpm_auto = five_bbpm * (1.2160 + .2530)
six_bbpm_auto = six_bbpm * (1.2160 + .3210)
seven_bbpm_auto = seven_bbpm * (1.2160 + .3620)
eight_bbpm_auto = eight_bbpm * (1.2160 + .4820)

document.savings_calculator_bbpm.onetwo_bbpm_auto.value = formatCurrency(onetwo_bbpm_auto)
document.savings_calculator_bbpm.three_bbpm_auto.value = formatCurrency(three_bbpm_auto)
document.savings_calculator_bbpm.four_bbpm_auto.value = formatCurrency(four_bbpm_auto)
document.savings_calculator_bbpm.five_bbpm_auto.value = formatCurrency(five_bbpm_auto)
document.savings_calculator_bbpm.six_bbpm_auto.value = formatCurrency(six_bbpm_auto)
document.savings_calculator_bbpm.seven_bbpm_auto.value = formatCurrency(seven_bbpm_auto)
document.savings_calculator_bbpm.eight_bbpm_auto.value = formatCurrency(eight_bbpm_auto)

onetwo_bbpm_save = onetwo_bbpm_full - onetwo_bbpm_auto
three_bbpm_save = three_bbpm_full - three_bbpm_auto
four_bbpm_save = four_bbpm_full - four_bbpm_auto
five_bbpm_save = five_bbpm_full - five_bbpm_auto
six_bbpm_save = six_bbpm_full - six_bbpm_auto
seven_bbpm_save = seven_bbpm_full - seven_bbpm_auto
eight_bbpm_save = eight_bbpm_full - eight_bbpm_auto

document.savings_calculator_bbpm.onetwo_bbpm_savings.value = formatCurrency(onetwo_bbpm_save)
document.savings_calculator_bbpm.three_bbpm_savings.value = formatCurrency(three_bbpm_save)
document.savings_calculator_bbpm.four_bbpm_savings.value = formatCurrency(four_bbpm_save)
document.savings_calculator_bbpm.five_bbpm_savings.value = formatCurrency(five_bbpm_save)
document.savings_calculator_bbpm.six_bbpm_savings.value = formatCurrency(six_bbpm_save)
document.savings_calculator_bbpm.seven_bbpm_savings.value = formatCurrency(seven_bbpm_save)
document.savings_calculator_bbpm.eight_bbpm_savings.value = formatCurrency(eight_bbpm_save)

savings_day_bbpm = onetwo_bbpm_save + three_bbpm_save + four_bbpm_save + five_bbpm_save + six_bbpm_save + seven_bbpm_save + eight_bbpm_save
savings_week_bbpm = savings_day_bbpm * 5
savings_month_bbpm = savings_day_bbpm * 21
savings_year_bbpm = savings_day_bbpm * 21 * 12

document.savings_calculator_bbpm.savings_day_bbpm.value = formatCurrency(savings_day_bbpm)
document.savings_calculator_bbpm.savings_week_bbpm.value = formatCurrency(savings_week_bbpm)
document.savings_calculator_bbpm.savings_month_bbpm.value = formatCurrency(savings_month_bbpm)
document.savings_calculator_bbpm.savings_year_bbpm.value = formatCurrency(savings_year_bbpm)
}


//NonBarcoded Bound Printer Matter Flats Calculator
function nbbpm_calculate() {

nbbpm_total = document.savings_calculator_nbbpm.nbbpm_total.value
nbbpm_total = Number(nbbpm_total)

nbbpm_method = document.savings_calculator_nbbpm.nbbpm_method.value
nbbpm_method = Number(nbbpm_method)

switch (nbbpm_method)
{
	case 1:
	onetwo_nbbpm = nbbpm_total * .20;
	three_nbbpm = nbbpm_total * .10;
	four_nbbpm = nbbpm_total * .10;
	five_nbbpm = nbbpm_total * .10;
	six_nbbpm = nbbpm_total * .10;
	seven_nbbpm = nbbpm_total * .10;
	eight_nbbpm = nbbpm_total * .10;
	break;

	case 2:
	onetwo_nbbpm = nbbpm_total * .10;
	three_nbbpm = nbbpm_total * .10;
	four_nbbpm = nbbpm_total * .15;
	five_nbbpm = nbbpm_total * .15;
	six_nbbpm = nbbpm_total * .10;
	seven_nbbpm = nbbpm_total * .10;
	eight_nbbpm = nbbpm_total * .10;
	break;

	case 3:
	onetwo_nbbpm = nbbpm_total * .10;
	three_nbbpm = nbbpm_total * .10;
	four_nbbpm = nbbpm_total * .10;
	five_nbbpm = nbbpm_total * .10;
	six_nbbpm = nbbpm_total * .10;
	seven_nbbpm = nbbpm_total * .15;

	eight_nbbpm = nbbpm_total * .15;
	break;
}

document.savings_calculator_nbbpm.onetwo_nbbpm.value = Math.round(onetwo_nbbpm)
document.savings_calculator_nbbpm.three_nbbpm.value = Math.round(three_nbbpm)
document.savings_calculator_nbbpm.four_nbbpm.value = Math.round(four_nbbpm)
document.savings_calculator_nbbpm.five_nbbpm.value = Math.round(five_nbbpm)
document.savings_calculator_nbbpm.six_nbbpm.value = Math.round(six_nbbpm)
document.savings_calculator_nbbpm.seven_nbbpm.value = Math.round(seven_nbbpm)
document.savings_calculator_nbbpm.eight_nbbpm.value = Math.round(eight_nbbpm)

onetwo_nbbpm_full = onetwo_nbbpm * 1.89
three_nbbpm_full = three_nbbpm * 1.93
four_nbbpm_full = four_nbbpm * 1.99
five_nbbpm_full = five_nbbpm * 2.08
six_nbbpm_full = six_nbbpm * 2.19
seven_nbbpm_full = seven_nbbpm * 2.25
eight_nbbpm_full = eight_nbbpm * 2.44

document.savings_calculator_nbbpm.onetwo_nbbpm_full.value = formatCurrency(onetwo_nbbpm_full)
document.savings_calculator_nbbpm.three_nbbpm_full.value = formatCurrency(three_nbbpm_full)
document.savings_calculator_nbbpm.four_nbbpm_full.value = formatCurrency(four_nbbpm_full)
document.savings_calculator_nbbpm.five_nbbpm_full.value = formatCurrency(five_nbbpm_full)
document.savings_calculator_nbbpm.six_nbbpm_full.value = formatCurrency(six_nbbpm_full)
document.savings_calculator_nbbpm.seven_nbbpm_full.value = formatCurrency(seven_nbbpm_full)
document.savings_calculator_nbbpm.eight_nbbpm_full.value = formatCurrency(eight_nbbpm_full)

onetwo_nbbpm_auto = onetwo_nbbpm * (1.2460 + .1380)
three_nbbpm_auto = three_nbbpm * (1.2460 + .1580)
four_nbbpm_auto = four_nbbpm * (1.2460 + .2000)
five_nbbpm_auto = five_nbbpm * (1.2460 + .2530)
six_nbbpm_auto = six_nbbpm * (1.2460 + .3210)
seven_nbbpm_auto = seven_nbbpm * (1.2460 + .3620)
eight_nbbpm_auto = eight_nbbpm * (1.2460 + .4820)

document.savings_calculator_nbbpm.onetwo_nbbpm_auto.value = formatCurrency(onetwo_nbbpm_auto)
document.savings_calculator_nbbpm.three_nbbpm_auto.value = formatCurrency(three_nbbpm_auto)
document.savings_calculator_nbbpm.four_nbbpm_auto.value = formatCurrency(four_nbbpm_auto)
document.savings_calculator_nbbpm.five_nbbpm_auto.value = formatCurrency(five_nbbpm_auto)
document.savings_calculator_nbbpm.six_nbbpm_auto.value = formatCurrency(six_nbbpm_auto)
document.savings_calculator_nbbpm.seven_nbbpm_auto.value = formatCurrency(seven_nbbpm_auto)
document.savings_calculator_nbbpm.eight_nbbpm_auto.value = formatCurrency(eight_nbbpm_auto)

onetwo_nbbpm_save = onetwo_nbbpm_full - onetwo_nbbpm_auto
three_nbbpm_save = three_nbbpm_full - three_nbbpm_auto
four_nbbpm_save = four_nbbpm_full - four_nbbpm_auto
five_nbbpm_save = five_nbbpm_full - five_nbbpm_auto
six_nbbpm_save = six_nbbpm_full - six_nbbpm_auto
seven_nbbpm_save = seven_nbbpm_full - seven_nbbpm_auto
eight_nbbpm_save = eight_nbbpm_full - eight_nbbpm_auto

document.savings_calculator_nbbpm.onetwo_nbbpm_savings.value = formatCurrency(onetwo_nbbpm_save)
document.savings_calculator_nbbpm.three_nbbpm_savings.value = formatCurrency(three_nbbpm_save)
document.savings_calculator_nbbpm.four_nbbpm_savings.value = formatCurrency(four_nbbpm_save)
document.savings_calculator_nbbpm.five_nbbpm_savings.value = formatCurrency(five_nbbpm_save)
document.savings_calculator_nbbpm.six_nbbpm_savings.value = formatCurrency(six_nbbpm_save)
document.savings_calculator_nbbpm.seven_nbbpm_savings.value = formatCurrency(seven_nbbpm_save)
document.savings_calculator_nbbpm.eight_nbbpm_savings.value = formatCurrency(eight_nbbpm_save)

savings_day_nbbpm = onetwo_nbbpm_save + three_nbbpm_save + four_nbbpm_save + five_nbbpm_save + six_nbbpm_save + seven_nbbpm_save + eight_nbbpm_save
savings_week_nbbpm = savings_day_nbbpm * 5
savings_month_nbbpm = savings_day_nbbpm * 21
savings_year_nbbpm = savings_day_nbbpm * 21 * 12

document.savings_calculator_nbbpm.savings_day_nbbpm.value = formatCurrency(savings_day_nbbpm)
document.savings_calculator_nbbpm.savings_week_nbbpm.value = formatCurrency(savings_week_nbbpm)
document.savings_calculator_nbbpm.savings_month_nbbpm.value = formatCurrency(savings_month_nbbpm)
document.savings_calculator_nbbpm.savings_year_nbbpm.value = formatCurrency(savings_year_nbbpm)
}