// Set the prices for the calendars here as variables
var A31 = 29.95;
var A35 = 28.45;
var A310 = 26.96;
var A315 = 25.46;
var A320 = 23.96;
var A41 = 19.95;
var A45 = 18.95;
var A410 = 17.96;
var A415 = 16.96;
var A420 = 15.96;
var A51 = 14.95;
var A55 = 14.20;
var A510 = 13.46;
var A515 = 12.71;
var A520 = 11.96;
var A4L1 = 24.95;
var A4L5 = 23.70;
var A4L10 = 22.51;
var A4L15 = 21.38;
var A4L20 = 20.31;
var A5L1 = 16.95;
var A5L5 = 16.10;
var A5L10 = 15.29;
var A5L15 = 14.53;
var A5L20 = 13.80;
var D1 = 14.95;
var D5 = 14.20;
var D10 = 13.46;
var D15 = 12.71;
var D20 = 11.96;
var more = "quote";
// A3 Sub Total
function calculateA3(form,A3SubTotal) {
if (Number(form.A3Quantity.value) <= 4) {
form.A3SubTotal.value = ((Math.round((A31 * Number(form.A3Quantity.value))*100)/100) == Math.floor((Math.round((A31 * Number(form.A3Quantity.value))*100)/100))) ? (Math.round((A31 * Number(form.A3Quantity.value))*100)/100) + '.00' : (  ((Math.round((A31 * Number(form.A3Quantity.value))*100)/100)*10 == Math.floor((Math.round((A31 * Number(form.A3Quantity.value))*100)/100)*10)) ? (Math.round((A31 * Number(form.A3Quantity.value))*100)/100) + '0' : (Math.round((A31 * Number(form.A3Quantity.value))*100)/100));
} else if (Number(form.A3Quantity.value) <= 9) {
form.A3SubTotal.value = ((Math.round((A35 * Number(form.A3Quantity.value))*100)/100) == Math.floor((Math.round((A35 * Number(form.A3Quantity.value))*100)/100))) ? (Math.round((A35 * Number(form.A3Quantity.value))*100)/100) + '.00' : (  ((Math.round((A35 * Number(form.A3Quantity.value))*100)/100)*10 == Math.floor((Math.round((A35 * Number(form.A3Quantity.value))*100)/100)*10)) ? (Math.round((A35 * Number(form.A3Quantity.value))*100)/100) + '0' : (Math.round((A35 * Number(form.A3Quantity.value))*100)/100));
} else if (Number(form.A3Quantity.value) <= 14) {
form.A3SubTotal.value = ((Math.round((A310 * Number(form.A3Quantity.value))*100)/100) == Math.floor((Math.round((A310 * Number(form.A3Quantity.value))*100)/100))) ? (Math.round((A310 * Number(form.A3Quantity.value))*100)/100) + '.00' : (  ((Math.round((A310 * Number(form.A3Quantity.value))*100)/100)*10 == Math.floor((Math.round((A310 * Number(form.A3Quantity.value))*100)/100)*10)) ? (Math.round((A310 * Number(form.A3Quantity.value))*100)/100) + '0' : (Math.round((A310 * Number(form.A3Quantity.value))*100)/100));
} else if (Number(form.A3Quantity.value) <= 19) {
form.A3SubTotal.value = ((Math.round((A315 * Number(form.A3Quantity.value))*100)/100) == Math.floor((Math.round((A315 * Number(form.A3Quantity.value))*100)/100))) ? (Math.round((A315 * Number(form.A3Quantity.value))*100)/100) + '.00' : (  ((Math.round((A315 * Number(form.A3Quantity.value))*100)/100)*10 == Math.floor((Math.round((A315 * Number(form.A3Quantity.value))*100)/100)*10)) ? (Math.round((A315 * Number(form.A3Quantity.value))*100)/100) + '0' : (Math.round((A315 * Number(form.A3Quantity.value))*100)/100));
} else if (Number(form.A3Quantity.value) == 20) {
form.A3SubTotal.value = ((Math.round((A320 * Number(form.A3Quantity.value))*100)/100) == Math.floor((Math.round((A320 * Number(form.A3Quantity.value))*100)/100))) ? (Math.round((A320 * Number(form.A3Quantity.value))*100)/100) + '.00' : (  ((Math.round((A320 * Number(form.A3Quantity.value))*100)/100)*10 == Math.floor((Math.round((A320 * Number(form.A3Quantity.value))*100)/100)*10)) ? (Math.round((A320 * Number(form.A3Quantity.value))*100)/100) + '0' : (Math.round((A320 * Number(form.A3Quantity.value))*100)/100));
} else { 
form.A3SubTotal.value = "Quote"; 
}
}
// A4 Sub Total
function calculateA4(form,A4SubTotal) {
if (Number(form.A4Quantity.value) <= 4) {
form.A4SubTotal.value = ((Math.round((A41 * Number(form.A4Quantity.value))*100)/100) == Math.floor((Math.round((A41 * Number(form.A4Quantity.value))*100)/100))) ? (Math.round((A41 * Number(form.A4Quantity.value))*100)/100) + '.00' : (  ((Math.round((A41 * Number(form.A4Quantity.value))*100)/100)*10 == Math.floor((Math.round((A41 * Number(form.A4Quantity.value))*100)/100)*10)) ? (Math.round((A41 * Number(form.A4Quantity.value))*100)/100) + '0' : (Math.round((A41 * Number(form.A4Quantity.value))*100)/100));
} else if (Number(form.A4Quantity.value) <= 9) {
form.A4SubTotal.value = ((Math.round((A45 * Number(form.A4Quantity.value))*100)/100) == Math.floor((Math.round((A45 * Number(form.A4Quantity.value))*100)/100))) ? (Math.round((A45 * Number(form.A4Quantity.value))*100)/100) + '.00' : (  ((Math.round((A45 * Number(form.A4Quantity.value))*100)/100)*10 == Math.floor((Math.round((A45 * Number(form.A4Quantity.value))*100)/100)*10)) ? (Math.round((A45 * Number(form.A4Quantity.value))*100)/100) + '0' : (Math.round((A45 * Number(form.A4Quantity.value))*100)/100));
} else if (Number(form.A4Quantity.value) <= 14) {
form.A4SubTotal.value = ((Math.round((A410 * Number(form.A4Quantity.value))*100)/100) == Math.floor((Math.round((A410 * Number(form.A4Quantity.value))*100)/100))) ? (Math.round((A410 * Number(form.A4Quantity.value))*100)/100) + '.00' : (  ((Math.round((A410 * Number(form.A4Quantity.value))*100)/100)*10 == Math.floor((Math.round((A410 * Number(form.A4Quantity.value))*100)/100)*10)) ? (Math.round((A410 * Number(form.A4Quantity.value))*100)/100) + '0' : (Math.round((A410 * Number(form.A4Quantity.value))*100)/100));
} else if (Number(form.A4Quantity.value) <= 19) {
form.A4SubTotal.value = ((Math.round((A415 * Number(form.A4Quantity.value))*100)/100) == Math.floor((Math.round((A415 * Number(form.A4Quantity.value))*100)/100))) ? (Math.round((A415 * Number(form.A4Quantity.value))*100)/100) + '.00' : (  ((Math.round((A415 * Number(form.A4Quantity.value))*100)/100)*10 == Math.floor((Math.round((A415 * Number(form.A4Quantity.value))*100)/100)*10)) ? (Math.round((A415 * Number(form.A4Quantity.value))*100)/100) + '0' : (Math.round((A415 * Number(form.A4Quantity.value))*100)/100));
} else if (Number(form.A4Quantity.value) == 20) {
form.A4SubTotal.value = ((Math.round((A420 * Number(form.A4Quantity.value))*100)/100) == Math.floor((Math.round((A420 * Number(form.A4Quantity.value))*100)/100))) ? (Math.round((A420 * Number(form.A4Quantity.value))*100)/100) + '.00' : (  ((Math.round((A420 * Number(form.A4Quantity.value))*100)/100)*10 == Math.floor((Math.round((A420 * Number(form.A4Quantity.value))*100)/100)*10)) ? (Math.round((A420 * Number(form.A4Quantity.value))*100)/100) + '0' : (Math.round((A420 * Number(form.A4Quantity.value))*100)/100));
} else { 
form.A4SubTotal.value = "Quote"; 
}
}
// A5 Sub Total
function calculateA5(form,A5SubTotal) {
if (Number(form.A5Quantity.value) <= 4) {
form.A5SubTotal.value = ((Math.round((A51 * Number(form.A5Quantity.value))*100)/100) == Math.floor((Math.round((A51 * Number(form.A5Quantity.value))*100)/100))) ? (Math.round((A51 * Number(form.A5Quantity.value))*100)/100) + '.00' : (  ((Math.round((A51 * Number(form.A5Quantity.value))*100)/100)*10 == Math.floor((Math.round((A51 * Number(form.A5Quantity.value))*100)/100)*10)) ? (Math.round((A51 * Number(form.A5Quantity.value))*100)/100) + '0' : (Math.round((A51 * Number(form.A5Quantity.value))*100)/100));
} else if (Number(form.A5Quantity.value) <= 9) {
form.A5SubTotal.value = ((Math.round((A55 * Number(form.A5Quantity.value))*100)/100) == Math.floor((Math.round((A55 * Number(form.A5Quantity.value))*100)/100))) ? (Math.round((A55 * Number(form.A5Quantity.value))*100)/100) + '.00' : (  ((Math.round((A55 * Number(form.A5Quantity.value))*100)/100)*10 == Math.floor((Math.round((A55 * Number(form.A5Quantity.value))*100)/100)*10)) ? (Math.round((A55 * Number(form.A5Quantity.value))*100)/100) + '0' : (Math.round((A55 * Number(form.A5Quantity.value))*100)/100));
} else if (Number(form.A5Quantity.value) <= 14) {
form.A5SubTotal.value = ((Math.round((A510 * Number(form.A5Quantity.value))*100)/100) == Math.floor((Math.round((A510 * Number(form.A5Quantity.value))*100)/100))) ? (Math.round((A510 * Number(form.A5Quantity.value))*100)/100) + '.00' : (  ((Math.round((A510 * Number(form.A5Quantity.value))*100)/100)*10 == Math.floor((Math.round((A510 * Number(form.A5Quantity.value))*100)/100)*10)) ? (Math.round((A510 * Number(form.A5Quantity.value))*100)/100) + '0' : (Math.round((A510 * Number(form.A5Quantity.value))*100)/100));
} else if (Number(form.A5Quantity.value) <= 19) {
form.A5SubTotal.value = ((Math.round((A515 * Number(form.A5Quantity.value))*100)/100) == Math.floor((Math.round((A515 * Number(form.A5Quantity.value))*100)/100))) ? (Math.round((A515 * Number(form.A5Quantity.value))*100)/100) + '.00' : (  ((Math.round((A515 * Number(form.A5Quantity.value))*100)/100)*10 == Math.floor((Math.round((A515 * Number(form.A5Quantity.value))*100)/100)*10)) ? (Math.round((A515 * Number(form.A5Quantity.value))*100)/100) + '0' : (Math.round((A515 * Number(form.A5Quantity.value))*100)/100));
} else if (Number(form.A5Quantity.value) == 20) {
form.A5SubTotal.value = ((Math.round((A520 * Number(form.A5Quantity.value))*100)/100) == Math.floor((Math.round((A520 * Number(form.A5Quantity.value))*100)/100))) ? (Math.round((A520 * Number(form.A5Quantity.value))*100)/100) + '.00' : (  ((Math.round((A520 * Number(form.A5Quantity.value))*100)/100)*10 == Math.floor((Math.round((A520 * Number(form.A5Quantity.value))*100)/100)*10)) ? (Math.round((A520 * Number(form.A5Quantity.value))*100)/100) + '0' : (Math.round((A520 * Number(form.A5Quantity.value))*100)/100));
} else { 
form.A5SubTotal.value = "Quote"; 
}
}
// A4 Landscape Sub Total
function calculateA4L(form,A4LSubTotal) {
if (Number(form.A4LQuantity.value) <= 4) {
form.A4LSubTotal.value = ((Math.round((A4L1 * Number(form.A4LQuantity.value))*100)/100) == Math.floor((Math.round((A4L1 * Number(form.A4LQuantity.value))*100)/100))) ? (Math.round((A4L1 * Number(form.A4LQuantity.value))*100)/100) + '.00' : (  ((Math.round((A4L1 * Number(form.A4LQuantity.value))*100)/100)*10 == Math.floor((Math.round((A4L1 * Number(form.A4LQuantity.value))*100)/100)*10)) ? (Math.round((A4L1 * Number(form.A4LQuantity.value))*100)/100) + '0' : (Math.round((A4L1 * Number(form.A4LQuantity.value))*100)/100));
} else if (Number(form.A4LQuantity.value) <= 9) {
form.A4LSubTotal.value = ((Math.round((A4L5 * Number(form.A4LQuantity.value))*100)/100) == Math.floor((Math.round((A4L5 * Number(form.A4LQuantity.value))*100)/100))) ? (Math.round((A4L5 * Number(form.A4LQuantity.value))*100)/100) + '.00' : (  ((Math.round((A4L5 * Number(form.A4LQuantity.value))*100)/100)*10 == Math.floor((Math.round((A4L5 * Number(form.A4LQuantity.value))*100)/100)*10)) ? (Math.round((A4L5 * Number(form.A4LQuantity.value))*100)/100) + '0' : (Math.round((A4L5 * Number(form.A4LQuantity.value))*100)/100));
} else if (Number(form.A4LQuantity.value) <= 14) {
form.A4LSubTotal.value = ((Math.round((A4L10 * Number(form.A4LQuantity.value))*100)/100) == Math.floor((Math.round((A4L10 * Number(form.A4LQuantity.value))*100)/100))) ? (Math.round((A4L10 * Number(form.A4LQuantity.value))*100)/100) + '.00' : (  ((Math.round((A4L10 * Number(form.A4LQuantity.value))*100)/100)*10 == Math.floor((Math.round((A4L10 * Number(form.A4LQuantity.value))*100)/100)*10)) ? (Math.round((A4L10 * Number(form.A4LQuantity.value))*100)/100) + '0' : (Math.round((A4L10 * Number(form.A4LQuantity.value))*100)/100));
} else if (Number(form.A4LQuantity.value) <= 19) {
form.A4LSubTotal.value = ((Math.round((A4L15 * Number(form.A4LQuantity.value))*100)/100) == Math.floor((Math.round((A4L15 * Number(form.A4LQuantity.value))*100)/100))) ? (Math.round((A4L15 * Number(form.A4LQuantity.value))*100)/100) + '.00' : (  ((Math.round((A4L15 * Number(form.A4LQuantity.value))*100)/100)*10 == Math.floor((Math.round((A4L15 * Number(form.A4LQuantity.value))*100)/100)*10)) ? (Math.round((A4L15 * Number(form.A4LQuantity.value))*100)/100) + '0' : (Math.round((A4L15 * Number(form.A4LQuantity.value))*100)/100));
} else if (Number(form.A4LQuantity.value) == 20) {
form.A4LSubTotal.value = ((Math.round((A4L20 * Number(form.A4LQuantity.value))*100)/100) == Math.floor((Math.round((A4L20 * Number(form.A4LQuantity.value))*100)/100))) ? (Math.round((A4L20 * Number(form.A4LQuantity.value))*100)/100) + '.00' : (  ((Math.round((A4L20 * Number(form.A4LQuantity.value))*100)/100)*10 == Math.floor((Math.round((A4L20 * Number(form.A4LQuantity.value))*100)/100)*10)) ? (Math.round((A4L20 * Number(form.A4LQuantity.value))*100)/100) + '0' : (Math.round((A4L20 * Number(form.A4LQuantity.value))*100)/100));
} else { 
form.A4LSubTotal.value = "Quote"; 
}
}
// A5 Landscape Sub Total
function calculateA5L(form,A5LSubTotal) {
if (Number(form.A5LQuantity.value) <= 4) {
form.A5LSubTotal.value = ((Math.round((A5L1 * Number(form.A5LQuantity.value))*100)/100) == Math.floor((Math.round((A5L1 * Number(form.A5LQuantity.value))*100)/100))) ? (Math.round((A5L1 * Number(form.A5LQuantity.value))*100)/100) + '.00' : (  ((Math.round((A5L1 * Number(form.A5LQuantity.value))*100)/100)*10 == Math.floor((Math.round((A5L1 * Number(form.A5LQuantity.value))*100)/100)*10)) ? (Math.round((A5L1 * Number(form.A5LQuantity.value))*100)/100) + '0' : (Math.round((A5L1 * Number(form.A5LQuantity.value))*100)/100));
} else if (Number(form.A5LQuantity.value) <= 9) {
form.A5LSubTotal.value = ((Math.round((A5L5 * Number(form.A5LQuantity.value))*100)/100) == Math.floor((Math.round((A5L5 * Number(form.A5LQuantity.value))*100)/100))) ? (Math.round((A5L5 * Number(form.A5LQuantity.value))*100)/100) + '.00' : (  ((Math.round((A5L5 * Number(form.A5LQuantity.value))*100)/100)*10 == Math.floor((Math.round((A5L5 * Number(form.A5LQuantity.value))*100)/100)*10)) ? (Math.round((A5L5 * Number(form.A5LQuantity.value))*100)/100) + '0' : (Math.round((A5L5 * Number(form.A5LQuantity.value))*100)/100));
} else if (Number(form.A5LQuantity.value) <= 14) {
form.A5LSubTotal.value = ((Math.round((A5L10 * Number(form.A5LQuantity.value))*100)/100) == Math.floor((Math.round((A5L10 * Number(form.A5LQuantity.value))*100)/100))) ? (Math.round((A5L10 * Number(form.A5LQuantity.value))*100)/100) + '.00' : (  ((Math.round((A5L10 * Number(form.A5LQuantity.value))*100)/100)*10 == Math.floor((Math.round((A5L10 * Number(form.A5LQuantity.value))*100)/100)*10)) ? (Math.round((A5L10 * Number(form.A5LQuantity.value))*100)/100) + '0' : (Math.round((A5L10 * Number(form.A5LQuantity.value))*100)/100));
} else if (Number(form.A5LQuantity.value) <= 19) {
form.A5LSubTotal.value = ((Math.round((A5L15 * Number(form.A5LQuantity.value))*100)/100) == Math.floor((Math.round((A5L15 * Number(form.A5LQuantity.value))*100)/100))) ? (Math.round((A5L15 * Number(form.A5LQuantity.value))*100)/100) + '.00' : (  ((Math.round((A5L15 * Number(form.A5LQuantity.value))*100)/100)*10 == Math.floor((Math.round((A5L15 * Number(form.A5LQuantity.value))*100)/100)*10)) ? (Math.round((A5L15 * Number(form.A5LQuantity.value))*100)/100) + '0' : (Math.round((A5L15 * Number(form.A5LQuantity.value))*100)/100));
} else if (Number(form.A5LQuantity.value) == 20) {
form.A5LSubTotal.value = ((Math.round((A5L20 * Number(form.A5LQuantity.value))*100)/100) == Math.floor((Math.round((A5L20 * Number(form.A5LQuantity.value))*100)/100))) ? (Math.round((A5L20 * Number(form.A5LQuantity.value))*100)/100) + '.00' : (  ((Math.round((A5L20 * Number(form.A5LQuantity.value))*100)/100)*10 == Math.floor((Math.round((A5L20 * Number(form.A5LQuantity.value))*100)/100)*10)) ? (Math.round((A5L20 * Number(form.A5LQuantity.value))*100)/100) + '0' : (Math.round((A5L20 * Number(form.A5LQuantity.value))*100)/100));
} else { 
form.A5LSubTotal.value = "Quote"; 
}
}
// Desk Sub Total
function calculateDesk(form,DeskSubTotal) {
if (Number(form.DeskQuantity.value) <= 4) {
form.DeskSubTotal.value = ((Math.round((D1 * Number(form.DeskQuantity.value))*100)/100) == Math.floor((Math.round((D1 * Number(form.DeskQuantity.value))*100)/100))) ? (Math.round((D1 * Number(form.DeskQuantity.value))*100)/100) + '.00' : (  ((Math.round((D1 * Number(form.DeskQuantity.value))*100)/100)*10 == Math.floor((Math.round((D1 * Number(form.DeskQuantity.value))*100)/100)*10)) ? (Math.round((D1 * Number(form.DeskQuantity.value))*100)/100) + '0' : (Math.round((D1 * Number(form.DeskQuantity.value))*100)/100));
} else if (Number(form.DeskQuantity.value) <= 9) {
form.DeskSubTotal.value = ((Math.round((D5 * Number(form.DeskQuantity.value))*100)/100) == Math.floor((Math.round((D5 * Number(form.DeskQuantity.value))*100)/100))) ? (Math.round((D5 * Number(form.DeskQuantity.value))*100)/100) + '.00' : (  ((Math.round((D5 * Number(form.DeskQuantity.value))*100)/100)*10 == Math.floor((Math.round((D5 * Number(form.DeskQuantity.value))*100)/100)*10)) ? (Math.round((D5 * Number(form.DeskQuantity.value))*100)/100) + '0' : (Math.round((D5 * Number(form.DeskQuantity.value))*100)/100));
} else if (Number(form.DeskQuantity.value) <= 14) {
form.DeskSubTotal.value = ((Math.round((D10 * Number(form.DeskQuantity.value))*100)/100) == Math.floor((Math.round((D10 * Number(form.DeskQuantity.value))*100)/100))) ? (Math.round((D10 * Number(form.DeskQuantity.value))*100)/100) + '.00' : (  ((Math.round((D10 * Number(form.DeskQuantity.value))*100)/100)*10 == Math.floor((Math.round((D10 * Number(form.DeskQuantity.value))*100)/100)*10)) ? (Math.round((D10 * Number(form.DeskQuantity.value))*100)/100) + '0' : (Math.round((D10 * Number(form.DeskQuantity.value))*100)/100));
} else if (Number(form.DeskQuantity.value) <= 19) {
form.DeskSubTotal.value = ((Math.round((D15 * Number(form.DeskQuantity.value))*100)/100) == Math.floor((Math.round((D15 * Number(form.DeskQuantity.value))*100)/100))) ? (Math.round((D15 * Number(form.DeskQuantity.value))*100)/100) + '.00' : (  ((Math.round((D15 * Number(form.DeskQuantity.value))*100)/100)*10 == Math.floor((Math.round((D15 * Number(form.DeskQuantity.value))*100)/100)*10)) ? (Math.round((D15 * Number(form.DeskQuantity.value))*100)/100) + '0' : (Math.round((D15 * Number(form.DeskQuantity.value))*100)/100));
} else if (Number(form.DeskQuantity.value) == 20) {
form.DeskSubTotal.value = ((Math.round((D20 * Number(form.DeskQuantity.value))*100)/100) == Math.floor((Math.round((D20 * Number(form.DeskQuantity.value))*100)/100))) ? (Math.round((D20 * Number(form.DeskQuantity.value))*100)/100) + '.00' : (  ((Math.round((D20 * Number(form.DeskQuantity.value))*100)/100)*10 == Math.floor((Math.round((D20 * Number(form.DeskQuantity.value))*100)/100)*10)) ? (Math.round((D20 * Number(form.DeskQuantity.value))*100)/100) + '0' : (Math.round((D20 * Number(form.DeskQuantity.value))*100)/100));
} else { 
form.DeskSubTotal.value = "Quote"; 
}
}
// A4 Landscape Saddle Stitched Sub Total
function calculateA4LSS(form,A4LSSSubTotal) {
if (Number(form.A4LSSQuantity.value) <= 0) {
form.A4LSSSubTotal.value = 0;
} else if (Number(form.A4LSSQuantity.value) <= 22) {
form.A4LSSSubTotal.value = "Quote";
}
}
// Calculate the entire Total
function compute(form,theTotal) {
var tot = (Number(form.A3SubTotal.value)) + (Number(form.A4SubTotal.value)) + (Number(form.A5SubTotal.value)) + (Number(form.A4LSubTotal.value)) + (Number(form.A5LSubTotal.value)) + (Number(form.DeskSubTotal.value)) + (Number(form.A4LSSSubTotal.value));
// Check that none of values is 'Quote' (Not-a-Number) - which means the total must be 'Quote'...
if (isNaN(tot)) {
form.theTotal.value = "Quote";
// Otherwise it's a number and we should round down, then add any trailing zeroes...
} else {
tot = (Math.round(tot*100))/100;
form.theTotal.value = (tot == Math.floor(tot)) ? tot + '.00' : (  (tot*10 == Math.floor(tot*10)) ? tot + '0' : tot);
}
}