

var locked = false;


function enableAll() {
	for(i=0; i<document.estiForm.elements.length; i++) {
		if (document.estiForm.elements[i].disabled==true) {
			document.estiForm.elements[i].disabled=false;
		}
	}
}

function varDataMailAlert() {
	if (document.estiForm.mailing && document.estiForm.mailQuant.value > 0) {
		if (document.estiForm.purchMailListQty && (parseInt(document.estiForm.mailQuant.value) > parseInt(document.estiForm.purchMailListQty.value))) {
			alert("Please send the additional names for your mailing list as an email attachment to csr@greenerprinter.com, with your order name in the subject line.");
			return;
		}
		else if (document.estiForm.purchMailListQty && (parseInt(document.estiForm.mailQuant.value) == parseInt(document.estiForm.purchMailListQty.value))) {
			return;
		}
		else {
			alert("You have chosen to mail some or all of your pieces. Please send your list as an email attachment to csr@greenerprinter.com, with your order name in the subject line.");
			return;
		}
	}
}


function printedEnvReminder() {
	if (document.estiForm.greetingCardEnvelopes  && document.estiForm.greetingCardEnvelopes.options 
		&& document.estiForm.greetingCardEnvelopes.options[document.estiForm.greetingCardEnvelopes.selectedIndex].value == "Printed - Return Address, Black Ink") {
		alert("Make sure you supply artwork for your printed envelopes!");
		return;
	}
}
	

function envelopeSizeAlert() {
	if (((document.estiForm.blankEnvelopes && document.estiForm.blankEnvelopes.options && 
		  document.estiForm.blankEnvelopes.options[document.estiForm.blankEnvelopes.selectedIndex].value != "no") || 
		  (document.estiForm.konlyEnvelopes && document.estiForm.konlyEnvelopes.options && 
		  document.estiForm.konlyEnvelopes.options[document.estiForm.konlyEnvelopes.selectedIndex].value != "no")) &&
		  ((document.estiForm.blankEnvelopesSize.options[document.estiForm.blankEnvelopesSize.selectedIndex].value == "") || 
		  (document.estiForm.blankEnvelopesSize.options[document.estiForm.blankEnvelopesSize.selectedIndex].value == "no"))) {
			alert("Please select an envelope size.");
			return;
		}
	if (((document.estiForm.blankEnvelopes && document.estiForm.blankEnvelopes.options && 
		  document.estiForm.blankEnvelopes.options[document.estiForm.blankEnvelopes.selectedIndex].value == "no") && 
		  (document.estiForm.konlyEnvelopes && document.estiForm.konlyEnvelopes.options && 
		  document.estiForm.konlyEnvelopes.options[document.estiForm.konlyEnvelopes.selectedIndex].value == "no")) &&
		  (document.estiForm.blankEnvelopesSize.options[document.estiForm.blankEnvelopesSize.selectedIndex].value != "no")) {
			alert("Please choose an envelope quantity or set Envelope Size to 'none'.");
			return;
		}

}

function showPaperDetails(select_object) {
	if (select_object.selectedIndex==0) {
		setVisibilityAndPosition('paper_div_eco', 100, -160);
		select_object.selectedIndex=1;
	}
}



function setQuant() {
	
	if (document.estiForm.quantity.value <= 0 || document.estiForm.quantity.value=="") {
		//document.estiForm.quantity.value=1;
		document.estiForm.realquant.value=0;
		return 0;
	}
	document.estiForm.realquant.value=document.estiForm.quantity.value;
	return 1;	
}

function checkStationeryQuant() {
	if (document.estiForm.productFamily && document.estiForm.productFamily.value == "Stationery-Business Cards") {
		if (document.estiForm.stationeryBizCardQuantity.value == "0") {
			document.estiForm.cardQuant1.selectedIndex = "1";
			stationerySmartQuantitySum(); 
			calculateStationery();			
			alert('Minimum quantity: 500');
		}
		else {
		proofWarning();
		}	
	}
	if (document.estiForm.productFamily && document.estiForm.productFamily.value == "Stationery-Envelopes") {
		if (document.estiForm.stationeryEnvelopes.value == "0") {
			document.estiForm.stationeryEnvelopes.selectedIndex = "1";
			calculateStationery(); 
			inspect(this);			
			alert('Minimum quantity: 500');
		}
		else {
		proofWarning();
		}	
	}
	if (document.estiForm.productFamily && document.estiForm.productFamily.value == "Stationery-Letterhead") {
		if (document.estiForm.stationeryLetterhead.value == "0") {
			document.estiForm.stationeryLetterhead.selectedIndex = "1";
			calculateStationery(); 
			inspect(this);			
			alert('Minimum quantity of printed letterhead: 500');
		}
		else {
		proofWarning();
		}	
	}
	if (document.estiForm.productFamily && document.estiForm.productFamily.value == "Stationery-Package") {
		if (document.estiForm.stationeryBizCardQuantity.value == "0" && document.estiForm.stationeryEnvelopes.value == "0" && document.estiForm.stationeryLetterhead.value == "0") {
			alert('Please select a quantity for one or more printed items.');
		}
		else {
		proofWarning();
		}	
	}
}
			
function checkPackageQuant() {
	if (document.customQuoteForm.quantity.value < 1000) {
		alert('The minimum quantity for custom package orders is 1,000. Please increase your quantity and re-submit.');
	    document.customQuoteForm.quantity.focus();		
	}
	else {
		prepareSubmit();
	}	
}

function setStationeryQuant() {
	if (document.estiForm.stationeryLetterhead.options && document.estiForm.stationeryLetterheadBlank.options && document.estiForm.stationeryEnvelopes.options) {
		document.estiForm.quantity.value = (parseInt(document.estiForm.stationeryLetterhead.options[document.estiForm.stationeryLetterhead.selectedIndex].value) +
		parseInt(document.estiForm.stationeryLetterheadBlank.options[document.estiForm.stationeryLetterheadBlank.selectedIndex].value) +
		parseInt(document.estiForm.stationeryEnvelopes.options[document.estiForm.stationeryEnvelopes.selectedIndex].value) +	
		parseInt(document.estiForm.stationeryBizCardQuantity.value));
	}

	else if (document.estiForm.stationeryLetterhead.options && document.estiForm.stationeryLetterheadBlank.options) {
		//this is for 2-color letterhead ONLY
		document.estiForm.quantity.value = (parseInt(document.estiForm.stationeryLetterhead.options[document.estiForm.stationeryLetterhead.selectedIndex].value) +
		parseInt(document.estiForm.stationeryLetterheadBlank.options[document.estiForm.stationeryLetterheadBlank.selectedIndex].value));
	}

	else if (document.estiForm.stationeryEnvelopes.options) {
		//this is for 2-color envelopes ONLY
		document.estiForm.quantity.value = (parseInt(document.estiForm.stationeryEnvelopes.options[document.estiForm.stationeryEnvelopes.selectedIndex].value));
	}

	else {
		//this is for 2-color business cards ONLY
		document.estiForm.quantity.value = 	parseInt(document.estiForm.stationeryBizCardQuantity.value);
	}
		
	if (document.estiForm.quantity.value <= 0 || document.estiForm.quantity.value=="") {
		//document.estiForm.quantity.value=1;
		document.estiForm.realquant.value=0;
		updateText("myTp", "0.00");
		updateText("myTp2", "0.00");
		return 0;
	}
	document.estiForm.realquant.value=document.estiForm.quantity.value;
	//alert(document.estiForm.realquant.value);
	return 1;
}


function checkQuant() {	
	if (document.estiForm.productFamily.value != "Booklet" && document.estiForm.productFamily.value != "Catalog" && document.estiForm.productFamily.value != "Calendar" && document.estiForm.productFamily.value != "DLCalendar" && document.estiForm.productFamily.value != "DLPhotobook" && document.estiForm.productFamily.value != "HouseCalendar") {
		if (document.estiForm.quantity.value < 50){
			document.estiForm.quantity.value=50;
			alert('Minimum quantity: 50');
				if (document.estiForm.productFamily.value=="Folder" || document.estiForm.productFamily.value=="Folder 4x9" || document.estiForm.productFamily.value=="CD Sleeve 5x5" || document.estiForm.productFamily.value=="Doorhanger" || document.estiForm.productFamily.value=="3 Panel Folder")
					calculate_folder();
				else
					calculate();		
		}
	}
	if (document.estiForm.productFamily.value=="Booklet" || document.estiForm.productFamily.value=="Catalog" || document.estiForm.productFamily.value=="Calendar") {
		if (document.estiForm.quantityTemp.value == -1 && document.estiForm.quantity.value < 201){
			document.estiForm.quantity.value=250;
			alert('For quantities of 200 or less, please use the drop-down menu and select 25, 50, 100, 150 or 200');
					calculate_multi();
		}
	}
	if (document.estiForm.productFamily.value=="DLCalendar" || document.estiForm.productFamily.value=="DLPhotobook" || document.estiForm.productFamily.value == "HouseCalendar") {
		if (document.estiForm.quantity.value < 1){
			document.estiForm.quantity.value=1;
			alert('Please select at least 1 for quantity!');
				if (document.estiForm.productFamily.value=="DLCalendar")
					calculate_DLCalendar();
				if (document.estiForm.productFamily.value=="DLPhotobook")
					calculate_DLPhotobook();				
		}
	}
	if (document.estiForm.productFamily.value == "4cLetterhead" && document.estiForm.quantity.value < 1000){
		document.estiForm.quantity.value=1000;
		alert('Sorry, due to production constraints, minimum quantity for 4-color letterhead is 1,000. For smaller orders, we suggest 2-color letterhead, which can be run on our smaller press.');
		calculate();
	}
	
	if (document.estiForm.productFamily.value != "Booklet" && document.estiForm.productFamily.value != "Catalog" && document.estiForm.productFamily.value != "Calendar" && document.estiForm.quantity.value > 30000) {
		document.estiForm.quantity.value=30000;
		alert('Maximum quantity: 30000. For higher quantities please request a custom estimate!');
			if (document.estiForm.productFamily.value=="Folder" || document.estiForm.productFamily.value=="Folder 4x9" || document.estiForm.productFamily.value=="CD Sleeve 5x5" || document.estiForm.productFamily.value=="Doorhanger" || document.estiForm.productFamily.value=="3 Panel Folder")
				calculate_folder();
			else
				calculate();		
	}
	
	if (document.estiForm.quantity.value > 20000 && (document.estiForm.productFamily.value=="Booklet" || document.estiForm.productFamily.value=="Catalog" || document.estiForm.productFamily.value=="Calendar")) {
		document.estiForm.quantity.value=20000;
		alert('Maximum quantity: 20000. For higher quantities please request a custom estimate!');
		calculate_multi();		
	}
}


function checkNameQuant() {
	if ((document.estiForm.cardName2.value != "" || document.estiForm.cardName3.value != "" || document.estiForm.cardName4.value != "" || document.estiForm.cardName5.value != "" || document.estiForm.cardName6.value != "" || document.estiForm.cardName7.value != "" || document.estiForm.cardName8.value != "") && document.estiForm.cardName1.value == "" && document.estiForm.cardQuant1.value != 0){
		alert('Please enter a name for card 1');
	    document.estiForm.cardName1.focus();
		return 0;
	}
	if (document.getElementById('bc_name_two').style.display == 'block' && document.estiForm.cardQuant2.value > 0 && document.estiForm.cardName2.value == ""){
		alert('Please enter a name for card 2');
	    document.estiForm.cardName2.focus();
		return 0;
	}
	
	if (document.getElementById('bc_name_three').style.display == 'block' && document.estiForm.cardQuant3.value > 0 && document.estiForm.cardName3.value == ""){
		alert('Please enter a name for card 3');
	    document.estiForm.cardName3.focus();
		return 0;
		}

	if (document.getElementById('bc_name_four').style.display == 'block' && document.estiForm.cardQuant4.value > 0 && document.estiForm.cardName4.value == ""){
		alert('Please enter a name for card 4');
	    document.estiForm.cardName4.focus();
		return 0;
		}

	if (document.getElementById('bc_name_five').style.display == 'block' && document.estiForm.cardQuant5.value > 0 && document.estiForm.cardName5.value == ""){
		alert('Please enter a name for card 5');
	    document.estiForm.cardName5.focus();
		return 0;
		}

	if (document.getElementById('bc_name_six').style.display == 'block' && document.estiForm.cardQuant6.value > 0 && document.estiForm.cardName6.value == ""){
		alert('Please enter a name for card 6');
	    document.estiForm.cardName6.focus();
		return 0;
		}

	if (document.getElementById('bc_name_seven').style.display == 'block' && document.estiForm.cardQuant7.value > 0 && document.estiForm.cardName7.value == ""){
		alert('Please enter a name for card 7');
	    document.estiForm.cardName7.focus();
		return 0;
		}

	if (document.getElementById('bc_name_eight').style.display == 'block' && document.estiForm.cardQuant8.value > 0 && document.estiForm.cardName8.value == ""){
		alert('Please enter a name for card 8');
	    document.estiForm.cardName8.focus();
		return 0;
		}

	if (document.estiForm.cardName1.value != "" && document.estiForm.cardQuant1.value < 250){
		alert('Please enter a quantity for Name 1');
		return 0;
	}

	if (document.getElementById('bc_name_two').style.display == 'block' && document.estiForm.cardName2.value != "" && document.estiForm.cardQuant2.value < 250){
		alert('Please enter a quantity for Name 2');
		return 0;
	}
	
	if (document.getElementById('bc_name_three').style.display == 'block' && document.estiForm.cardName3.value != "" && document.estiForm.cardQuant3.value < 250){
		alert('Please enter a quantity for Name 3');
		return 0;
	}
	
	if (document.getElementById('bc_name_four').style.display == 'block' && document.estiForm.cardName4.value != "" && document.estiForm.cardQuant4.value < 250){
		alert('Please enter a quantity for Name 4');
		return 0;
	}

	if (document.getElementById('bc_name_five').style.display == 'block' && document.estiForm.cardName5.value != "" && document.estiForm.cardQuant5.value < 250){
		alert('Please enter a quantity for Name 5');
		return 0;
	}

	if (document.getElementById('bc_name_six').style.display == 'block' && document.estiForm.cardName6.value != "" && document.estiForm.cardQuant6.value < 250){
		alert('Please enter a quantity for Name 6');
		return 0;
	}
	
	if (document.getElementById('bc_name_seven').style.display == 'block' && document.estiForm.cardName7.value != "" && document.estiForm.cardQuant7.value < 250){
		alert('Please enter a quantity for Name 7');
		return 0;
	}
	
	if (document.getElementById('bc_name_eight').style.display == 'block' && document.estiForm.cardName8.value != "" && document.estiForm.cardQuant8.value < 250){
		alert('Please enter a quantity for Name 8');
		return 0;
	}

	if (document.estiForm.quantity.value < 250){
		alert('Please select a quantity for at least one name. Quantities are available in increments of 250');
		return 0;
	}
	enableAll();	
	document.estiForm.submit();
}

function checkStationeryNameQuant() {
	//alert('checking bizcard names');
	if ((document.estiForm.cardName2.value != "" || document.estiForm.cardName3.value != "" || document.estiForm.cardName4.value != "" || document.estiForm.cardName5.value != "" || document.estiForm.cardName6.value != "" || document.estiForm.cardName7.value != "" || document.estiForm.cardName8.value != "") && document.estiForm.cardName1.value == "" && document.estiForm.cardQuant1.value != 0){
		alert('Please enter a name for card 1');
	    document.estiForm.cardName1.focus();
		return 0;
	}
	if (document.getElementById('bc_name_two').style.display == 'block' && document.estiForm.cardQuant2.value > 0 && document.estiForm.cardName2.value == ""){
		alert('Please enter a name for card 2');
	    document.estiForm.cardName2.focus();
		return 0;
	}
	
	if (document.getElementById('bc_name_three').style.display == 'block' && document.estiForm.cardQuant3.value > 0 && document.estiForm.cardName3.value == ""){
		alert('Please enter a name for card 3');
	    document.estiForm.cardName3.focus();
		return 0;
		}

	if (document.getElementById('bc_name_four').style.display == 'block' && document.estiForm.cardQuant4.value > 0 && document.estiForm.cardName4.value == ""){
		alert('Please enter a name for card 4');
	    document.estiForm.cardName4.focus();
		return 0;
		}

	if (document.getElementById('bc_name_five').style.display == 'block' && document.estiForm.cardQuant5.value > 0 && document.estiForm.cardName5.value == ""){
		alert('Please enter a name for card 5');
	    document.estiForm.cardName5.focus();
		return 0;
		}

	if (document.getElementById('bc_name_six').style.display == 'block' && document.estiForm.cardQuant6.value > 0 && document.estiForm.cardName6.value == ""){
		alert('Please enter a name for card 6');
	    document.estiForm.cardName6.focus();
		return 0;
		}

	if (document.getElementById('bc_name_seven').style.display == 'block' && document.estiForm.cardQuant7.value > 0 && document.estiForm.cardName7.value == ""){
		alert('Please enter a name for card 7');
	    document.estiForm.cardName7.focus();
		return 0;
		}

	if (document.getElementById('bc_name_eight').style.display == 'block' && document.estiForm.cardQuant8.value > 0 && document.estiForm.cardName8.value == ""){
		alert('Please enter a name for card 8');
	    document.estiForm.cardName8.focus();
		return 0;
		}

	if (document.estiForm.cardName1.value != "" && document.estiForm.cardQuant1.value < 500){
		alert('Please enter a quantity for Name 1');
		return 0;
	}

	if (document.estiForm.cardName2.value != "" && document.estiForm.cardQuant2.value < 500){
		alert('Please enter a quantity for Name 2');
		return 0;
	}
	
	if (document.estiForm.cardName3.value != "" && document.estiForm.cardQuant3.value < 500){
		alert('Please enter a quantity for Name 3');
		return 0;
	}
	
	if (document.estiForm.cardName4.value != "" && document.estiForm.cardQuant4.value < 500){
		alert('Please enter a quantity for Name 4');
		return 0;
	}

	if (document.estiForm.cardName5.value != "" && document.estiForm.cardQuant5.value < 500){
		alert('Please enter a quantity for Name 5');
		return 0;
	}

	if (document.estiForm.cardName6.value != "" && document.estiForm.cardQuant6.value < 500){
		alert('Please enter a quantity for Name 6');
		return 0;
	}
	
	if (document.estiForm.cardName7.value != "" && document.estiForm.cardQuant7.value < 500){
		alert('Please enter a quantity for Name 7');
		return 0;
	}
	
	if (document.estiForm.cardName8.value != "" && document.estiForm.cardQuant8.value < 500){
		alert('Please enter a quantity for Name 8');
		return 0;
	}
	
		if (document.estiForm.cardQuant5.value == 0 && (document.estiForm.cardQuant6.value != 0 || document.estiForm.cardQuant7.value != 0 || document.estiForm.cardQuant8.value != 0)){
		alert('Our site requires that you enter names and quantities sequentially, beginning with Name 1, leaving no "blank" fields between names and quantities. Thank-you!');
		return 0;
	}
	
	enableAll();	
	document.estiForm.submit();
}


function checkCardBoxQuant() {
	if (document.estiForm.greetingCardBoxes && document.estiForm.greetingCardBoxes != null && document.estiForm.greetingCardBoxes.value > 1000) {
		alert("If you need more than 1,000 boxes, please submit a custom quote!");
		document.estiForm.greetingCardBoxes.value = 1000;
	}
}

function redirect() {
	if (document.estiForm.doc_type) {
		if (document.estiForm.doc_type.options[document.estiForm.doc_type.selectedIndex].value == "promotional")  {
			document.location.href="/grp/index.jsp";
		}
		if (document.estiForm.doc_type.options[document.estiForm.doc_type.selectedIndex].value == "identity")  {
			document.location.href="/grp/sp2.jsp";
		}
		if (document.estiForm.doc_type.options[document.estiForm.doc_type.selectedIndex].value == "cards")  {
			document.location.href="/grp/sp1.jsp";
		}
		if (document.estiForm.doc_type.options[document.estiForm.doc_type.selectedIndex].value == "oversize")  {
			document.location.href="/grp/sp3.jsp";
		}		
		if (document.estiForm.doc_type.options[document.estiForm.doc_type.selectedIndex].value == "multi")  {
			document.location.href="/grp/multi.jsp";
		}
	}
}

function checkDependencies() {
	if (document.estiForm.coverColors.options) {
		if (document.estiForm.coverColors.options[document.estiForm.coverColors.options.selectedIndex].value == "NoCover") {
			document.estiForm.coverPaper.disabled = true;
		}
		if (document.estiForm.coverColors.options[document.estiForm.coverColors.options.selectedIndex].value != "NoCover") {
			document.estiForm.coverPaper.disabled = false;
		}
	}
	else {
		if (document.estiForm.coverColors.value == "NoCover") {
			document.estiForm.coverPaper.disabled = true;
		}
		if (document.estiForm.coverColors.value != "NoCover") {
			document.estiForm.coverPaper.disabled = false;
		}
	}
	
	if (document.estiForm.multi) {	
		/* reset the hidden form vars (specific to multi-page docs)
		   to make accurate entries in estimate dbase */
		document.estiForm.tsi_cover.value="";
		document.estiForm.coverPapercharge.value="";
		document.estiForm.coverPresscharge.value="";
		document.estiForm.insideQuantity.value="";
		document.estiForm.presscharge1.value="";
		document.estiForm.presscharge2.value="";
		document.estiForm.presscharge3.value="";
		document.estiForm.booklet.value="";
		document.estiForm.rush.value="";
	}

}

function calcEmboss() {
	var embossCharge = 0;
	if (document.estiForm.emboss && document.estiForm.emboss.value !== "no") {
		embossCharge += 120;
	}
	if (document.estiForm.embossCharge) {
		document.estiForm.embossCharge.value = "$" + embossCharge;
	}
	return embossCharge;
}

function calcFoilstamp() {
	var foilstampCharge = 0;
	if (document.estiForm.foilstamp && document.estiForm.foilstamp.value !== "no") {
		foilstampCharge += 150;
	}
	if (document.estiForm.foilstampCharge) {
		document.estiForm.foilstampCharge.value = "$" + foilstampCharge;
	}
	return foilstampCharge;
}

function pausecomp(Amount) {
	
	d = new Date() //today's date
	while (1) {
		mill=new Date() // Date Now
		diff = mill-d //difference in milliseconds
		if( diff > Amount ) {
			break;
		}
	}
}

function calcGrid() {
	
	document.estiForm.pricegrid.value="";

	//for 250
	document.estiForm.quantity.value=250;
	calculate_postcard();
	document.estiForm.pricegrid.value=(document.estiForm.tp.value);
	
	//for 500
	document.estiForm.quantity.value=500;
	calculate_postcard();
	document.estiForm.pricegrid.value=(document.estiForm.pricegrid.value + "\n" + document.estiForm.tp.value);
		
	for (i=1000; i<=5000; i=(i+1000)) {
		document.estiForm.quantity.value=i;
		calculate_postcard();
		document.estiForm.pricegrid.value=(document.estiForm.pricegrid.value + "\n" + document.estiForm.tp.value);
	}
	
	//for 10000
	document.estiForm.quantity.value=10000;
	calculate_postcard();
	document.estiForm.pricegrid.value=(document.estiForm.pricegrid.value + "\n" + document.estiForm.tp.value);

	//for 20000
	document.estiForm.quantity.value=20000;
	calculate_postcard();
	document.estiForm.pricegrid.value=(document.estiForm.pricegrid.value + "\n" + document.estiForm.tp.value);
	
}

function calcGridStandard() {
	document.estiForm.pricegrid.value="";	
	
	//for 250
	//document.estiForm.quantity.value=250;
	//calculate();
	//document.estiForm.pricegrid.value=(document.estiForm.tp.value);
	
	//for 500
	document.estiForm.quantity.value=500;
	calculate();
	document.estiForm.pricegrid.value=(document.estiForm.pricegrid.value + "\n" + document.estiForm.tp.value);

	for (i=1000; i<=5000; i=(i+1000)) {
		document.estiForm.quantity.value=i;
		calculate();
		document.estiForm.pricegrid.value=(document.estiForm.pricegrid.value + "\n" + document.estiForm.tp.value);
		//put an extra space after the quant 1000 and 2000
		if (i==1000 || i==2000) document.estiForm.pricegrid.value=(document.estiForm.pricegrid.value + "\n");
	}
	
	//for 8000
	document.estiForm.quantity.value=8000;
	calculate();
	document.estiForm.pricegrid.value=(document.estiForm.pricegrid.value + "\n" + document.estiForm.tp.value);
	
	//for 10000
	document.estiForm.quantity.value=10000;
	calculate();
	document.estiForm.pricegrid.value=(document.estiForm.pricegrid.value + "\n" + document.estiForm.tp.value);

	//for 20000
	document.estiForm.quantity.value=20000;
	calculate();
	document.estiForm.pricegrid.value=(document.estiForm.pricegrid.value + "\n" + document.estiForm.tp.value);
	
	//for 30000
	document.estiForm.quantity.value=30000;
	calculate();
	document.estiForm.pricegrid.value=(document.estiForm.pricegrid.value + "\n" + document.estiForm.tp.value);
	
	//for 40000
	document.estiForm.quantity.value=40000;
	calculate();
	document.estiForm.pricegrid.value=(document.estiForm.pricegrid.value + "\n" + document.estiForm.tp.value);
	
	//for 50000
	document.estiForm.quantity.value=50000;
	calculate();
	document.estiForm.pricegrid.value=(document.estiForm.pricegrid.value + "\n" + document.estiForm.tp.value);
	
}

function calculate_multi(mode) {
	// Remove non-numeric characters
	document.estiForm.quantity.value = document.estiForm.quantity.value.replace(/\D/g, "");

	if (setQuant() <= 0 && document.estiForm.tp) {
		document.estiForm.tp.value=formatCurrency(0);
		document.estiForm.ppu.value=formatCurrency(0);
		return true;
	}
	else if (setQuant() <= 0) {
		updatePrice("tp", formatCurrency(0), 0, document.estiForm.quantity.value);
		updatePrice("ppu", formatCurrency(0), 0, document.estiForm.quantity.value);
		return true;
	}
	
	checkDependencies();
	//square inches, height, width
	if (document.estiForm.finalHeight.options) {
		height = document.estiForm.finalHeight.options[document.estiForm.finalHeight.selectedIndex].value;
		width = document.estiForm.finalWidth.options[document.estiForm.finalWidth.selectedIndex].value;
	}
	else {
		height = document.estiForm.finalHeight.value;
		width = document.estiForm.finalWidth.value;
	}
	quantity = document.estiForm.realquant.value;
	inside_pages = (parseInt(document.estiForm.pages.value));
	total_pages = (parseInt(document.estiForm.pages.value) + 4);
	productFamily = document.estiForm.productFamily.value;

		
	var finalHeight = document.estiForm.finalHeight.value;
	var finalWidth = document.estiForm.finalWidth.value;


	inside_quantity = ( (quantity * inside_pages) / 4);	
	inside_sheets = (inside_quantity / quantity);

	//put inside_quantity to hidden html form object to be used for shipping weight/cost calculations
	document.estiForm.insideQuantity.value = inside_quantity;
	//alert("Pages: " + document.estiForm.pages.value + ". Inside Quantity: " + document.estiForm.insideQuantity.value);
	//square inches for one unfolded sheet of booklet
	si = (height * width * 2);
	
	//square inches of all inside pages per booklet 
	inside_si = (si * inside_sheets);
	
	//total square inches for cover
	tsi_cover = (si * quantity);
	
	//total square inches for inside pages
	tsi = (si * inside_quantity);
	
	/*alert ("quantity: " + quantity + "\n" +
			"inside quantity: " + inside_quantity + "\n" + 
			"inside_sheets: " + inside_sheets + "\n" +
			"square inches, unfolded: " + si + "\n" + 
			"square inches of all inside pages per booklet: " + inside_si + "\n" +
			"total square inches for cover: " + tsi_cover + "\n" + 
			"total square inches for inside pages: " + tsi);*/

	if (document.estiForm.mailing && document.estiForm.mailQuant.value > 0) {
		checkMailDependencies(productFamily, quantity, document.estiForm.mailQuant.value);
	}
	
	if (document.estiForm.mailing) {
		var mailRate = document.estiForm.mailing.options[document.estiForm.mailing.selectedIndex].value;
		var mailQuant = document.estiForm.mailQuant.value;
		if (document.estiForm.mailing.options[document.estiForm.mailing.selectedIndex].value != "no" && mailQuant > 0) {
			var weightPerUnit = getUnitWeightOnces((tsi + tsi_cover), quantity);
			if (document.estiForm.weightPerUnit) document.estiForm.weightPerUnit.value=weightPerUnit;
			var mailPostage = (calcPostage(productFamily, (finalHeight*finalWidth), weightPerUnit, mailQuant, mailRate))?calcPostage(productFamily, (finalHeight*finalWidth), weightPerUnit, mailQuant, mailRate):0;
			var mailLabor = (calcMailLabor(si, weightPerUnit, mailQuant, mailRate))?calcMailLabor(si, weightPerUnit, mailQuant, mailRate):0;
			//alert("unitWeight:" + weightPerUnit + "\nmailPostage:" + mailPostage + "\nmailLabor:" + mailLabor);
			
			var totalMailingCost = (mailPostage + mailLabor);
			//updateText("mailCostTop", formatCurrency2(totalMailingCost));
			updateText("myMailCost", formatCurrency2(totalMailingCost));
			totalMailingCost = Math.round(totalMailingCost); //round it to the nearest buck
			document.estiForm.mailCost.value = formatAsMoney(totalMailingCost); //then add two zero's to the end
			var shipQuant = (quantity - mailQuant);
			updateText("myShipQuant", shipQuant);
			document.estiForm.shipQuant.value = shipQuant;
		}
		else {
			var totalMailingCost = 0;
			//updateText("mailCostTop", formatCurrency2(totalMailingCost));
			updateText("myMailCost", formatCurrency2(totalMailingCost));
			updateText("myShipQuant", quantity);
			document.estiForm.shipQuant.value = quantity;
			document.estiForm.mailCost.value = "0.00";
		}
	}
	else {
		if (document.estiForm.shipQuant) document.estiForm.shipQuant.value = quantity;
		if (document.estiForm.mailCost) document.estiForm.mailCost.value = "0.00";
	}
	
	
	if (total_pages == "8") {
		if (quantity == "25")
			tp=275;		
		else if (quantity == "50")
			tp=357.50;
		else if (quantity == "100")
			tp=412.50;
		else if (quantity == "150")
			tp=550;
		else if (quantity == "200")
			tp=616;		
		else if (quantity < 5000) {
			tp=calc8pager();
		}
		else {
			tp=( calc8pager() * 1.1);
		}
	}

	if (total_pages == "12") {
		if (quantity == "25")
			tp=315.7;		
		else if (quantity == "50")
			tp=429;
		else if (quantity == "100")
			tp=522.5;
		else if (quantity == "150")
			tp=687.5;
		else if (quantity == "200")
			tp=775.5;		
		else if (quantity <= 1000) {
			tp=(calc12pager() * 1.03);
		}
		else if (quantity <= 2000) {
			tp=(calc12pager() * 1.13);
		}
		else if (quantity <= 10000) {
			tp=(calc12pager() * 1.23);
		}
		else {
			tp=(calc12pager() * 1.33);
		}		
	}

	if (total_pages == "16") {
		if (quantity == "25")
			tp=385;		
		else if (quantity == "50")
			tp=572;
		else if (quantity == "100")
			tp=797.5;
		else if (quantity == "150")
			tp=1100;
		else if (quantity == "200")
			tp=1109;		
		else if (quantity <= 2000) {
			tp=(calc16pager() * 1.08);
		}

		else if (quantity <= 5000) {
			tp=(calc16pager() * 1.13);
		}
		else if (quantity <= 7500) {
			tp=(calc16pager() * 1.18);
		}
 		else  {
			tp=(calc16pager() * 1.2);
		}
 
	}

	if (total_pages == "20") {
		if (quantity == "25")
			tp=506;		
		else if (quantity == "50")
			tp=698.5;
		else if (quantity == "100")
			tp=962.5;
		else if (quantity == "150")
			tp=1386;
		else if (quantity == "200")
			tp=1394.8;		
		else if (quantity <= 1000) {
			tp=(calc20pager() * 1.22);
		}
		else if (quantity <= 2000) {
			tp=(calc20pager() * 1.27);
		}
		else if (quantity <= 5000) {
			tp=(calc20pager() * 1.34);
		}
		else if (quantity <= 7500) {
			tp=(calc20pager() * 1.37);
		}
		else if (quantity <= 10000) {
			tp=(calc20pager() * 1.4);
		}
		else {
			tp=(calc20pager() * 1.45);
		}
	}

	if (total_pages == "24") {
		if (quantity == "25")
			tp=550;		
		else if (quantity == "50")
			tp=786.5;
		else if (quantity == "100")
			tp=1100;
		else if (quantity == "150")
			tp=1508.7;
		else if (quantity == "200")
			tp=1724.8;		
		else if (quantity <= 500) {
			tp=(calc24pager() * 1.31);
		}
		else if (quantity <= 1000) {
			tp=(calc24pager() * 1.33);
		}
		else if (quantity <= 2000) {
			tp=(calc24pager() * 1.37);
		}
		else if (quantity <= 5000) {
			tp=(calc24pager() * 1.5);
		}
		else if (quantity <= 7500) {
			tp=(calc24pager() * 1.54);
		}
		else if (quantity <= 10000) {
			tp=(calc24pager() * 1.59);
		}
		else {	
			tp=(calc24pager() * 1.65);
		}
	}

	if (total_pages == "28") {
		if (quantity == "25"){
			tp=577.5;	
		}	
		else if (quantity == "50")
			tp=858;
		else if (quantity == "100")
			tp=1168;
		else if (quantity == "150")
			tp=1650;
		else if (quantity == "200")
			tp=1848;		
		else if (quantity <= 1000) {
			tp=(calc28pager() * 1.31);
		}
		else if (quantity <= 2000) {
			tp=(calc28pager() * 1.37);
		}
		else if (quantity <= 5000) {
			tp=(calc28pager() * 1.46);
		}
		else if (quantity <= 7500) {
			tp=(calc28pager() * 1.51);
		}
		else if (quantity <= 10000) {
			tp=(calc28pager() * 1.51);
		}
		else {
			tp=(calc28pager() * 1.57);
		}
	}

	if (total_pages == "32") {
		if (quantity == "25")
			tp=687.5;		
		else if (quantity == "50")
			tp=1001;
		else if (quantity == "100")
			tp=1650;
		else if (quantity == "150")
			tp=2200;
		else if (quantity == "200")
			tp=2402.4;		
		else if (quantity <= 500) {
			tp=((calc8pager() + calc24pager()) * 1.18);
		}
		else if (quantity <= 2000) {
			tp=((calc8pager() + calc24pager()) * 1.2);
		}
		else if (quantity <= 5000) {
			tp=((calc8pager() + calc24pager()) * 1.32);
		}
		else if (quantity <= 7500) {
			tp=((calc8pager() + calc24pager()) * 1.35);
		}
		else if (quantity <= 10000) {
			tp=((calc8pager() + calc24pager()) * 1.4);
		}		
		else {
			tp=((calc8pager() + calc24pager()) * 1.45);
		}		
	}

	if (total_pages == "36") {
		if (quantity == "25")
			tp=810.7;		
		else if (quantity == "50")
			tp=1129.7;
		else if (quantity == "100")
			tp=1817.2;
		else if (quantity == "150")
			tp=2488.2;
		else if (quantity == "200")
			tp=2690.6;		
		else if (quantity <= 2000) {		
			tp=(((calc12pager() * 1.03) + calc24pager())  * 1.35);
		}
		else if (quantity <= 5000) {		
			tp=(((calc12pager() * 1.03) + calc24pager())  * 1.45);
		}
		else if (quantity <= 7500) {		
			tp=(((calc12pager() * 1.03) + calc24pager())  * 1.55);
		}
		else if (quantity <= 10000) {		
			tp=(((calc12pager() * 1.03) + calc24pager())  * 1.57);
		}
		else {		
			tp=(((calc12pager() * 1.03) + calc24pager())  * 1.6);
		}
	}

	if (total_pages == "40") {
		if (quantity == "25")
			tp=893.68;		
		else if (quantity == "50")
			tp=1286.93;
		else if (quantity == "100")
			tp=2199.93;
		else if (quantity == "150")
			tp=3024.93;
		else if (quantity == "200")
			tp=3203.13;		
		else if (quantity <= 2000) {				
			tp=((calc16pager() + calc24pager()) * 1.3);
		}
		else if (quantity <= 5000) {				
			tp=((calc16pager() + calc24pager()) * 1.38);
		}		
		else if (quantity <= 7500) {				
			tp=((calc16pager() + calc24pager()) * 1.4);
		}		
		else if (quantity <= 10000) {				
			tp=((calc16pager() + calc24pager()) * 1.45);
		}
		else {				
			tp=((calc16pager() + calc24pager()) * 1.5);
		}						
	}

	if (total_pages == "44") {
		if (quantity == "25")
			tp=1116.15;		
		else if (quantity == "50")
			tp=1546.9;
		else if (quantity == "100")
			tp=2477.4;
		else if (quantity == "150")
			tp=3368.4;
		else if (quantity == "200")
			tp=3639.01;		
		else if (quantity <= 2000) {				
			tp=((calc20pager() + calc24pager()) * 1.4);
		}
		else if (quantity <= 5000) {				
			tp=((calc20pager() + calc24pager()) * 1.45);
		}
		else if (quantity <= 7500) {				
			tp=((calc20pager() + calc24pager()) * 1.5);
		}		
		else if (quantity <= 7500) {				
			tp=((calc20pager() + calc24pager()) * 1.55);
		}		
		else {				
			tp=((calc20pager() + calc24pager()) * 1.6);
		}
	}

	if (total_pages == "48") {
		if (quantity == "25")
			tp=1338.61;		
		else if (quantity == "50")
			tp=1806.86;
		else if (quantity == "100")
			tp=2754.86;
		else if (quantity == "150")
			tp=3711.86;
		else if (quantity == "200")
			tp=4074.88;		
		else if (quantity <= 1000) {						
			tp=((calc24pager() *2) * 1.45);
		}
		else if (quantity <= 2000) {						
			tp=((calc24pager() *2) * 1.5);
		}
		else if (quantity <= 5000) {						
			tp=((calc24pager() *2) * 1.55);
		}
		else if (quantity <= 7500) {						
			tp=((calc24pager() *2) * 1.65);
		}
		else if (quantity <= 10000) {						
			tp=((calc24pager() *2) * 1.7);
		}
		else {						
			tp=((calc24pager() *2) * 1.75);
		}	
	}

	if (total_pages == "52") {
		if (quantity == "25")
			tp=1561.08;		
		else if (quantity == "50")
			tp=2066.82;
		else if (quantity == "100")
			tp=3032.33;
		else if (quantity == "150")
			tp=4055.33;
		else if (quantity == "200")
			tp=4510.76;		
		else if (quantity <= 2000) {						
			tp=(((calc20pager() *2 ) + (calc12pager())) * 1.35);
		}
		else if (quantity <= 5000) {						
			tp=(((calc20pager() *2 ) + (calc12pager())) * 1.4);
		}
		else if (quantity <= 10000) {						
			tp=(((calc20pager() *2 ) + (calc12pager())) * 1.45);
		}
		else {						
			tp=(((calc20pager() *2 ) + (calc12pager())) * 1.5);
		}
	}

	if (total_pages == "56") {
		if (quantity == "25")
			tp=1783.54;		
		else if (quantity == "50")
			tp=2326.79;
		else if (quantity == "100")
			tp=3309.79;
		else if (quantity == "150")
			tp=4398.79;
		else if (quantity == "200")
			tp=4946.63;
		else if (quantity <= 1000) {						
			tp=((calc8pager() + (calc24pager() * 2)) * 1.4);
		}
		else if (quantity <= 2000) {						
			tp=((calc8pager() + (calc24pager() * 2)) * 1.45);
		}
		else if (quantity <= 5000) {						
			tp=((calc8pager() + (calc24pager() * 2)) * 1.5);
		}
		else if (quantity <= 10000) {						
			tp=((calc8pager() + (calc24pager() * 2)) * 1.55);
		}
		else {						
			tp=((calc8pager() + (calc24pager() * 2)) * 1.6);
		}
	}

	if (total_pages == "60") {
		if (quantity == "25")
			tp=2006.02;		
		else if (quantity == "50")
			tp=2586.75;
		else if (quantity == "100")
			tp=3587.27;
		else if (quantity == "150")
			tp=4742.27;
		else if (quantity == "200")
			tp=5382.51;
		else if (quantity <= 1000) {						
			tp=((calc12pager() + (calc24pager() * 2)) * 1.5);
		}
		else if (quantity <= 5000) {						
			tp=((calc12pager() + (calc24pager() * 2)) * 1.58);
		}
		else if (quantity <= 10000) {						
			tp=((calc12pager() + (calc24pager() * 2)) * 1.65);
		}
		else {						
			tp=((calc12pager() + (calc24pager() * 2)) * 1.75);
		}
	}
		
	if (total_pages == "64") {
		if (quantity == "25")
			tp=2131.18;		
		else if (quantity == "50")
			tp=2716.93;
		else if (quantity == "100")
			tp=3849.93;
		else if (quantity == "150")
			tp=5087.43;
		else if (quantity == "200")
			tp=5790.33;
		else if (quantity <= 1000) {						
			tp=(((calc24pager() * 2) + (calc16pager())) * 1.45);
		}
		else if (quantity <= 2000) {						
			tp=(((calc24pager() * 2) + (calc16pager())) * 1.48);
		}
		else if (quantity <= 5000) {						
			tp=(((calc24pager() * 2) + (calc16pager())) * 1.5);
		}
		else if (quantity <= 10000) {						
			tp=(((calc24pager() * 2) + (calc16pager())) * 1.55);
		}
		else {						
			tp=(((calc24pager() * 2) + (calc16pager())) * 1.6);
		}
	}

	if (total_pages == "68") {
		if (quantity == "25")
			tp=2298.65;		
		else if (quantity == "50")
			tp=2919.7;
		else if (quantity == "100")
			tp=4072.4;
		else if (quantity == "150")
			tp=5375.9;
		else if (quantity == "200")
			tp=6226.21;
		else if (quantity <= 1000) {						
			tp=(((calc8pager() + calc12pager()) + ((calc24pager() * 2))) * 1.45);
		}
		else if (quantity <= 2000) {						
			tp=(((calc8pager() + calc12pager()) + ((calc24pager() * 2))) * 1.5);
		}
		else if (quantity <= 5000) {						
			tp=(((calc8pager() + calc12pager()) + ((calc24pager() * 2))) * 1.52);
		}
		else if (quantity <= 10000) {						
			tp=(((calc8pager() + calc12pager()) + ((calc24pager() * 2))) * 1.6);
		}
		else {						
			tp=(((calc8pager() + calc12pager()) + ((calc24pager() * 2))) * 1.65);
		}
	}


	if (quantity > 200 && document.estiForm.colors.value == "1over1" && document.estiForm.coverColors.value != "1over1") { //extra charge for plates & makeready on color cover
		if (total_pages == "8") {
			tp=(tp + 90);
		}
		if (total_pages == "12") {
			tp=(tp + 140);
		}
		else if (total_pages >= "16") {
			tp=(tp + 260);
		}
	}


	if (document.estiForm.coverPaper.value != "same as inside") { //For Cover add $350 up to 4,500 then double to $700 up to 10,000 then add $350 for each additional 5,000
		if (quantity<= 200) {
			tp=(tp + 12) // this is digital, but we need to charge something for changing paper
		}
		else if (quantity <= 4500) {		
			tp=(tp + 350);
		}
		else if (quantity <= 10000) {
			tp=(tp + 700)
		}
		else if (quantity <= 15000) {
			tp=(tp + 1050)
		}
		else if (quantity <= 20000) {
			tp=(tp + 1400)
		}
		
		if (quantity > 200 && document.estiForm.coverColors.value == "4over1") { //Small discounts for less presstime on inside cover
			tp=(tp - 28)
		}			
		if (quantity > 200 && document.estiForm.coverColors.value == "4over0") {
			tp=(tp - 58)
		}			
	}

	if (document.estiForm.productFamily.value == "Calendar") {
		tp = (tp + calcDrilling());
		}	
	
	if (document.estiForm.bind.options) {
		if (document.estiForm.bind.options[document.estiForm.bind.selectedIndex].value == "wiro") {//they chose a wire-o bind
			tp = (tp + (quantity * 1)); //add $1 per book for wire-o
		}
	}
	else {
		if (document.estiForm.bind.value == "wiro") {//they chose a wire-o bind
			tp = (tp + (quantity * 1)); //add $1 per book for wire-o
		}
	}

	tp = (tp + (calcProof(si + (si * inside_sheets))));	

	if (finalHeight == "8.5" && finalWidth == "5.5"){
		tp = (tp * .75)
	}

	document.estiForm.si.value=si;
	document.estiForm.tsi.value=tsi;

	// January 7, 2010: Discounting ALL non-digital multi-pagers 20% - BV
	if (quantity >= 250) {
		tp = (tp - (tp * .2));
	}

	if (document.estiForm.turnaround[0] && document.estiForm.turnaround[0].type=='radio') {
	for (var i=0; i < document.estiForm.turnaround.length; i++) {
		if (document.estiForm.turnaround[i].checked) {
			var turn_val = document.estiForm.turnaround[i].value;
			if (turn_val == '5 day')
				tp = tp + (tp * .1)
			if (turn_val == '3 day')
				tp = tp + (tp * .22)
			}
		}
	}
	
        if (mode && mode == "1") {
			ppu = (tp / (document.estiForm.realquant.value));
			updatePrice("tp", formatCurrency(tp), tp, quantity);
			document.estiForm.press.value="74CD";
			updatePrice("ppu", formatCurrency(ppu), ppu, quantity);
		}
		else {
			//document.estiForm.tp.value=formatCurrency(tp);
			//document.estiForm.ppu.value=formatCurrency(ppu);
			document.estiForm.press.value="74CD";
			ppu = (tp / (document.estiForm.realquant.value));
			if (document.estiForm.mailing &&
			  document.estiForm.mailing.options[document.estiForm.mailing.selectedIndex].value != "no" && 
 			  document.estiForm.mailQuant.value > 0) { //IF MAILING IS ON AND HAS A VALID QUANTITY
				var printTotal = tp;
				var grandTotal = (tp + Math.round(totalMailingCost));
				updateText("myPrintCost", formatCurrency(tp));
				updateText("myTp", formatCurrency(grandTotal));
				updateText("myTp2", formatCurrency(grandTotal));
				document.estiForm.printCost.value = formatAsMoney(tp); //this trick adds two zeros to the end of the price.
				document.estiForm.ppu.value = formatCurrency(ppu);
				document.estiForm.tp.value = formatCurrency(grandTotal);
			}
			else { //NO MAILING
				var printTotal = tp;
				var grandTotal = tp;
				updateText("myPrintCost", formatCurrency(tp));
				updateText("myTp", formatCurrency(grandTotal));
				updateText("myTp2", formatCurrency(grandTotal));
				document.estiForm.ppu.value=formatCurrency(ppu);
				document.estiForm.tp.value=formatCurrency(tp);
				document.estiForm.printCost.value = formatAsMoney(printTotal);
			}
		}
}

function calc8pager() { //baseline pricing for 8-page sig. Market adjustments are made in calc_multi function above!
	if (document.estiForm.colors.value == "4over4") {
		var numberSheets = ((quantity/1000) + .8);
		var numberPlates = 8;
	}
	else if (document.estiForm.colors.value == "1over1") {
		var numberSheets = ((quantity/1000) + .4);
		var numberPlates = 2;
	}

	var paperCost = (numberSheets * getPaperCostPerK());
	var prepressCost = 80;
	var plateCost = (numberPlates * 30);
	var hoursOnPress = ((quantity/7000) + 1.5);
	var pressCost = (hoursOnPress * 250);
	var binderyCost = 0;
	if (quantity <= 4000) {
		binderyCost = 247.5
	}
	else if (quantity <= 4500) {
		binderyCost = 330
	}
	else if (quantity <= 5000) {
		binderyCost = 357.5
	}
	else if (quantity > 5000) {
		var binderyAdd = ((quantity - 5000) / 500)
		binderyCost = (357.5 + ((binderyAdd) * (22)) ); //$22 per 500 beyond qty of 5000
	}
	//alert ("numberSheets = " + numberSheets + "\n paperCost = " +  paperCost + "\n prepressCost = "  + prepressCost + "\n plateCost = "  +  plateCost + "\n pressCost = " +  pressCost +  "\n binderyCost = " + binderyCost);
	return (paperCost + prepressCost + plateCost+ pressCost + binderyCost);
}

function calc12pager() { //baseline pricing for 12-page sig. Market adjustments are made in calc_multi function above!
	if (document.estiForm.colors.value == "4over4") {
		var numberSheets = ((quantity/1000) + .8);
		var numberPlates = 8;
	}
	else if (document.estiForm.colors.value == "1over1") {
		var numberSheets = ((quantity/1000) + .4);
		var numberPlates = 2;
	}
	var paperCost = (numberSheets * getPaperCostPerK());
	var prepressCost = 80;
	var plateCost = (numberPlates * 30);
	var hoursOnPress = ((quantity/7000) + 1.5);
	var pressCost = (hoursOnPress * 250);
	var binderyCost = 0;
	if (quantity <= 1000) {
		binderyCost = 247.5
	}
	else if (quantity <= 1500) {
		binderyCost = 258.5
	}
	else if (quantity > 1500) {
		var binderyAdd = ((quantity - 1500) / 500)
		binderyCost = (258.5 + ((binderyAdd) * (22)) ); //$22 per 500 beyond qty of 1500
	}

	//alert ("numberSheets = " + numberSheets + "\n paperCost = " +  paperCost + "\n prepressCost = "  + prepressCost + "\n plateCost = "  +  plateCost + "\n pressCost = " +  pressCost +  "\n binderyCost = " + binderyCost);	
	return (paperCost + prepressCost + plateCost+ pressCost + binderyCost);
}

function calc16pager() { //baseline pricing for 16-page sig. Market adjustments are made in calc_multi function above!
	if (document.estiForm.colors.value == "4over4") {
		var numberSheets = (((quantity/1000)*2) + 1.6);
		var numberPlates = 12;
	}
	else if (document.estiForm.colors.value == "1over1") {
		var numberSheets = (((quantity/1000)*2) + .8);
		var numberPlates = 4;
	}
	var paperCost = (numberSheets * getPaperCostPerK());
	var prepressCost = 160;
	var plateCost = (numberPlates * 30);
	var hoursOnPress = (((quantity/7000)*2) + 2);
	var pressCost = (hoursOnPress * 250);
	var binderyCost = 0;
	if (quantity <= 500) {
		binderyCost = 324.5
	}
	else if (quantity > 500) {
		var binderyAdd = ((quantity - 500) / 500)
		binderyCost = (324.5 + ((binderyAdd) * (22)) ); //$22 per 500 beyond qty of 500
	}
	//alert ("numberSheets = " + numberSheets + "\n paperCost = " +  paperCost + "\n prepressCost = "  + prepressCost + "\n plateCost = "  +  plateCost + "\n pressCost = " +  pressCost +  "\n binderyCost = " + binderyCost);	
	return (paperCost + prepressCost + plateCost+ pressCost + binderyCost);
}

function calc20pager() { //baseline pricing for 20-page sig. Market adjustments are made in calc_multi function above!
	if (document.estiForm.colors.value == "4over4") {
		var numberSheets = (((quantity/1000)*2) + 1.6);
		var numberPlates = 16;
	}
	else if (document.estiForm.colors.value == "1over1") {
		var numberSheets = (((quantity/1000)*2) + .8);
		var numberPlates = 4;
	}
	var paperCost = (numberSheets * getPaperCostPerK());
	var prepressCost = 160;
	var plateCost = (numberPlates * 30);
	var hoursOnPress = (((quantity/7000)*2) + 2);
	var pressCost = (hoursOnPress * 250);
	var binderyCost = 0;
	if (quantity <= 500) {
		binderyCost = 352
	}
	else if (quantity > 500) {
		var binderyAdd = ((quantity - 500) / 500)
		binderyCost = (352 + ((binderyAdd) * (22)) ); //$22 per 500 beyond qty of 500
	}
	//alert ("numberSheets = " + numberSheets + "\n paperCost = " +  paperCost + "\n prepressCost = "  + prepressCost + "\n plateCost = "  +  plateCost + "\n pressCost = " +  pressCost +  "\n binderyCost = " + binderyCost);	
	return (paperCost + prepressCost + plateCost+ pressCost + binderyCost);
}

function calc24pager() { //baseline pricing for 24-page sig. Market adjustments are made in calc_multi function above!
	if (document.estiForm.colors.value == "4over4") {
		var numberSheets = (((quantity/1000)*2) + 1.6);
		var numberPlates = 16;
	}
	else if (document.estiForm.colors.value == "1over1") {
		var numberSheets = (((quantity/1000)*2) + .8);
		var numberPlates = 4;
	}
	var paperCost = (numberSheets * getPaperCostPerK());
	var prepressCost = 300;
	var plateCost = (numberPlates * 30);
	var hoursOnPress = (((quantity/7000)*2) + 2);
	var pressCost = (hoursOnPress * 250);
	var binderyCost = 0;
	if (quantity <= 500) {
		binderyCost = 407
	}
	else if (quantity > 500) {
		var binderyAdd = ((quantity - 500) / 500)
		binderyCost = (407 + ((binderyAdd) * (22)) ); //$22 per 500 beyond qty of 500
	}
	//alert ("numberSheets = " + numberSheets + "\n paperCost = " +  paperCost + "\n prepressCost = "  + prepressCost + "\n plateCost = "  +  plateCost + "\n pressCost = " +  pressCost +  "\n binderyCost = " + binderyCost);	
	return (paperCost + prepressCost + plateCost+ pressCost + binderyCost);
}

function calc28pager() { //baseline pricing for 28-page sig. Market adjustments are made in calc_multi function above!
	if (document.estiForm.colors.value == "4over4") {
		var numberSheets = (((quantity/1000)*2.5) + 2.2);
		var numberPlates = 20;
	}
	else if (document.estiForm.colors.value == "1over1") {
		var numberSheets = (((quantity/1000)*2.5) + 1);
		var numberPlates = 5;
	}
	var paperCost = (numberSheets * getPaperCostPerK());
	var prepressCost = 300;
	var plateCost = (numberPlates * 30);
	var hoursOnPress = (((quantity/7000)*2.5) + 2.5);
	var pressCost = (hoursOnPress * 250);
	var binderyCost = 0;
	if (quantity <= 500) {
		binderyCost = 462
	}
	else if (quantity > 500) {
		var binderyAdd = ((quantity - 500) / 500)
		binderyCost = (462 + ((binderyAdd) * (22)) ); //$22 per 500 beyond qty of 500
	}
	//alert ("numberSheets = " + numberSheets + "\n paperCost = " +  paperCost + "\n prepressCost = "  + prepressCost + "\n plateCost = "  +  plateCost + "\n pressCost = " +  pressCost +  "\n binderyCost = " + binderyCost);	
	return (paperCost + prepressCost + plateCost+ pressCost + binderyCost);
}
		
function getPaperCostPerK() {
	if (document.estiForm.paper && document.estiForm.paper.value == "80_nl_rein_book"){
		return 116.8342695
	}
	if (document.estiForm.paper && document.estiForm.paper.value == "105_nl_rein_book"){
		return 153.781859
	}
	if (document.estiForm.paper && document.estiForm.paper.value == "101_nl_pvg_book"){
		return 131.739758
	}
	if (document.estiForm.paper && document.estiForm.paper.value == "87_nl_sak_book"){
		return 119.1683545
	}
	if (document.estiForm.paper && document.estiForm.paper.value == "106_nl_sak_book"){
		return 145.4416925
	}
	if (document.estiForm.paper && document.estiForm.paper.value == "80_nl_eb_book"){
		return 174.116475
	}
}


function checkFinalMailDependencies(productFamily, quantity, mailQuant) {
	if (document.estiForm.mailing && document.estiForm.mailing.options[document.estiForm.mailing.selectedIndex].value != "no") {		
		if (document.estiForm.height.options)
			var si = (document.estiForm.height.options[document.estiForm.height.selectedIndex].value * document.estiForm.width.options[document.estiForm.width.selectedIndex].value);
		else if (productFamily=="Booklet" || productFamily=="Catalog" || productFamily=="Calendar") {
			si = (document.estiForm.finalHeight.value * document.estiForm.finalWidth.value);
		}
		else
			si = (document.estiForm.height.value * document.estiForm.width.value);
				
		if (mailQuant && mailQuant > 499 && document.estiForm.mailing.options[document.estiForm.mailing.selectedIndex].value=="stamps") {
			document.estiForm.mailing.selectedIndex=1;
			//alert("Stamps are not an option for mailings of more than 500. First Class Bulk Mail has been selected instead.");
		}

		if ((productFamily == "Card" || productFamily == "w2pCard") && document.estiForm.blankEnvelopes.value == "no" && document.estiForm.konlyEnvelopes.value == "no") {
			//alert(productFamily + si);
			if (mailQuant && mailQuant < 500 && mailQuant > 0 && (document.estiForm.mailing.options[document.estiForm.mailing.selectedIndex].value=="firstClass" || document.estiForm.mailing.options[document.estiForm.mailing.selectedIndex].value=="bulkMail" || document.estiForm.mailing.options[document.estiForm.mailing.selectedIndex].value=="nonProfit")) {
				document.estiForm.mailing.selectedIndex=4;
				alert("None of the presorted mailing options (which includes First Class, Bulk Mail and Non-Profit) are available when mailing fewer than 500 pieces. The Stamps option has been selected instead!");
			}
			var validSmallPostcardPapers = new Array(12);
			validSmallPostcardPapers[0] = "105_nl_rein_book"; validSmallPostcardPapers[1] = "80_nl_rein_cover"; 
			validSmallPostcardPapers[2] = "95_nl_rein_cover"; validSmallPostcardPapers[3] = "92.5_nl_pvg_cover";
			validSmallPostcardPapers[4] = "111_nl_pvg_cover"; validSmallPostcardPapers[5] = "80_nl_ec_cover";
			validSmallPostcardPapers[6] = "100_nl_ec_cover"; validSmallPostcardPapers[7] = "80_cover";
			validSmallPostcardPapers[8] = "100_cover"; validSmallPostcardPapers[9] = "12pt_cover";
			validSmallPostcardPapers[10] = "96_nl_sak_cover"; validSmallPostcardPapers[11] = "96_nl_sak_cover";
			
			var validLargePostcardPapers = new Array(8);
			validLargePostcardPapers[0] = "80_nl_rein_cover"; validLargePostcardPapers[1] = "95_nl_rein_cover";
			validLargePostcardPapers[2] = "111_nl_pvg_cover"; validLargePostcardPapers[3] = "80_nl_ec_cover";
			validLargePostcardPapers[4] = "100_nl_ec_cover"; validLargePostcardPapers[5] = "100_cover";
			validLargePostcardPapers[6] = "96_nl_sak_cover"; validLargePostcardPapers[7] = "96_nl_sak_cover";
			if (si <= 25.5) {
				var validPaper = false;
				for (x in validSmallPostcardPapers) {
					//alert(validSmallPostcardPapers[x]);
					if (document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value==validSmallPostcardPapers[x])
						validPaper=true;
				}
				if(!validPaper) {
					document.estiForm.mailing.selectedIndex=0;
					alert("The combination of size (" + document.estiForm.height.options[document.estiForm.height.selectedIndex].value + " x " + document.estiForm.width.options[document.estiForm.width.selectedIndex].value + ") and paper (" + document.estiForm.paper.options[document.estiForm.paper.selectedIndex].text + ") is not a valid mailing choice.  In some cases this can be resolved by changing to a heavier paper, or a smaller size.");
					return;
				}
				if (document.estiForm.mailing.options[document.estiForm.mailing.selectedIndex].value=="bulkMail") {
					document.estiForm.mailing.selectedIndex=1;
					alert("Standard Presort Mail is not an option for this size card. First Class has been selected instead.");
					return;
				}
			}
			else if (si > 25.5 && si <= 70.4375) {
				var validPaper = false;
				for (x in validLargePostcardPapers) {
					if (document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value==validLargePostcardPapers[x])
						validPaper=true;
				}
				if(!validPaper) {
					document.estiForm.mailing.selectedIndex=0;
					alert("The combination of size (" + document.estiForm.height.options[document.estiForm.height.selectedIndex].value + " x " + document.estiForm.width.options[document.estiForm.width.selectedIndex].value + ") and paper (" + document.estiForm.paper.options[document.estiForm.paper.selectedIndex].text + ") is not a valid mailing choice.  In some cases this can be resolved by changing to a heavier paper, or a smaller size.");
				}
			}
			else if (si > 70.4375) {
				document.estiForm.mailing.selectedIndex=0;
				alert("The combination of size (" + document.estiForm.height.options[document.estiForm.height.selectedIndex].value + " x " + document.estiForm.width.options[document.estiForm.width.selectedIndex].value + ") and paper (" + document.estiForm.paper.options[document.estiForm.paper.selectedIndex].text + ") is not a valid mailing choice.  In some cases this can be resolved by changing to a heavier paper, or a smaller size.");
			}			
		}
		else {	// the non-postcard jobs	
			var finalHeight = document.estiForm.finalHeight.value;
			var finalWidth = document.estiForm.finalWidth.value;
			
			if (mailQuant && mailQuant < 500 && mailQuant > 0 && 
			(document.estiForm.mailing.options[document.estiForm.mailing.selectedIndex].value=="firstClass" || 
			document.estiForm.mailing.options[document.estiForm.mailing.selectedIndex].value=="bulkMail" || 
			document.estiForm.mailing.options[document.estiForm.mailing.selectedIndex].value=="nonProfit")) {
				document.estiForm.mailing.selectedIndex=4;
				alert("None of the presorted mailing options (which includes First Class, Bulk Mail and Non-Profit) are available when mailing quantities fewer than 500. The stamp option has been selected instead!");
				return;
			}
			
			if ((finalHeight*finalWidth) > 180 && 
				 (document.estiForm.mailing.options[document.estiForm.mailing.selectedIndex].value=="firstClass" || 
				  document.estiForm.mailing.options[document.estiForm.mailing.selectedIndex].value=="bulkMail" || 
				  document.estiForm.mailing.options[document.estiForm.mailing.selectedIndex].value=="nonProfit")) {
				document.estiForm.mailing.selectedIndex=4;
				alert("The size you have  chosen is too large to qualify for any of the presorted mailing options (which includes First Class, Bulk Mail and Non-Profit).  Choosing a fold option may reduce the size of the final piece enough to qualify for presorted rates.\nThe stamp option has been selected.");
				return;
			}
		}
	}	
}


function checkMailDependencies(productFamily, quantity, mailQuant) {
	if (document.estiForm.mailing.options[document.estiForm.mailing.selectedIndex].value=='no' && parseInt(document.estiForm.mailQuant.value) > 0) {
		document.estiForm.mailQuant.value='0';
		alert('Please select a mail service before entering a quantity');
	}

	var m = parseInt(document.estiForm.mailQuant.value);
	var q = parseInt(quantity);
	if(m > q) {
		document.estiForm.mailQuant.value=0;
		alert("The quantity to be mailed cannot be more than the total print quantity! Mail quantity has been reset to zero.");		
	}
	if (document.estiForm.pages) { //this is a multipage document
		var finalHeight = document.estiForm.finalHeight.value;
		var finalWidth = document.estiForm.finalWidth.value;
		var weightPerUnit = getUnitWeightOnces((tsi + tsi_cover), document.estiForm.quantity.value);
		if (weightPerUnit > 3.3) {
			alert("Your printed piece weighs more than 3 ounces and will require special attention. You'll need to contact customer service (csr@greenerprinter.com) to arrange for custom mailing.");
			document.estiForm.mailing.selectedIndex=0;
			document.estiForm.mailQuant.value=0;
			return;
		}
	}
}

function updateText(id, str) {
	if (document.getElementById(id)) {
		document.getElementById(id).innerHTML = str;
	}
}

function formatAsMoney(mnt) {
	mnt -= 0;
	mnt = (Math.round(mnt*100))/100;
	return (mnt == Math.floor(mnt)) ? mnt + '.00' : ( (mnt*10 == Math.floor(mnt*10)) ? mnt + '0' : mnt);
}

function calculateStationeryBizCards(){
	sbc = 0;
	//baseline pricing for K + PMS 2-sided business cards (we'll remove the PMS charge if only black at the end)
	if (document.estiForm.stationeryBizCardQuantity && document.estiForm.stationeryBizCardQuantity.selectedIndex != 0 && (document.estiForm.stationeryBizCardColors.value == ("Black & 1 PMS / Black &  1 PMS") || document.estiForm.stationeryBizCardColors.value == ("Black / Black"))){
		if (document.estiForm.stationeryBizCardQuantity.value == 500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.5403125);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 1000){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.2788525);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 1500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.191699167);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 2000){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.169905);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 2500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.1481225);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 3000){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.126334);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 3500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.104545833);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 4000){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.093652);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 4500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0827575);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 5000 || document.estiForm.stationeryBizCardQuantity.value == 5500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0696845);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 6000 || document.estiForm.stationeryBizCardQuantity.value == 6500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.060969167);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 7000 || document.estiForm.stationeryBizCardQuantity.value == 7500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0552925);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 8000 || document.estiForm.stationeryBizCardQuantity.value == 8500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.050555);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 9000 || document.estiForm.stationeryBizCardQuantity.value == 9500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.046870278);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 10000 || document.estiForm.stationeryBizCardQuantity.value == 10500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0439225);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 11000 || document.estiForm.stationeryBizCardQuantity.value == 11500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.041510682);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 12000 || document.estiForm.stationeryBizCardQuantity.value == 12500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.039500833);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 13000 || document.estiForm.stationeryBizCardQuantity.value == 13500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.037800192);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 14000 || document.estiForm.stationeryBizCardQuantity.value == 14500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0363425);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 15000 || document.estiForm.stationeryBizCardQuantity.value == 15500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.035079167);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 16000){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.03469375);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 0){
			sbc = 0;
			}
	}
	//baseline pricing for K + PMS 1-sided business cards (we'll remove the PMS charge if only black at the end)
	if (document.estiForm.stationeryBizCardQuantity && document.estiForm.stationeryBizCardQuantity.selectedIndex != 0 && (document.estiForm.stationeryBizCardColors.value == ("Black & 1 PMS / blank") || document.estiForm.stationeryBizCardColors.value == ("Black / blank"))){
		if (document.estiForm.stationeryBizCardQuantity.value == 500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.4559275);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 1000){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.2346475);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 1500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.1608875);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 2000 || document.estiForm.stationeryBizCardQuantity.value == 2500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.1240075);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 3000 || document.estiForm.stationeryBizCardQuantity.value == 3500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0871275);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 4000 || document.estiForm.stationeryBizCardQuantity.value == 4500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0686875);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 5000 || document.estiForm.stationeryBizCardQuantity.value == 5500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0576235);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 6000 || document.estiForm.stationeryBizCardQuantity.value == 6500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0502475);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 7000 || document.estiForm.stationeryBizCardQuantity.value == 7500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.045253214);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 8000 || document.estiForm.stationeryBizCardQuantity.value == 8500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0412675);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 9000 || document.estiForm.stationeryBizCardQuantity.value == 9500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0381675);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 10000 || document.estiForm.stationeryBizCardQuantity.value == 10500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0356875);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 11100 || document.estiForm.stationeryBizCardQuantity.value == 11500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.033658409);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 12000 || document.estiForm.stationeryBizCardQuantity.value == 12500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0319675);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 13000 || document.estiForm.stationeryBizCardQuantity.value == 13500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.030536731);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 14000 || document.estiForm.stationeryBizCardQuantity.value == 14500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.028624643);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 15000 || document.estiForm.stationeryBizCardQuantity.value == 15500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0282475);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 16000){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0276775);
			}		
	}
	//baseline pricing for 2 PMS  and 1 PMS 2-sided business cards (we'll remove the extra PMS charge if only 1 PMS at the end)
	if (document.estiForm.stationeryBizCardQuantity && document.estiForm.stationeryBizCardQuantity.selectedIndex != 0 && (document.estiForm.stationeryBizCardColors.value == ("2 PMS / 2 PMS") || document.estiForm.stationeryBizCardColors.value == ("1 PMS / 1 PMS"))){
		if (document.estiForm.stationeryBizCardQuantity.value == 500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.6603125);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 1000){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.3388525);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 1500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.231699167);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 2000 || document.estiForm.stationeryBizCardQuantity.value == 2500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.1781225);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 3000 || document.estiForm.stationeryBizCardQuantity.value == 3500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.124545833);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 4000 || document.estiForm.stationeryBizCardQuantity.value == 4500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0977575);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 5000 || document.estiForm.stationeryBizCardQuantity.value == 5500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0816845);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 6000 || document.estiForm.stationeryBizCardQuantity.value == 6500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.070969167);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 7000 || document.estiForm.stationeryBizCardQuantity.value == 7500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.063863929);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 8000 || document.estiForm.stationeryBizCardQuantity.value == 8500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.058055);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 9000 || document.estiForm.stationeryBizCardQuantity.value == 9500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.053536944);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 10000 || document.estiForm.stationeryBizCardQuantity.value == 10500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0499225);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 11000 || document.estiForm.stationeryBizCardQuantity.value == 11500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.046965227);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 12000 || document.estiForm.stationeryBizCardQuantity.value == 12500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.044500833);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 13000 || document.estiForm.stationeryBizCardQuantity.value == 13500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.042415577);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 14000 || document.estiForm.stationeryBizCardQuantity.value == 14500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.040628214);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 15000 || document.estiForm.stationeryBizCardQuantity.value == 15500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.039079167);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 16000){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.03844375);
			}		
	}
	//baseline pricing for 2 PMS  and 1 PMS 1-sided business cards (we'll remove the extra PMS charge if only 1 PMS at the end)
	if (document.estiForm.stationeryBizCardQuantity && document.estiForm.stationeryBizCardQuantity.selectedIndex != 0 && (document.estiForm.stationeryBizCardColors.value == ("2 PMS / blank") || document.estiForm.stationeryBizCardColors.value == ("1 PMS / blank"))){
		if (document.estiForm.stationeryBizCardQuantity.value == 500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.5759275);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 1000){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.2946475);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 1500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.2008875);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 2000 || document.estiForm.stationeryBizCardQuantity.value == 2500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.1540075);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 3000 || document.estiForm.stationeryBizCardQuantity.value == 3500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.1071275);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 4000 || document.estiForm.stationeryBizCardQuantity.value == 4500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0836875);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 5000 || document.estiForm.stationeryBizCardQuantity.value == 5500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0696235);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 6000 || document.estiForm.stationeryBizCardQuantity.value == 6500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0602475);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 7000 || document.estiForm.stationeryBizCardQuantity.value == 7500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.053824643);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 8000 || document.estiForm.stationeryBizCardQuantity.value == 8500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0487675);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 9000 || document.estiForm.stationeryBizCardQuantity.value == 9500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.044834167);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 10000 || document.estiForm.stationeryBizCardQuantity.value == 10500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0416875);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 11000 || document.estiForm.stationeryBizCardQuantity.value == 11500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.039112955);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 12000 || document.estiForm.stationeryBizCardQuantity.value == 12500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0369675);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 13000 || document.estiForm.stationeryBizCardQuantity.value == 13500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.035152115);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 14000 || document.estiForm.stationeryBizCardQuantity.value == 14500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.033596071);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 15000 || document.estiForm.stationeryBizCardQuantity.value == 15500){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0322475);
			}
		if (document.estiForm.stationeryBizCardQuantity.value == 16000){
			sbc += (parseInt(document.estiForm.stationeryBizCardQuantity.value) * 0.0314275);
			}		
	}
	
	// plus 10% if Everest
	if (document.estiForm.stationeryBizCardQuantity && document.estiForm.stationeryBizCardQuantity.value != 0 && document.estiForm.paper.value == ("100_nl_ec_cover")){
			sbc = (sbc * 1.1);
	}

		// pricing above assumed 1 or 2 PMS inks, so subtract plate/ink mix if only one (or none) PMS ink
		if (document.estiForm.stationeryBizCardQuantity && document.estiForm.stationeryBizCardQuantity.value != 0 && 
			(document.estiForm.stationeryBizCardColors.value == ("Black / Black")
			|| document.estiForm.stationeryBizCardColors.value == ("Black / blank")
			|| document.estiForm.stationeryBizCardColors.value == ("1 PMS / 1 PMS")
			|| document.estiForm.stationeryBizCardColors.value == ("1 PMS / blank"))){
			sbc += (-80);
			}

		// subtract 1st PMS ink mix from business card price if already mixed for letterhead or envelope
		if (document.estiForm.stationeryBizCardQuantity && document.estiForm.stationeryBizCardQuantity.value != 0 && ((document.estiForm.stationeryLetterhead) && (document.estiForm.stationeryLetterhead.selectedIndex != 0 || document.estiForm.stationeryEnvelopes.selectedIndex != 0)) && 
			(document.estiForm.stationeryBizCardColors.value == ("Black + 1 PMS /Black + 1 PMS")
			|| document.estiForm.stationeryBizCardColors.value == ("Black + 1 PMS / blank")
			|| document.estiForm.stationeryBizCardColors.value == ("2 PMS / 2 PMS")
			|| document.estiForm.stationeryBizCardColors.value == ("2 PMS / blank")
			|| document.estiForm.stationeryBizCardColors.value == ("1 PMS / 1 PMS")
			|| document.estiForm.stationeryBizCardColors.value == ("1 PMS / blank"))
			&& ((document.estiForm.letterheadColors.value == ("2 PMS")
			|| document.estiForm.letterheadColors.value == ("1 PMS")
			|| document.estiForm.letterheadColors.value == ("Black + PMS"))
			||(document.estiForm.stationeryEnvColors.value == ("2 PMS")
				|| document.estiForm.stationeryEnvColors.value == ("1 PMS")
				|| document.estiForm.stationeryEnvColors.value == ("Black + 1 PMS")))){
			sbc += (-50);
			}

		// subtract 2nd PMS ink mix from business card price if already mixed for letterhead or envelope
		if ((document.estiForm.stationeryBizCardQuantity && document.estiForm.stationeryBizCardQuantity.value != 0) 
			&& ((document.estiForm.stationeryLetterhead && document.estiForm.stationeryLetterhead.selectedIndex != 0) || (document.estiForm.stationeryEnvelopes && document.estiForm.stationeryEnvelopes.selectedIndex != 0)) 
			&& (document.estiForm.stationeryBizCardColors.value == ("2 PMS / 2 PMS")
				|| document.estiForm.stationeryBizCardColors.value == ("2 PMS / blank"))
			&& ((document.estiForm.letterheadColors.value == ("2 PMS"))
				||(document.estiForm.stationeryEnvColors.value == ("2 PMS")))){
			sbc += (-50);
			}

	//add flat desktop fee of $10 for additional versions of business cards. If there are 5-8 names, we will also charge for extra plate(s)/makeready (separate logic)

	if (document.estiForm.productFamily && document.estiForm.productFamily.value == "Stationery-Business Cards") {
		if (document.getElementById('bc_name_two').style.display == 'block' && document.estiForm.cardQuant2.selectedIndex != 0){
			sbc += 10;

		}
		if (document.getElementById('bc_name_three').style.display == 'block' && document.estiForm.cardQuant3.selectedIndex != 0){
			sbc += 10;

		}
		if (document.getElementById('bc_name_four').style.display == 'block' && document.estiForm.cardQuant4.selectedIndex != 0){
			sbc += 10;

		}
		// we add $100 if there are more than four names due to extra plates and makeready (sheetwise vs. work/turn)
		if (document.getElementById('bc_name_five').style.display == 'block' && document.estiForm.cardQuant5.selectedIndex != 0){
			sbc += 110;

		}
		if (document.getElementById('bc_name_six').style.display == 'block' && document.estiForm.cardQuant6.selectedIndex != 0){
			sbc += 10;

		}
		if (document.getElementById('bc_name_seven').style.display == 'block' && document.estiForm.cardQuant7.selectedIndex != 0){
			sbc += 10;

		}

		if (document.getElementById('bc_name_eight').style.display == 'block' && document.estiForm.cardQuant8.selectedIndex != 0){
			sbc += 10;

		}
		else {
			sbc += 0;
		}
	}
		
	//add rounded corners charge	
		if (document.estiForm.round_corners && document.estiForm.round_corners.value == "yes"){
			roundCorners = (25 + (((document.estiForm.stationeryBizCardQuantity.value) - 250) * .03));
			sbc = sbc + roundCorners;
		}
	
}		
	
function calculateStationery(mode) {
	calculateStationeryBizCards(mode);	
	if (setStationeryQuant() <= 0 && document.estiForm.tp) {
		document.estiForm.tp.value=formatCurrency(0);
		//updatePrice("tp", formatCurrency(0), 0, document.estiForm.quantity.value);
		return true;
	}
	else if (setStationeryQuant() <= 0) {
		//updatePrice("tp", formatCurrency(0), 0, document.estiForm.quantity.value);
		return true;
	}
	//alert(sbc);
	
	productFamily = document.estiForm.productFamily.value;
	quantity = document.estiForm.realquant.value;
	document.estiForm.shipQuant.value = quantity;

	tp = 0;
	
	//start with baseline pricing on letterhead, black only
	if (document.estiForm.stationeryLetterhead && document.estiForm.stationeryLetterhead.selectedIndex != 0){
		if (document.estiForm.stationeryLetterhead.value == 500){
			tp += 192;
			}
		if (document.estiForm.stationeryLetterhead.value == 1000){
			tp += 209;
			}
		if (document.estiForm.stationeryLetterhead.value == 1500){
			tp += 229;
			}
		if (document.estiForm.stationeryLetterhead.value == 2000){
			tp += 249;
			}
		if (document.estiForm.stationeryLetterhead.value == 2500){
			tp += 273;
			}
		if (document.estiForm.stationeryLetterhead.value == 3000){
			tp += 297;
			}
		if (document.estiForm.stationeryLetterhead.value == 3500){
			tp += 321;
			}
		if (document.estiForm.stationeryLetterhead.value == 4000){
			tp += 346;
			}
		if (document.estiForm.stationeryLetterhead.value == 4500){
			tp += 370;
			}
		if (document.estiForm.stationeryLetterhead.value == 5000){
			tp += 394;
			}
		if (document.estiForm.letterheadColors.value == ("Black Only")){
			tp += 0;
			}
		
		// plus 60 bucks for ink mix if PMS
		if (document.estiForm.stationeryLetterhead && document.estiForm.stationeryLetterhead.selectedIndex != 0 && document.estiForm.letterheadColors.value == ("1 PMS")){
			tp += 60;
		}
		//add the following amounts for 1 PMS ink mix and 1 plate and extra washup
		if ((document.estiForm.letterheadColors.value == ("Black + PMS")) && ((document.estiForm.stationeryLetterhead.value == 500) || (document.estiForm.stationeryLetterhead.value == 1000))){
			tp += 121
			}
			else if (document.estiForm.letterheadColors.value == ("Black + PMS") && document.estiForm.stationeryLetterhead.value == 1500){
				tp += 122
			}
			else if (document.estiForm.letterheadColors.value == ("Black + PMS") && document.estiForm.stationeryLetterhead.value == 2000){
				tp += 123
			}
			else if (document.estiForm.letterheadColors.value == ("Black + PMS") && document.estiForm.stationeryLetterhead.value == 2500){
				tp += 125
			}
			else if (document.estiForm.letterheadColors.value == ("Black + PMS") && document.estiForm.stationeryLetterhead.value == 3000){
				tp += 127
			}
			else if (document.estiForm.letterheadColors.value == ("Black + PMS") && document.estiForm.stationeryLetterhead.value == 3500){
				tp += 129
			}
			else if (document.estiForm.letterheadColors.value == ("Black + PMS") && document.estiForm.stationeryLetterhead.value == 4000){
				tp += 130
			}
			else if (document.estiForm.letterheadColors.value == ("Black + PMS") && document.estiForm.stationeryLetterhead.value == 4500){
				tp += 132
			}
			else if (document.estiForm.letterheadColors.value == ("Black + PMS") && document.estiForm.stationeryLetterhead.value == 5000){
				tp += 134
		}
		//or add the following amounts for 2 PMS ink mixes and 1 plate and washup
		if ((document.estiForm.letterheadColors.value == ("2 PMS")) && ((document.estiForm.stationeryLetterhead.value == 500) || (document.estiForm.stationeryLetterhead.value == 1000))){
			tp += 178
			}
			else if (document.estiForm.letterheadColors.value == ("2 PMS") && document.estiForm.stationeryLetterhead.value == 1500){
				tp += 179
			}
			else if (document.estiForm.letterheadColors.value == ("2 PMS") && document.estiForm.stationeryLetterhead.value == 2000){
				tp += 180
			}
			else if (document.estiForm.letterheadColors.value == ("2 PMS") && document.estiForm.stationeryLetterhead.value == 2500){
				tp += 182
			}
			else if (document.estiForm.letterheadColors.value == ("2 PMS") && document.estiForm.stationeryLetterhead.value == 3000){
				tp += 184
			}
			else if (document.estiForm.letterheadColors.value == ("2 PMS") && document.estiForm.stationeryLetterhead.value == 3500){
				tp += 185
			}
			else if (document.estiForm.letterheadColors.value == ("2 PMS") && document.estiForm.stationeryLetterhead.value == 4000){
				tp += 187
			}
			else if (document.estiForm.letterheadColors.value == ("2 PMS") && document.estiForm.stationeryLetterhead.value == 4500){
				tp += 189
			}
			else if (document.estiForm.letterheadColors.value == ("2 PMS") && document.estiForm.stationeryLetterhead.value == 5000){
				tp += 191
			}
	}
	
	// simple pricing for blank letterhead at $40 per 1000
	if (document.estiForm.stationeryLetterheadBlank && document.estiForm.stationeryLetterheadBlank.selectedIndex != 0){
			tp += (document.estiForm.stationeryLetterheadBlank.value / 500) * 20;
	}
	// baseline envelope pricing for black only		
	if (document.estiForm.stationeryEnvelopes && document.estiForm.stationeryEnvelopes.selectedIndex != 0){
		if (document.estiForm.stationeryEnvelopesSize.value == ("#9 (8.875 x 3.875)")){
			if (document.estiForm.stationeryEnvelopes.value == 500){
				tp += 216;
				}
			if (document.estiForm.stationeryEnvelopes.value == 1000){
				tp += 265;
				}
			if (document.estiForm.stationeryEnvelopes.value == 1500){
				tp += 314;
				}
			if (document.estiForm.stationeryEnvelopes.value == 2000){
				tp += 363;
				}
			if (document.estiForm.stationeryEnvelopes.value == 2500){
				tp += 417;
				}
			if (document.estiForm.stationeryEnvelopes.value == 3000){
				tp += 471;
				}
			if (document.estiForm.stationeryEnvelopes.value == 3500){
				tp += 525;
				}
			if (document.estiForm.stationeryEnvelopes.value == 4000){
				tp += 579;
				}
			if (document.estiForm.stationeryEnvelopes.value == 4500){
				tp += 633;
				}
			if (document.estiForm.stationeryEnvelopes.value == 5000){
				tp += 687;
				}
			}
		else if (document.estiForm.stationeryEnvelopesSize.value == ("#10 (9.5 x 4.125)")){
			if (document.estiForm.stationeryEnvelopes.value == 500){
				tp += 208;
				}
			if (document.estiForm.stationeryEnvelopes.value == 1000){
				//alert("1000 #10 envelopes = $251");
				tp += 251;
				}
			if (document.estiForm.stationeryEnvelopes.value == 1500){
				tp += 297;
				}
			if (document.estiForm.stationeryEnvelopes.value == 2000){
				tp += 338;
				}
			if (document.estiForm.stationeryEnvelopes.value == 2500){
				tp += 385;
				}
			if (document.estiForm.stationeryEnvelopes.value == 3000){
				tp += 433;
				}
			if (document.estiForm.stationeryEnvelopes.value == 3500){
				tp += 480;
				}
			if (document.estiForm.stationeryEnvelopes.value == 4000){
				tp += 528;
				}
			if (document.estiForm.stationeryEnvelopes.value == 4500){
				tp += 576;
				}
			if (document.estiForm.stationeryEnvelopes.value == 5000){
				tp += 623;
				}
			}

		else if (document.estiForm.stationeryEnvelopesSize.value == ("A6 (6.5 x 4.75)")){
			if (document.estiForm.stationeryEnvelopes.value == 500){
				tp += 220;
				}
			if (document.estiForm.stationeryEnvelopes.value == 1000){
				//alert("1000 #10 envelopes = $251");
				tp += 272;
				}
			if (document.estiForm.stationeryEnvelopes.value == 1500){
				tp += 324;
				}
			if (document.estiForm.stationeryEnvelopes.value == 2000){
				tp += 376;
				}
			if (document.estiForm.stationeryEnvelopes.value == 2500){
				tp += 433;
				}
			if (document.estiForm.stationeryEnvelopes.value == 3000){
				tp += 490;
				}
			if (document.estiForm.stationeryEnvelopes.value == 3500){
				tp += 548;
				}
			if (document.estiForm.stationeryEnvelopes.value == 4000){
				tp += 605;
				}
			if (document.estiForm.stationeryEnvelopes.value == 4500){
				tp += 662;
				}
			if (document.estiForm.stationeryEnvelopes.value == 5000){
				tp += 719;
				}
			}

		else if (document.estiForm.stationeryEnvelopesSize.value == ("A7 (7.25 x 5.25)")){
			if (document.estiForm.stationeryEnvelopes.value == 500){
				tp += 235;
				}
			if (document.estiForm.stationeryEnvelopes.value == 1000){
				//alert("1000 #10 envelopes = $251");
				tp += 298;
				}
			if (document.estiForm.stationeryEnvelopes.value == 1500){
				tp += 360;
				}
			if (document.estiForm.stationeryEnvelopes.value == 2000){
				tp += 423;
				}
			if (document.estiForm.stationeryEnvelopes.value == 2500){
				tp += 492;
				}
			if (document.estiForm.stationeryEnvelopes.value == 3000){
				tp += 561;
				}
			if (document.estiForm.stationeryEnvelopes.value == 3500){
				tp += 630;
				}
			if (document.estiForm.stationeryEnvelopes.value == 4000){
				tp += 699;
				}
			if (document.estiForm.stationeryEnvelopes.value == 4500){
				tp += 768;
				}
			if (document.estiForm.stationeryEnvelopes.value == 5000){
				tp += 837;
				}
			}

		else if (document.estiForm.stationeryEnvelopesSize.value == ("#10 Window")){
			if (document.estiForm.stationeryEnvelopes.value == 500){
				tp += 169;
				}
			if (document.estiForm.stationeryEnvelopes.value == 1000){
				//alert("1000 #10 envelopes = $251");
				tp += 245.50;
				}
			if (document.estiForm.stationeryEnvelopes.value == 1500){
				tp += 286.50;
				}
			if (document.estiForm.stationeryEnvelopes.value == 2000){
				tp += 327.50;
				}
			if (document.estiForm.stationeryEnvelopes.value == 2500){
				tp += 372.50;
				}
			if (document.estiForm.stationeryEnvelopes.value == 3000){
				tp += 417.50;
				}
			if (document.estiForm.stationeryEnvelopes.value == 3500){
				tp += 462.50;
				}
			if (document.estiForm.stationeryEnvelopes.value == 4000){
				tp += 508;
				}
			if (document.estiForm.stationeryEnvelopes.value == 4500){
				tp += 553;
				}
			if (document.estiForm.stationeryEnvelopes.value == 5000){
				tp += 598;
				}
			}

		else if (document.estiForm.stationeryEnvelopesSize.value == ("#9 Remit")){
			if (document.estiForm.stationeryEnvelopes.value == 500){
				tp += 335;
				}
			if (document.estiForm.stationeryEnvelopes.value == 1000){
				tp += 420;
				}
			if (document.estiForm.stationeryEnvelopes.value == 1500){
				tp += 505;
				}
			if (document.estiForm.stationeryEnvelopes.value == 2000){
				tp += 590;
				}
			if (document.estiForm.stationeryEnvelopes.value == 2500){
				tp += 684;
				}
			if (document.estiForm.stationeryEnvelopes.value == 3000){
				tp += 778;
				}
			if (document.estiForm.stationeryEnvelopes.value == 3500){
				tp += 876.50;
				}
			if (document.estiForm.stationeryEnvelopes.value == 4000){
				tp += 975;
				}
			if (document.estiForm.stationeryEnvelopes.value == 4500){
				tp += 1074;
				}
			if (document.estiForm.stationeryEnvelopes.value == 5000){
				tp += 1173.50;
				}
			}

		else if (document.estiForm.stationeryEnvelopesSize.value == ("#6.5 Remit (6.25 x 3.5)")){
			if (document.estiForm.stationeryEnvelopes.value == 500){
				tp += 312;
				}
			if (document.estiForm.stationeryEnvelopes.value == 1000){
				tp += 385;
				}
			if (document.estiForm.stationeryEnvelopes.value == 1500){
				tp += 457.50;
				}
			if (document.estiForm.stationeryEnvelopes.value == 2000){
				tp += 530;
				}
			if (document.estiForm.stationeryEnvelopes.value == 2500){
				tp += 609.50;
				}
			if (document.estiForm.stationeryEnvelopes.value == 3000){
				tp += 689;
				}
			if (document.estiForm.stationeryEnvelopes.value == 3500){
				tp += 773;
				}
			if (document.estiForm.stationeryEnvelopes.value == 4000){
				tp += 857;
				}
			if (document.estiForm.stationeryEnvelopes.value == 4500){
				tp += 941;
				}
			if (document.estiForm.stationeryEnvelopes.value == 5000){
				tp += 1025;
				}
			}

		else if (document.estiForm.stationeryEnvelopesSize.value == ("A2 (4.375 x 5.75)")){
			if (document.estiForm.stationeryEnvelopes.value == 500){
				tp += 212;
				}
			if (document.estiForm.stationeryEnvelopes.value == 1000){
				tp += 259;
				}
			if (document.estiForm.stationeryEnvelopes.value == 1500){
				tp += 305;
				}
			if (document.estiForm.stationeryEnvelopes.value == 2000){
				tp += 351;
				}
			if (document.estiForm.stationeryEnvelopes.value == 2500){
				tp += 402;
				}
			if (document.estiForm.stationeryEnvelopes.value == 3000){
				tp += 453;
				}
			if (document.estiForm.stationeryEnvelopes.value == 3500){
				tp += 504;
				}
			if (document.estiForm.stationeryEnvelopes.value == 4000){
				tp += 555;
				}
			if (document.estiForm.stationeryEnvelopes.value == 4500){
				tp += 606.50;
				}
			if (document.estiForm.stationeryEnvelopes.value == 5000){
				tp += 658;
				}
			}

		else if (document.estiForm.stationeryEnvelopesSize.value == ("9 x 12 Catalog")){
			if (document.estiForm.stationeryEnvelopes.value == 500){
				tp += 282;
				}
			if (document.estiForm.stationeryEnvelopes.value == 1000){
				tp += 378;
				}
			if (document.estiForm.stationeryEnvelopes.value == 1500){
				tp += 474;
				}
			if (document.estiForm.stationeryEnvelopes.value == 2000){
				tp += 570;
				}
			if (document.estiForm.stationeryEnvelopes.value == 2500){
				tp += 675.50;
				}
			if (document.estiForm.stationeryEnvelopes.value == 3000){
				tp += 781;
				}
			if (document.estiForm.stationeryEnvelopes.value == 3500){
				tp += 887;
				}
			if (document.estiForm.stationeryEnvelopes.value == 4000){
				tp += 993;
				}
			if (document.estiForm.stationeryEnvelopes.value == 4500){
				tp += 1098.50;
				}
			if (document.estiForm.stationeryEnvelopes.value == 5000){
				tp += 1204;
				}
			}

		if (document.estiForm.productFamily.value == ("Stationery-Envelopes")) {
			if (document.estiForm.stationeryEnvelopesSize.value == ("#9 (8.875 x 3.875)") || document.estiForm.stationeryEnvelopesSize.value == ("#10 (9.5 x 4.125)")
				|| document.estiForm.stationeryEnvelopesSize.value == ("A6 (6.5 x 4.75)") || document.estiForm.stationeryEnvelopesSize.value == ("A7 (7.25 x 5.25)") 
				|| document.estiForm.stationeryEnvelopesSize.value == ("A2 (4.375 x 5.75)") ) {		
				if (document.estiForm.everestNatural[0] && document.estiForm.everestNatural[0].type=='radio') {
					for (var i=0; i < document.estiForm.everestNatural.length; i++) {
						if (document.estiForm.everestNatural[i].checked) {
							var everestNaturalSelected = document.estiForm.everestNatural[i].value;
							if (everestNaturalSelected == 'yes') {
								var everestNaturalCharge = ((quantity / 1000) * 30);
								tp = tp + everestNaturalCharge;
							}
						}
					}
				}
			}
		}

		if (document.estiForm.productFamily.value == ("Stationery-Letterhead")) {
			if (document.estiForm.everestNatural[0] && document.estiForm.everestNatural[0].type=='radio') {
				for (var i=0; i < document.estiForm.everestNatural.length; i++) {
					if (document.estiForm.everestNatural[i].checked) {
						var everestNaturalSelected = document.estiForm.everestNatural[i].value;
						if (everestNaturalSelected == 'yes') {
							var everestNaturalCharge = (((document.estiForm.stationeryLetterhead.value / 1000) * 30) + ((document.estiForm.stationeryLetterheadBlank.value / 1000) * 30));
							tp = tp + everestNaturalCharge;
						}
					}
				}
			}			
		}

		if (document.estiForm.stationeryEnvColors.value == ("Black Only")){
			tp += 0;
			}
		//only charge for additional PMS ink mix on envelopes if we haven't already charged for it on letterhead
		if ((document.estiForm.stationeryEnvColors.value == ("1 PMS") || document.estiForm.stationeryEnvColors.value == ("Black + PMS") || document.estiForm.stationeryEnvColors.value == ("2 PMS")) && (!document.estiForm.stationeryLetterhead.options || document.estiForm.stationeryLetterhead.selectedIndex == 0 || document.estiForm.letterheadColors.value == ("Black Only"))){
			//alert("adding 60 bucks for PMS mix = $311");
			tp += 60;
			}
		// 60 bucks for extra PMS ink mix on envelope if not on letterhead
		if (document.estiForm.stationeryEnvColors.value == ("2 PMS") && (document.estiForm.stationeryLetterhead.selectedIndex == 0 || document.estiForm.letterheadColors.value != ("2 PMS"))){
			//alert("adding another 60 bucks for 2nd PMS mix = $371");
			tp += 60;
			}
		// additional plate and washup for PMS
		if ((document.estiForm.stationeryEnvColors.value == ("Black + PMS") || document.estiForm.stationeryEnvColors.value == ("2 PMS")) && document.estiForm.stationeryEnvelopes.value == 500){
			tp += 58
			}
			else if ((document.estiForm.stationeryEnvColors.value == ("Black + PMS") || document.estiForm.stationeryEnvColors.value == ("2 PMS")) && document.estiForm.stationeryEnvelopes.value == 1000){
				//alert("adding 62 bucks for extra plate and washup of PMS = $433");
				tp += 62
			}
			else if ((document.estiForm.stationeryEnvColors.value == ("Black + PMS") || document.estiForm.stationeryEnvColors.value == ("2 PMS")) && document.estiForm.stationeryEnvelopes.value == 1500){
				tp += 65
			}
			else if ((document.estiForm.stationeryEnvColors.value == ("Black + PMS") || document.estiForm.stationeryEnvColors.value == ("2 PMS")) && document.estiForm.stationeryEnvelopes.value == 2000){
				tp += 69
			}
			else if ((document.estiForm.stationeryEnvColors.value == ("Black + PMS") || document.estiForm.stationeryEnvColors.value == ("2 PMS")) && document.estiForm.stationeryEnvelopes.value == 2500){
				tp += 73
			}
			else if ((document.estiForm.stationeryEnvColors.value == ("Black + PMS") || document.estiForm.stationeryEnvColors.value == ("2 PMS")) && document.estiForm.stationeryEnvelopes.value == 3000){
				tp += 77
			}
			else if ((document.estiForm.stationeryEnvColors.value == ("Black + PMS") || document.estiForm.stationeryEnvColors.value == ("2 PMS")) && document.estiForm.stationeryEnvelopes.value == 3500){
				tp += 81
			}
			else if ((document.estiForm.stationeryEnvColors.value == ("Black + PMS") || document.estiForm.stationeryEnvColors.value == ("2 PMS")) && document.estiForm.stationeryEnvelopes.value == 4000){
				tp += 85
			}
			else if ((document.estiForm.stationeryEnvColors.value == ("Black + PMS") || document.estiForm.stationeryEnvColors.value == ("2 PMS")) && document.estiForm.stationeryEnvelopes.value == 4500){
				tp += 89
			}
			else if ((document.estiForm.stationeryEnvColors.value == ("Black + PMS") || document.estiForm.stationeryEnvColors.value == ("2 PMS")) && document.estiForm.stationeryEnvelopes.value == 5000){
				tp += 93
			}
	}
	tp = (tp + sbc);
	
	if (document.estiForm.turnaround.value == ("7 day")) {
		tp = tp - (tp * .05)
		}
		
	if (document.estiForm.turnaround.value == ("3 day")) {
		tp = tp + (tp * .15)
		}
		
	if (document.estiForm.turnaround[0] && document.estiForm.turnaround[0].type=='radio') {
	for (var i=0; i < document.estiForm.turnaround.length; i++) {
		if (document.estiForm.turnaround[i].checked) {
			var turn_val = document.estiForm.turnaround[i].value;
			if (turn_val == '7 day')
				tp = tp - (tp * .05)
			else if (turn_val == '3 day')
				tp = tp + (tp * .15)				}
			}
		}	
	


	//final multi-product discount to bring pricing more into line with Robert's - BV
	if (document.estiForm.stationeryLetterhead.options && document.estiForm.stationeryLetterheadBlank.options && document.estiForm.stationeryLetterheadBlank.options && document.estiForm.stationeryEnvelopes.options) {
		if (document.estiForm.stationeryLetterhead.selectedIndex != 0 &&
			((document.estiForm.stationeryEnvelopes.selectedIndex != 0 && document.estiForm.stationeryBizCardQuantity.value == 0)
		 	|| (document.estiForm.stationeryEnvelopes.selectedIndex == 0 && document.estiForm.stationeryBizCardQuantity.value != 0))) {
		 	//alert("6% discount for letterhead and bizcards or envelopes");
		 	tp = (tp * .94);
		 	}
	
		else if (document.estiForm.stationeryLetterhead.selectedIndex == 0 &&
			(document.estiForm.stationeryEnvelopes.selectedIndex != 0 && document.estiForm.stationeryBizCardQuantity.value != 0)) {
		 	//alert("6% discount for bizcards and envelopes");
		 	tp = (tp * .94);
		 	}
		 	
		else if (document.estiForm.stationeryLetterhead.selectedIndex != 0 &&
			document.estiForm.stationeryEnvelopes.selectedIndex != 0 && 
			document.estiForm.stationeryBizCardQuantity.value != 0) {
		 	//alert("10% discount for ordering all 3 products!");
		 	tp = (tp * .9);
		 	}
	}		
	//document.estiForm.si.value=si;
	//document.estiForm.tsi.value=tsi;
	//si = (document.estiForm.height.value * document.estiForm.width.value);
	//height = document.estiForm.height.value;
	//width = document.estiForm.width.value
	//tsi = (si * quantity);
	//ppu = (tp / (document.estiForm.realquant.value));
	
	if (mode && mode == 1) {
		updatePrice("ppu", formatCurrency(ppu), ppu, quantity);
		updatePrice("tp", formatCurrency2(tp), Math.round(tp), quantity);
	}
	else {
		var grandTotal = tp;
		updateText("myTp", formatCurrency(grandTotal));
		updateText("myTp2", formatCurrency(grandTotal));
		//document.estiForm.ppu.value=formatCurrency(ppu);
		document.estiForm.tp.value=formatCurrency(tp);
		printTotal = grandTotal;
		document.estiForm.printCost.value = formatAsMoney(printTotal);
	}
	setFinalSize();	
}


function calculateBizCardPrice(mode) {
	// Remove non-numeric characters
	document.estiForm.quantity.value = document.estiForm.quantity.value.replace(/\D/g, "");
	//alert(mode)
	if (setQuant() <= 0 && document.estiForm.tp) {
		document.estiForm.tp.value=formatCurrency(0);
		document.estiForm.ppu.value=formatCurrency(0);
		return true;
	}
	else if (setQuant() <= 0) {
		updatePrice("tp", formatCurrency(0), 0, document.estiForm.quantity.value);
		updatePrice("ppu", formatCurrency(0), 0, document.estiForm.quantity.value);
		return true;
	}

	productFamily = document.estiForm.productFamily.value;	
	quantity = document.estiForm.realquant.value;
	
	//square inches, height, width
	if (document.estiForm.height.options) {
		si = (document.estiForm.height.options[document.estiForm.height.selectedIndex].value * document.estiForm.width.options[document.estiForm.width.selectedIndex].value);
		height = document.estiForm.height.options[document.estiForm.height.selectedIndex].value;
		width = document.estiForm.width.options[document.estiForm.width.selectedIndex].value
		colors = document.estiForm.colors.options[document.estiForm.colors.selectedIndex].value;
	}
	else {
		si = (document.estiForm.height.value * document.estiForm.width.value);
		height = document.estiForm.height.value;
		width = document.estiForm.width.value
		colors = document.estiForm.colors.value;
	}	//total square inches

	if (document.estiForm.finalHeight) {
		var finalHeight = document.estiForm.finalHeight.value;
		var finalWidth = document.estiForm.finalWidth.value;
	}
	tsi = (si * quantity);
	if (document.estiForm.mailing) {
		var mailRate = document.estiForm.mailing.options[document.estiForm.mailing.selectedIndex].value;
		var mailQuant = document.estiForm.mailQuant.value;
		if (document.estiForm.mailing.options[document.estiForm.mailing.selectedIndex].value != "no" && mailQuant > 0) {
			var weightPerUnit = getUnitWeightOnces(tsi, quantity);
			if (document.estiForm.weightPerUnit) document.estiForm.weightPerUnit.value=weightPerUnit;
			if (document.estiForm.fold && document.estiForm.fold.options[document.estiForm.fold.selectedIndex].value != 'no') {
				var mailPostage = (calcPostage(productFamily, (finalHeight*finalWidth), weightPerUnit, mailQuant, mailRate))?calcPostage(productFamily, (finalHeight*finalWidth), weightPerUnit, mailQuant, mailRate):0;
			}
			else
				var mailPostage = (calcPostage(productFamily, si, weightPerUnit, mailQuant, mailRate))?calcPostage(productFamily, si, weightPerUnit, mailQuant, mailRate):0;
			var mailLabor = (calcMailLabor(si, weightPerUnit, mailQuant, mailRate))?calcMailLabor(si, weightPerUnit, mailQuant, mailRate):0;
			//alert("unitWeight:" + weightPerUnit + "\nmailPostage:" + mailPostage + "\nmailLabor:" + mailLabor);
			
			var totalMailingCost = (mailPostage + mailLabor);
			updateText("mailCostTop", formatCurrency2(totalMailingCost));
			updateText("myMailCost", formatCurrency2(totalMailingCost));
			totalMailingCost = Math.round(totalMailingCost); //round it to the nearest buck
			document.estiForm.mailCost.value = formatAsMoney(totalMailingCost); //then add two zero's to the end
			var shipQuant = (quantity - mailQuant);
			updateText("myShipQuant", shipQuant);
			document.estiForm.shipQuant.value = shipQuant;
		}
		else {
			var totalMailingCost = 0;
			updateText("mailCostTop", formatCurrency2(totalMailingCost));
			updateText("myShipQuant", quantity);
			document.estiForm.shipQuant.value = quantity;
			document.estiForm.mailCost.value = "0.00";
		}
	}
	else {
		if (document.estiForm.shipQuant) document.estiForm.shipQuant.value = quantity;
		if (document.estiForm.mailCost) document.estiForm.mailCost.value = "0.00";
	}

	if (productFamily=="BusCard") {	
		if (document.getElementById('bc_name_one') && document.getElementById('bc_name_one').style.display == 'block') {
			if (document.estiForm.cardQuant1.value == "250")
				tp = 29.50
			if (document.estiForm.cardQuant1.value == "500")
				tp = 39.50
			if (document.estiForm.cardQuant1.value == "1000")
				tp = 60.00
			if (document.estiForm.cardQuant1.value == "1500")
				tp = 99.50
			if (document.estiForm.cardQuant1.value == "2000")
				tp = 120			
			if (colors == "4over4" && document.estiForm.cardQuant1.value != "0")
				tp = tp + 15
			if ((colors == "4over1" || colors == "4over0") && document.estiForm.cardQuant1.value != "0")
				tp = tp + 10
		}
		if (document.getElementById('bc_name_two') && document.getElementById('bc_name_two').style.display == 'block') {
			if (document.estiForm.cardQuant2.value == "250")
				tp = tp + 29.50
			if (document.estiForm.cardQuant2.value == "500")
				tp = tp + 39.50
			if (document.estiForm.cardQuant2.value == "1000")
				tp = tp + 60.00
			if (document.estiForm.cardQuant2.value == "1500")
				tp = tp + 99.50
			if (document.estiForm.cardQuant2.value == "2000")
				tp = tp + 120			
			if (colors == "4over4" && document.estiForm.cardQuant2.value != "0")
				tp = tp + 15
			if ((colors == "4over1" || colors == "4over0") && document.estiForm.cardQuant2.value != "0")
				tp = tp + 10
		}
		if (document.getElementById('bc_name_three') && document.getElementById('bc_name_three').style.display == 'block') {
			if (document.estiForm.cardQuant3.value == "250")
				tp = tp + 29.50
			if (document.estiForm.cardQuant3.value == "500")
				tp = tp + 39.50
			if (document.estiForm.cardQuant3.value == "1000")
				tp = tp + 60.00
			if (document.estiForm.cardQuant3.value == "1500")
				tp = tp + 99.50
			if (document.estiForm.cardQuant3.value == "2000")
				tp = tp + 120			
			if (colors == "4over4" && document.estiForm.cardQuant3.value != "0")
				tp = tp + 15
			if ((colors == "4over1" || colors == "4over0") && document.estiForm.cardQuant3.value != "0")
				tp = tp + 10
		}
		if (document.getElementById('bc_name_four') && document.getElementById('bc_name_four').style.display == 'block') {
			if (document.estiForm.cardQuant4.value == "250")
				tp = tp + 29.50
			if (document.estiForm.cardQuant4.value == "500")
				tp = tp + 39.50
			if (document.estiForm.cardQuant4.value == "1000")
				tp = tp + 60.00
			if (document.estiForm.cardQuant4.value == "1500")
				tp = tp + 99.50
			if (document.estiForm.cardQuant4.value == "2000")
				tp = tp + 120			
			if (colors == "4over4" && document.estiForm.cardQuant4.value != "0")
				tp = tp + 15
			if ((colors == "4over1" || colors == "4over0") && document.estiForm.cardQuant4.value != "0")
				tp = tp + 10
		}
		if (document.getElementById('bc_name_five') && document.getElementById('bc_name_five').style.display == 'block') {
			if (document.estiForm.cardQuant5.value == "250")
				tp = tp + 29.50
			if (document.estiForm.cardQuant5.value == "500")
				tp = tp + 39.50
			if (document.estiForm.cardQuant5.value == "1000")
				tp = tp + 60.00
			if (document.estiForm.cardQuant5.value == "1500")
				tp = tp + 99.50
			if (document.estiForm.cardQuant5.value == "2000")
				tp = tp + 120			
			if (colors == "4over4" && document.estiForm.cardQuant5.value != "0")
				tp = tp + 15
			if ((colors == "4over1" || colors == "4over0") && document.estiForm.cardQuant5.value != "0")
				tp = tp + 10
		}
		if (document.getElementById('bc_name_six') && document.getElementById('bc_name_six').style.display == 'block') {
			if (document.estiForm.cardQuant6.value == "250")
				tp = tp + 29.50
			if (document.estiForm.cardQuant6.value == "500")
				tp = tp + 39.50
			if (document.estiForm.cardQuant6.value == "1000")
				tp = tp + 60.00
			if (document.estiForm.cardQuant6.value == "1500")
				tp = tp + 99.50
			if (document.estiForm.cardQuant6.value == "2000")
				tp = tp + 120			
			if (colors == "4over4" && document.estiForm.cardQuant6.value != "0")
				tp = tp + 15
			if ((colors == "4over1" || colors == "4over0") && document.estiForm.cardQuant6.value != "0")
				tp = tp + 10
		}
		if (document.getElementById('bc_name_seven') && document.getElementById('bc_name_seven').style.display == 'block') {
			if (document.estiForm.cardQuant7.value == "250")
				tp = tp + 29.50
			if (document.estiForm.cardQuant7.value == "500")
				tp = tp + 39.50
			if (document.estiForm.cardQuant7.value == "1000")
				tp = tp + 60.00
			if (document.estiForm.cardQuant7.value == "1500")
				tp = tp + 99.50
			if (document.estiForm.cardQuant7.value == "2000")
				tp = tp + 120			
			if (colors == "4over4" && document.estiForm.cardQuant7.value != "0")
				tp = tp + 15
			if ((colors == "4over1" || colors == "4over0") && document.estiForm.cardQuant7.value != "0")
				tp = tp + 10
		}
		if (document.getElementById('bc_name_eight') && document.getElementById('bc_name_eight').style.display == 'block') {
			if (document.estiForm.cardQuant8.value == "250")
				tp = tp + 29.50
			if (document.estiForm.cardQuant8.value == "500")
				tp = tp + 39.50
			if (document.estiForm.cardQuant8.value == "1000")
				tp = tp + 60.00
			if (document.estiForm.cardQuant8.value == "1500")
				tp = tp + 99.50
			if (document.estiForm.cardQuant8.value == "2000")
				tp = tp + 120			
			if (colors == "4over4" && document.estiForm.cardQuant8.value != "0")
				tp = tp + 15
			if ((colors == "4over1" || colors == "4over0") && document.estiForm.cardQuant8.value != "0")
				tp = tp + 10
		}
	}	
	
	if (productFamily == "w2pBusCard-1person" || productFamily == "w2pBusCardSS-1person") {
		cardQuant1 = document.estiForm.cardQuant1.value;
			if (quantity == "250") {
				tp = 29.50
			}
			if (quantity == "500") {
				tp = 39.50
			}
			if (quantity == "1000") {
				tp = 60
			}
			if (quantity == "1500") {
				tp = 99.50
			}	
			if (quantity == "2000") {
				tp = 120
			}
		}
		
	if (productFamily == "w2pBusCard-2person" || productFamily == "w2pBusCardSS-2person") {
		cardQuant1 = document.estiForm.cardQuant1.value;
			if (quantity == "500") {
				tp = 59
			}
			if (quantity == "1000") {
				tp = 79
			}
			if (quantity == "2000") {
				tp = 120
			}
			if (quantity == "3000") {
				tp = 199
			}	
			if (quantity == "4000") {
				tp = 240
			}
	}

	if (productFamily == "w2pBusCard-3person" || productFamily == "w2pBusCardSS-3person") {
		cardQuant1 = document.estiForm.cardQuant1.value;
			if (quantity == "750") {
				tp = 88.5
			}
			if (quantity == "1500") {
				tp = 118.5
			}
			if (quantity == "3000") {
				tp = 180
			}
			if (quantity == "4500") {
				tp = 298.50
			}	
			if (quantity == "6000") {
				tp = 360
			}
	}

	if (productFamily == "w2pBusCard-4person" || productFamily == "w2pBusCardSS-4person") {
		cardQuant1 = document.estiForm.cardQuant1.value;
			if (quantity == "1000") {
				tp = 118
			}
			if (quantity == "2000") {
				tp = 158
			}
			if (quantity == "4000") {
				tp = 240
			}
			if (quantity == "6000") {
				tp = 398
			}	
			if (quantity == "8000") {
				tp = 480
			}
	}

		var totalQuant = quantity;
		updateText("myTq", (totalQuant));
		//alert("Line 2362 quantity: " + quantity);
	
	// add 25% for 5-day turn
	if (document.estiForm.turnaround && document.estiForm.turnaround.value == "5 day"){
			tp = (tp + (tp * .25)) ;
			//alert("adding 25% for 5-day turn")
	}

	// add 45% for 3-day turn
	if (document.estiForm.turnaround && document.estiForm.turnaround.value == "3 day"){
			tp = (tp + (tp * .45)) ;
			//alert("adding 45% for 3-day turn")
	}

	if (document.estiForm.turnaround[0] && document.estiForm.turnaround[0].type=='radio') {
		for (var i=0; i < document.estiForm.turnaround.length; i++) {
			if (document.estiForm.turnaround[i].checked) {
				var turn_val = document.estiForm.turnaround[i].value;
				if (turn_val == '5 day')
					tp = (tp + (tp * .25)) ;
				else if (turn_val == '3 day')
					tp = (tp + (tp * .45)) ;
			}
		}
	}	

	
	// add flat fee of $30 for hard proof (per Grant... price is meant to discourage!)
	if (document.estiForm.proof && document.estiForm.proof.value == "HardProof"){
			tp = (tp + 30) ;
			//alert("adding $30 for hard proof")
	}

	// add flat fee of $10 for Sakura or Primavera (per Grant) - removed this when I made double-thick the only available option!
	//if (document.estiForm.paper && document.estiForm.paper.value != "95_nl_rein_cover"){
			//tp = (tp + 10) ;
			//alert("adding cost non-reincarnation paper")
	//}

	//add rounded corners charge business cards	
	if (document.estiForm.productFamily && (document.estiForm.productFamily.value == "BusCard" || document.estiForm.productFamily.value.indexOf("w2pBusCard") != -1)) {
		if (document.estiForm.round_corners.value == "yes"){
			roundCorners = (25 + ((quantity - 250) * .03));
			tp = tp + roundCorners;
		}
	}

	//add shapeCut charge	
		if (document.estiForm.shapeCut && document.estiForm.shapeCut.value == "yes"){
			tp = (tp * 1.5);
		}

	//add 25% for kraft paper
		if (document.estiForm.paper && document.estiForm.paper.value == "20pt_kraftboard"){
			tp = (tp * 1.25);
		}
	

	if (mode && mode == 1) {
		updatePrice("ppu", formatCurrency(ppu), ppu, quantity);
		updatePrice("tp", formatCurrency2(tp), Math.round(tp), quantity);
	}
	else {
		var grandTotal = tp;
		updateText("myTp", formatCurrency(grandTotal));
		updateText("myTp2", formatCurrency(grandTotal));
		//document.estiForm.ppu.value=formatCurrency(ppu);
		document.estiForm.tp.value=formatCurrency(tp);
		printTotal = grandTotal;
		document.estiForm.printCost.value = formatAsMoney(printTotal);
	}

}	

function proofWarning() {
	if (document.estiForm.variableData && document.estiForm.variableData.value == "yes") {
		//calculate();
		//document.estiForm.jobname.value =  document.jobnameform.jobname.value;
		enableAll();
		document.estiForm.submit();	
	}
	else if (document.estiForm.proof && document.estiForm.proof.value == "SoftProof") {
		if (document.estiForm.productFamily && 
			document.estiForm.productFamily.value != "BusCard" && 
			document.estiForm.productFamily.value != "Stationery-Package" && 
			document.estiForm.productFamily.value != "Stationery-Business Cards" && 
			document.estiForm.productFamily.value != "Stationery-Letterhead" && 
			document.estiForm.productFamily.value != "Stationery-Envelopes" && 
			document.estiForm.productFamily.value != "Booklet" && 
			document.estiForm.productFamily.value != "Catalog" && 
			document.estiForm.productFamily.value != "Calendar" && 
			document.estiForm.productFamily.value != "Folder" && 
			document.estiForm.productFamily.value != "Folder 4x9" && 
			document.estiForm.productFamily.value != "3 Panel Folder" && 
			document.estiForm.productFamily.value != "CD Sleeve 5x5" && 
			document.estiForm.productFamily.value != "Doorhanger") {			
			var r=confirm("You have chosen a soft proof. Since computer monitors reproduce colors differently than printing presses, we cannot guarantee color matching to soft proofs.\n\nFor color critical projects, please request a hardcopy proof which can be matched.\n\nClick \"OK\" to proceed with a soft proof. Click \"Cancel\" to edit your order and select a hardcopy proof.")
				if (r==true) {
					calculate();
					enableAll();
					document.estiForm.submit();
				}
				else {
					return;
				}
			}
		else if (document.estiForm.productFamily && document.estiForm.productFamily.value == "BusCard") {
			var r=confirm("You have chosen a soft proof for your business cards. Since computer monitors reproduce colors differently than printing presses, we cannot guarantee color matching to soft proofs.\n\nFor color critical projects, please request a hardcopy proof which can be matched.\n\nClick \"OK\" to proceed with a soft proof. Click \"Cancel\" to edit your order and select a hardcopy proof.")
				if (r==true) {
 					calculateBizCardPrice();
					checkNameQuant();		
				}
				else {
					return;
				}
			}
		else if (document.estiForm.productFamily && (document.estiForm.productFamily.value == "Folder" || document.estiForm.productFamily.value == "Folder 4x9" 
			|| document.estiForm.productFamily.value=="CD Sleeve 5x5" || document.estiForm.productFamily.value=="Doorhanger" || document.estiForm.productFamily.value == "3 Panel Folder")) {			
			var r=confirm("You have chosen a soft proof. Since computer monitors reproduce colors differently than printing presses, we cannot guarantee color matching to soft proofs.\n\nFor color critical projects, please request a hardcopy proof which can be matched.\n\nClick \"OK\" to proceed with a soft proof. Click \"Cancel\" to edit your order and select a hardcopy proof.")
				if (r==true) {
					calculate_folder();
					enableAll();
					document.estiForm.submit();				
				}
				else {
					return;
				}
			}
		else if (document.estiForm.productFamily && document.estiForm.productFamily.value == "Booklet" ||
				document.estiForm.productFamily.value == "Catalog" || 
				document.estiForm.productFamily.value == "Calendar") {			
			var r=confirm("You have chosen a soft proof. Since computer monitors reproduce colors differently than printing presses, we cannot guarantee color matching to soft proofs.\n\nFor color critical projects, please request a hardcopy proof which can be matched.\n\nClick \"OK\" to proceed with a soft proof. Click \"Cancel\" to edit your order and select a hardcopy proof.")
				if (r==true) {
					calculate_multi();
					enableAll();
					document.estiForm.submit();				
				}
				else {
					return;
				}
			}
		else if (document.estiForm.productFamily && 
				document.estiForm.productFamily.value == "Stationery-Letterhead" || 
				document.estiForm.productFamily.value == "Stationery-Envelopes") {			
		 	var r=confirm('Since we offer only PDF soft proofs for our stationery products, it is strongly recommended that you refer to a Pantone Uncoated Color Guide to ensure color accuracy.');
				if (r==true) {
					calculateStationery();
					enableAll();
					document.estiForm.submit();				
				}
				else {
					return;
				}
			}
		else if (document.estiForm.productFamily && 
				document.estiForm.productFamily.value == "Stationery-Business Cards" ||
				document.estiForm.productFamily.value == "Stationery-Package") {			
		 	var r=confirm('Since we offer only PDF soft proofs for our stationery products, it is strongly recommended that you refer to a Pantone Uncoated Color Guide to ensure color accuracy.');
				if (r==true) {
					calculateStationery();
					checkStationeryNameQuant();									
				}
				else {
					return;
				}
			}
						
		}
	else if (document.estiForm.proof && document.estiForm.proof.value == "HardProof" && document.estiForm.productFamily && document.estiForm.productFamily.value != "BusCard" ) {
		if (document.estiForm.productFamily && (document.estiForm.productFamily.value == "Folder" || document.estiForm.productFamily.value == "Folder 4x9" 
			|| document.estiForm.productFamily.value=="CD Sleeve 5x5" || document.estiForm.productFamily.value=="Doorhanger" || document.estiForm.productFamily.value == "3 Panel Folder")) {			
					calculate_folder();
					enableAll();
					document.estiForm.submit();	
		}
		else if (document.estiForm.productFamily && document.estiForm.productFamily.value == "Booklet" ||
				document.estiForm.productFamily.value == "Catalog" || 
				document.estiForm.productFamily.value == "Calendar") {			
					calculate_multi();
					enableAll();
					document.estiForm.submit();				
				}
		else {					
					calculate();
					enableAll();
					document.estiForm.submit();
			}
		}
	else if (document.estiForm.proof && document.estiForm.proof.value == "HardProof" && document.estiForm.productFamily && document.estiForm.productFamily.value == "BusCard" ) {
		calculateBizCardPrice();
		checkNameQuant();
		}
	}
	

function calculate_blankProduct() {
	document.estiForm.quantity.value = document.estiForm.quantity.value.replace(/\D/g, "");

	document.estiForm.realquant.value=document.estiForm.quantity.value;	
	document.estiForm.shipQuant.value=document.estiForm.quantity.value;

	if (document.estiForm.productFamily.value == "Blank Kraft Folder") {	
		if (document.estiForm.quantity.value <= 200)
			tp = (document.estiForm.quantity.value * .75)
		else if (document.estiForm.quantity.value <= 1000)
			tp = (document.estiForm.quantity.value * .58)
		else if (document.estiForm.quantity.value <= 5000)
			tp = (document.estiForm.quantity.value * .43)
	}

	else if (document.estiForm.productFamily.value == "Blank Gable Box") {	
		if (document.estiForm.quantity.value <= 500)
			tp = (document.estiForm.quantity.value * 1)
		else if (document.estiForm.quantity.value <= 1000)
			tp = (document.estiForm.quantity.value * .92)
		else if (document.estiForm.quantity.value <= 5000)
			tp = (document.estiForm.quantity.value * .85)
	}
	else if (document.estiForm.productFamily.value == "Blank Emboss Folder") {	
		if (document.estiForm.quantity.value <= 100)
			tp = (document.estiForm.quantity.value * 4.57)
		else if (document.estiForm.quantity.value <= 250) 
			tp = (document.estiForm.quantity.value * 2.03);
		else if (document.estiForm.quantity.value <= 500)
			tp = (document.estiForm.quantity.value * 1.20)
		else if (document.estiForm.quantity.value <= 1000)
			tp = (document.estiForm.quantity.value * .763)
		else if (document.estiForm.quantity.value <= 1500)
			tp = (document.estiForm.quantity.value * .634)
		else if (document.estiForm.quantity.value <= 2000)
			tp = (document.estiForm.quantity.value * .567)
		else if (document.estiForm.quantity.value <= 2500)
			tp = (document.estiForm.quantity.value * .518)
		else if (document.estiForm.quantity.value <= 3000)
			tp = (document.estiForm.quantity.value * .5)
		else if (document.estiForm.quantity.value <= 4000)
			tp = (document.estiForm.quantity.value * .457)
		else if (document.estiForm.quantity.value <= 5000)
			tp = (document.estiForm.quantity.value * .419)
		else if (document.estiForm.quantity.value <= 7500)
			tp = (document.estiForm.quantity.value * .386)
		else if (document.estiForm.quantity.value <= 10000)
			tp = (document.estiForm.quantity.value * .359)
		else
			tp = 0
	}
	else if (document.estiForm.productFamily.value == "Foil Stamp Folder") {	
		if (document.estiForm.quantity.value <= 100)
			tp = (document.estiForm.quantity.value * 4.52)
		else if (document.estiForm.quantity.value <= 250) 
			tp = (document.estiForm.quantity.value * 2.08);
		else if (document.estiForm.quantity.value <= 500)
			tp = (document.estiForm.quantity.value * 1.238)
		else if (document.estiForm.quantity.value <= 1000)
			tp = (document.estiForm.quantity.value * .757)
		else if (document.estiForm.quantity.value <= 1500)
			tp = (document.estiForm.quantity.value * .671)
		else if (document.estiForm.quantity.value <= 2000)
			tp = (document.estiForm.quantity.value * .615)
		else if (document.estiForm.quantity.value <= 2500)
			tp = (document.estiForm.quantity.value * .556)
		else if (document.estiForm.quantity.value <= 3000)
			tp = (document.estiForm.quantity.value * .515)
		else if (document.estiForm.quantity.value <= 4000)
			tp = (document.estiForm.quantity.value * .478)
		else if (document.estiForm.quantity.value <= 5000)
			tp = (document.estiForm.quantity.value * .444)
		else if (document.estiForm.quantity.value <= 7500)
			tp = (document.estiForm.quantity.value * .394)
		else if (document.estiForm.quantity.value <= 10000)
			tp = (document.estiForm.quantity.value * .374)
		else
			tp = 0
	}
	else {
		tp = 0;
	}
	
	/*
	tp += calcEmboss();
	tp += calcFoilstamp();
	*/
	if (document.estiForm.productFamily.value == 'Blank Kraft Folder' || document.estiForm.productFamily.value == 'Blank Emboss Folder' || document.estiForm.productFamily.value == 'Foil Stamp Folder' || document.estiForm.productFamily.value == 'Blank Gable Box') {
		si = (19 * 25); // starting flat sheet size in square inches
		tsi = (si * document.estiForm.quantity.value);
	}
		
	
	var printTotal = tp;
	var grandTotal = tp;

	updateText("myPrintCost", formatCurrency(tp));
	updateText("myMailCost", formatCurrency2(0));					
	updateText("myTp", formatCurrency(grandTotal));
	updateText("myTp2", formatCurrency(grandTotal));

	document.estiForm.tp.value=formatCurrency(tp);
	document.estiForm.printCost.value = formatAsMoney(printTotal);
}		


function blankProductQuantCheck() {
	if (document.estiForm.quantity.value > 5000) {
		document.estiForm.quantity.value = 5000;
		alert("For orders larger than 5000, please submit a custom quote!");
		calculate_blankProduct();
	}
	if (document.estiForm.quantity.value < 50) {
		document.estiForm.quantity.value = 50;
		alert("Minimum quantity is 50");
		calculate_blankProduct();
	}
}

function foilEmbossProductQuantCheck() {
	if (document.estiForm.quantity.value > 10000) {
		document.estiForm.quantity.value = 10000;
		alert("For orders larger than 10000, please submit a custom quote!");
		calculate_blankProduct();
	}
	if (document.estiForm.quantity.value < 50) {
		document.estiForm.quantity.value = 50;
		alert("Minimum quantity is 50");
		calculate_blankProduct();
	}
}
function submit_blankProduct() {
	calculate_blankProduct();
	document.estiForm.submit();	
}		


function calculate_banner() {
	document.estiForm.quantity.value = document.estiForm.quantity.value.replace(/\D/g, "");

	document.estiForm.realquant.value=document.estiForm.quantity.value;	
	document.estiForm.shipQuant.value=document.estiForm.quantity.value;

	height = document.estiForm.height.options[document.estiForm.height.selectedIndex].value;
	width = document.estiForm.width.options[document.estiForm.width.selectedIndex].value
	
	if (document.estiForm.paper.value == "biobanner")
		var materialCost = (height * width * .0042361);
	if (document.estiForm.paper.value == "matte_canvas")
		var materialCost = (height * width * .0132638)
	if (document.estiForm.paper.value == "matte_banner")
		var materialCost = (height * width * .0030555)
	var machineCost = ((( (height * width) /144) /68) * 47)
	
	tp = (((materialCost + machineCost) * 5.25) * document.estiForm.quantity.value)

	if (document.estiForm.turnaround[0] && document.estiForm.turnaround[0].type=='radio') {
		for (var i=0; i < document.estiForm.turnaround.length; i++) {
			if (document.estiForm.turnaround[i].checked) {
				var turn_val = document.estiForm.turnaround[i].value;
				if (turn_val == '5 day')
					tp = (tp + (tp * .08)) ;
				else if (turn_val == '3 day')
					tp = (tp + (tp * .2)) ;
			}
		}
	}	

	if (tp < 62)
		tp = 62;
	
	var printTotal = tp;
	var grandTotal = tp;

	updateText("myPrintCost", formatCurrency(tp));
	updateText("myMailCost", formatCurrency2(0));					
	updateText("myTp", formatCurrency(grandTotal));
	updateText("myTp2", formatCurrency(grandTotal));

	document.estiForm.tp.value=formatCurrency(tp);
	document.estiForm.printCost.value = formatAsMoney(printTotal);
}		

function bannerQuantCheck() {
	if (document.estiForm.quantity.value > 50) {
		document.estiForm.quantity.value = 50;
		alert("For more than 50 banners, please submit a custom quote!");
		calculate_banner();
	}
	if (document.estiForm.quantity.value < 1) {
		document.estiForm.quantity.value = 1;
		alert("You must select at least '1' for quantity!");
		calculate_banner();
	}
}

function submit_banner() {
	calculate_banner();
	document.estiForm.submit();	
}		

function calculate_pad() {
	document.estiForm.realquant.value=document.estiForm.quantity.value;	
	document.estiForm.shipQuant.value=document.estiForm.quantity.value;
	padQuantity = document.estiForm.quantity.value;
	document.estiForm.insideQuantity.value=(padQuantity * 50);
	if (document.estiForm.postcardSize && document.estiForm.postcardSize.value=="4 x 6") {
		document.estiForm.height.value="6";
		document.estiForm.width.value="4";
		si = (document.estiForm.height.value * document.estiForm.width.value);
		document.estiForm.finalHeight.value="6";
		document.estiForm.finalWidth.value="4";
		colors = document.estiForm.colors.value;
		if (padQuantity == "50")
			tp = 291.55
		if (padQuantity == "75")
			tp = 320.45
		if (padQuantity == "100")
			tp = 349.35
		if (padQuantity == "150")
			tp = 407.15
		if (padQuantity == "200")
			tp = 464.95
		if (padQuantity == "250")
			tp = 524.45
		if (padQuantity == "500")
			tp = 869.55
		if (padQuantity == "750")
			tp = 1177.25
		if (padQuantity == "1000")
			tp = 1323.45			
	}
	else if (document.estiForm.postcardSize && document.estiForm.postcardSize.value=="5.5 x 8.5") {
		document.estiForm.height.value="8.5";
		document.estiForm.width.value="5.5";
		si = (document.estiForm.height.value * document.estiForm.width.value);
		document.estiForm.finalHeight.value="8.5";
		document.estiForm.finalWidth.value="5.5";
		colors = document.estiForm.colors.value;
		if (padQuantity == "50")
			tp = 360.40
		if (padQuantity == "75")
			tp = 422.45
		if (padQuantity == "100")
			tp = 484.50
		if (padQuantity == "150")
			tp = 608.60
		if (padQuantity == "200")
			tp = 732.70
		if (padQuantity == "250")
			tp = 856.80
		if (padQuantity == "500")
			tp = 1281.80
		if (padQuantity == "750")
			tp = 1619.25
		if (padQuantity == "1000")
			tp = 1957.55			
	}
	else if (document.estiForm.postcardSize && document.estiForm.postcardSize.value=="2.5 x 5") {
		document.estiForm.height.value="5";
		document.estiForm.width.value="2.5";
		si = (document.estiForm.height.value * document.estiForm.width.value);
		document.estiForm.finalHeight.value="5";
		document.estiForm.finalWidth.value="2.5";
		colors = document.estiForm.colors.value;
		if (padQuantity == "50")
			tp = 265.20
		if (padQuantity == "75")
			tp = 293.25
		if (padQuantity == "100")
			tp = 321.30
		if (padQuantity == "150")
			tp = 349.35
		if (padQuantity == "200")
			tp = 377.40
		if (padQuantity == "250")
			tp = 405.45
		if (padQuantity == "500")
			tp = 635.80
		if (padQuantity == "750")
			tp = 875.08
		if (padQuantity == "1000")
			tp = 1114.35			
	}
	tsi = (si * document.estiForm.quantity.value);
	
	if (document.estiForm.kleenstick && document.estiForm.kleenstick.value == "yes")
		tp = (tp + (padQuantity * .1));

	tp = (tp + calcProof(si));
	
	if (document.estiForm.turnaround[0] && document.estiForm.turnaround[0].type=='radio') {
		for (var i=0; i < document.estiForm.turnaround.length; i++) {
			if (document.estiForm.turnaround[i].checked) {
				var turn_val = document.estiForm.turnaround[i].value;
				if (turn_val == '5 day')
					tp = (tp + (tp * .11)) ;
			}
		}
	}	
	var printTotal = tp;
	var grandTotal = tp;
	//alert("height: " + document.estiForm.finalHeight.value + ", width:" + document.estiForm.finalWidth.value + ", quantity: " + document.estiForm.realquant.value + ", paper: " + document.estiForm.paper.value + ", pages: " + document.estiForm.pages.value + ", coverPaper: " + document.estiForm.coverPaper.value + ", insideQuantity: " + document.estiForm.insideQuantity.value);

	updateText("myPrintCost", formatCurrency(tp));
	updateText("myMailCost", formatCurrency2(0));					
	updateText("myTp", formatCurrency(grandTotal));
	updateText("myTp2", formatCurrency(grandTotal));

	document.estiForm.tp.value=formatCurrency(tp);
	document.estiForm.printCost.value = formatAsMoney(printTotal);		
}

function submit_pad() {
	calculate_pad();
	document.estiForm.submit();	
}		


function calculate_DLCalendar() {
	document.estiForm.quantity.value = document.estiForm.quantity.value.replace(/\D/g, "");
	document.estiForm.press.value="NexP";

	document.estiForm.realquant.value=document.estiForm.quantity.value;	
	document.estiForm.shipQuant.value=document.estiForm.quantity.value;
	var total_pages = (parseInt(document.estiForm.pages.value));
	var inside_quantity = (document.estiForm.quantity.value * total_pages);
	document.estiForm.insideQuantity.value = inside_quantity;	

	tsi = (1215.5 * document.estiForm.quantity.value);

	if (document.estiForm.realquant.value <= 12) {
		tp = (document.estiForm.quantity.value * 15.99);
	}
	else if (document.estiForm.quantity.value <= 50) {
		tp = (document.estiForm.quantity.value * 12.99);
	}
	else if (document.estiForm.quantity.value > 50) {
		tp = (document.estiForm.quantity.value * 10.99);
	}
	else {
		tp = (document.estiForm.quantity.value * 15.99);
	}
	var printTotal = tp;
	var grandTotal = tp;

	updateText("myPrintCost", formatCurrency(tp));
	updateText("myMailCost", formatCurrency2(0));					
	updateText("myTp", formatCurrency(grandTotal));
	updateText("myTp2", formatCurrency(grandTotal));

	document.estiForm.tp.value=formatCurrency(tp);
	document.estiForm.printCost.value = formatAsMoney(printTotal);
}		

function calculate_DLPhotobook() {
	document.estiForm.quantity.value = document.estiForm.quantity.value.replace(/\D/g, "");
	document.estiForm.press.value="NexP";

	document.estiForm.realquant.value=document.estiForm.quantity.value;	
	document.estiForm.shipQuant.value=document.estiForm.quantity.value;
	var total_pages = (parseInt(document.estiForm.pageCount.value));
	var inside_quantity = (document.estiForm.quantity.value * total_pages);
	document.estiForm.insideQuantity.value = inside_quantity;	

	tsi = (1215.5 * document.estiForm.quantity.value);

	var extraPagesCharge = ((document.estiForm.pageCount.value - 24) * 1)

	if (document.estiForm.realquant.value <= 12) {
		tp = (document.estiForm.quantity.value * (29.99 + extraPagesCharge));
	}
	else if (document.estiForm.quantity.value <= 50) {
		tp = (document.estiForm.quantity.value * (27.99 + extraPagesCharge));
	}
	else if (document.estiForm.quantity.value > 50) {
		tp = (document.estiForm.quantity.value * (25.99 + extraPagesCharge));
	}
	else {
		tp = (document.estiForm.quantity.value * 29.99);
	}

	if (document.estiForm.bookCoverColor.value == "Black Leather") {
		tp = (tp + (document.estiForm.quantity.value * 2.5))
	}
	
	var printTotal = tp;
	var grandTotal = tp;

	updateText("myPrintCost", formatCurrency(tp));
	updateText("myMailCost", formatCurrency2(0));					
	updateText("myTp", formatCurrency(grandTotal));
	updateText("myTp2", formatCurrency(grandTotal));

	document.estiForm.tp.value=formatCurrency(tp);
	document.estiForm.printCost.value = formatAsMoney(printTotal);
}		


function submit_DLPhotobook() {
	calculate_DLPhotobook();
	enableAll();
	document.estiForm.submit();	
}		

function submit_DLCalendar() {
	calculate_DLCalendar();
	enableAll();
	document.estiForm.submit();	
}		

function calculate_GableBox() {
	document.estiForm.quantity.value = document.estiForm.quantity.value.replace(/\D/g, "");

	document.estiForm.realquant.value=document.estiForm.quantity.value;	
	document.estiForm.shipQuant.value=document.estiForm.quantity.value;

	quantity = document.estiForm.quantity.value;

	if (document.estiForm.paper.value == "18pt_renewal") {
		if (quantity == 1000)
			tp = 3415.74
		if (quantity == 1500) 
			tp = 4128.77;
		if (quantity == 2000)
			tp = 4851.60
		if (quantity == 2500)
			tp = 4722.30
		if (quantity == 3000)
			tp = 5159.61
		if (quantity == 3500)
			tp = 5742.96
		if (quantity == 4000)
			tp = 6325.27
		if (quantity == 4500)
			tp = 6743.50
		if (quantity == 5000)
			tp = 6802.85
		if (quantity == 6000)
			tp = 7954.16
		if (quantity == 7000)
			tp = 9006.27
		if (quantity == 8000)
			tp = 10033.35
		if (quantity == 9000)
			tp = 11075.83
		if (quantity == 10000)
			tp = 12114.46
	}

	if (document.estiForm.paper.value == "20pt_kraftboard") {
		if (quantity == 1000)
			tp = 2347.23
		if (quantity == 1500)
			tp = 2756.52
		if (quantity == 2000)
			tp = 3175.90
		if (quantity == 2500)
			tp = 3048.18
		if (quantity == 3000)
			tp = 3222.25
		if (quantity == 3500)
			tp = 3547.39
		if (quantity == 4000)
			tp = 3871.46
		if (quantity == 4500)
			tp = 4052.39
		if (quantity == 5000)
			tp = 4034.05
		if (quantity == 6000)
			tp = 4707.37
		if (quantity == 7000)
			tp = 5278.72
		if (quantity == 8000)
			tp = 5824.32
		if (quantity == 9000)
			tp = 6385.77
		if (quantity == 10000)
			tp = 6943.26
	}

	if (document.estiForm.paper.value == "24pt_C1S") {
		if (quantity == 1000)
			tp = 3068.32
		if (quantity == 1500)
			tp = 3677.92
		if (quantity == 2000)
			tp = 4297.59
		if (quantity == 2500)
			tp = 4352.89
		if (quantity == 3000)
			tp = 4724.64
		if (quantity == 3500)
			tp = 5247.47
		if (quantity == 4000)
			tp = 5769.22
		if (quantity == 4500)
			tp = 6130.37
		if (quantity == 5000)
			tp = 6136.09
		if (quantity == 6000)
			tp = 7171.82
		if (quantity == 7000)
			tp = 8105.59
		if (quantity == 8000)
			tp = 9013.62
		if (quantity == 9000)
			tp = 9937.48
		if (quantity == 10000)
			tp = 10857.39
	}
	var printTotal = tp;
	var grandTotal = tp;

	updateText("myPrintCost", formatCurrency(tp));
	updateText("myMailCost", formatCurrency2(0));					
	updateText("myTp", formatCurrency(grandTotal));
	updateText("myTp2", formatCurrency(grandTotal));

	document.estiForm.tp.value=formatCurrency(tp);
	document.estiForm.printCost.value = formatAsMoney(printTotal);

}		


function submit_GableBox() {
	calculate_GableBox();
	document.estiForm.submit();	
}		

function calculate(mode) {	
	// Remove non-numeric characters
	document.estiForm.quantity.value = document.estiForm.quantity.value.replace(/\D/g, "");
	//alert(mode)
	if (setQuant() <= 0 && document.estiForm.tp) {
		document.estiForm.tp.value=formatCurrency(0);
		document.estiForm.ppu.value=formatCurrency(0);
		return true;
	}
	else if (setQuant() <= 0) {
		updatePrice("tp", formatCurrency(0), 0, document.estiForm.quantity.value);
		updatePrice("ppu", formatCurrency(0), 0, document.estiForm.quantity.value);
		return true;
	}
	
	productFamily = document.estiForm.productFamily.value;
	quantity = document.estiForm.realquant.value;
	
	//square inches, height, width
	if (document.estiForm.height.options) {
		si = (document.estiForm.height.options[document.estiForm.height.selectedIndex].value * document.estiForm.width.options[document.estiForm.width.selectedIndex].value);
		height = document.estiForm.height.options[document.estiForm.height.selectedIndex].value;
		width = document.estiForm.width.options[document.estiForm.width.selectedIndex].value
		colors = document.estiForm.colors.options[document.estiForm.colors.selectedIndex].value;
	}
	else if (productFamily == "Card") {
	 	if (document.estiForm.postcardSize && document.estiForm.postcardSize.value=="4 x 6") {
			height = 6;
			width = 4;
			si = (height * width);
			document.estiForm.height.value="6";
			document.estiForm.width.value="4";
			colors = document.estiForm.colors.value;
		}
	 	else if (document.estiForm.postcardSize && document.estiForm.postcardSize.value=="4.25 x 6") {
			height = 6;
			width = 4.25;
			si = (height * width);
			document.estiForm.height.value="6";
			document.estiForm.width.value="4.25";
			colors = document.estiForm.colors.value;
		}
	 	else if (document.estiForm.postcardSize && document.estiForm.postcardSize.value=="5 x 7") {
			height = 7;
			width = 5;
			si = (height * width);
			document.estiForm.height.value="7";
			document.estiForm.width.value="5";
			colors = document.estiForm.colors.value;
		}
	 	else if (document.estiForm.postcardSize && document.estiForm.postcardSize.value=="5.5 x 8.5") {
			height = 8.5;
			width = 5.5;
			si = (height * width);
			document.estiForm.height.value="8.5";
			document.estiForm.width.value="5.5";
			colors = document.estiForm.colors.value;
		}
	 	else if (document.estiForm.postcardSize && document.estiForm.postcardSize.value=="6 x 9") {
			height = 9;
			width = 6;
			si = (height * width);
			document.estiForm.height.value="9";
			document.estiForm.width.value="6";
			colors = document.estiForm.colors.value;
		}
	 	else if (document.estiForm.postcardSize && document.estiForm.postcardSize.value=="6 x 11") {
			height = 11;
			width = 6;
			si = (height * width);
			document.estiForm.height.value="11";
			document.estiForm.width.value="6";
			colors = document.estiForm.colors.value;
		}
	 	else {
	 		height = document.estiForm.height.value;
			width = document.estiForm.width.value;
	 		si = (height * width); // for reorders, this is required since they have no postcardSize formfield
	 		colors = document.estiForm.colors.value;
	 	}
	}
	else if (productFamily == "Brochure" || productFamily == "Sellsheet" || productFamily == "Newsletter" || productFamily == "Flyer") {
	 	if (document.estiForm.brochureSize && document.estiForm.brochureSize.value=="8.5 x 14") {
			height = 14;
			width = 8.5;
			si = (height * width);
			document.estiForm.height.value="14";
			document.estiForm.width.value="8.5";
			colors = document.estiForm.colors.options[document.estiForm.colors.selectedIndex].value;
		}
	 	else if (document.estiForm.brochureSize && document.estiForm.brochureSize.value=="11 x 17") {
			height = 17;
			width = 11;
			si = (height * width);
			document.estiForm.height.value="17";
			document.estiForm.width.value="11";
			colors = document.estiForm.colors.options[document.estiForm.colors.selectedIndex].value;
		}
	 	else if (document.estiForm.brochureSize && document.estiForm.brochureSize.value=="11 x 25.5") {
			height = 25.5;
			width = 11;
			si = (height * width);
			document.estiForm.height.value="25.5";
			document.estiForm.width.value="11";
			colors = document.estiForm.colors.options[document.estiForm.colors.selectedIndex].value;
		}
	 	else if (document.estiForm.brochureSize && document.estiForm.brochureSize.value=="17 x 22") {
			height = 22;
			width = 17;
			si = (height * width);
			document.estiForm.height.value="22";
			document.estiForm.width.value="17";
			colors = document.estiForm.colors.options[document.estiForm.colors.selectedIndex].value;
		}
	 	else if (document.estiForm.brochureSize && document.estiForm.brochureSize.value=="8.5 x 11") {
			height = 11;
			width = 8.5;
			si = (height * width);
			document.estiForm.height.value="11";
			document.estiForm.width.value="8.5";
			colors = document.estiForm.colors.options[document.estiForm.colors.selectedIndex].value;
		}
	 	else {
	 		height = document.estiForm.height.value;
			width = document.estiForm.width.value;
	 		si = (height * width); // for reorders, this is required since they have no brochureSize formfield
			colors = document.estiForm.colors.options[document.estiForm.colors.selectedIndex].value;
	 	}
	}
	else if (productFamily == "Greeting Card" || productFamily == "Invitation") {
	 	colors = document.estiForm.colors.value;
	 	if (document.estiForm.greetingCardSize && document.estiForm.greetingCardSize.value=="4.25 x 6") {
			height = 8.5;
			width = 6;
			si = (height * width);
			document.estiForm.height.value="8.5";
			document.estiForm.width.value="6";
			document.estiForm.finalHeight.value="4.25";
			document.estiForm.finalWidth.value="6";
		}
	 	else if (document.estiForm.greetingCardSize && document.estiForm.greetingCardSize.value=="5 x 7") {
			height = 10;
			width = 7;
			si = (height * width);
			document.estiForm.height.value="10";
			document.estiForm.width.value="7";
			document.estiForm.finalHeight.value="5";
			document.estiForm.finalWidth.value="7";
		}
	 	else if (document.estiForm.greetingCardSize && document.estiForm.greetingCardSize.value=="4 x 5.5") {
			height = 8;
			width = 5.5;
			si = (height * width);
			document.estiForm.height.value="8";
			document.estiForm.width.value="5.5";
			document.estiForm.finalHeight.value="4";
			document.estiForm.finalWidth.value="5.5";
		}
	 	else {
	 		height = document.estiForm.height.value;
			width = document.estiForm.width.value;
	 		si = (height * width); // for reorders, this is required since they have no greetingCardSize formfield
	 	}
		//alert("square inches = " + si + " height: " + 	document.estiForm.height.value + " width: " + document.estiForm.width.value + "\n final height: " + document.estiForm.finalHeight.value  + " final width: " + document.estiForm.finalWidth.value);
	}
	else if (productFamily == "Oversize") {
	 	if (document.estiForm.postcardSize && document.estiForm.postcardSize.value=="8.5 x 11") {
			height = 11;
			width = 8.5;
			si = (height * width);
			document.estiForm.height.value="11";
			document.estiForm.width.value="8.5";
			colors = document.estiForm.colors.value;
		}
	 	if (document.estiForm.postcardSize && document.estiForm.postcardSize.value=="11 x 17") {
			height = 17;
			width = 11;
			si = (height * width);
			document.estiForm.height.value="17";
			document.estiForm.width.value="11";
			colors = document.estiForm.colors.value;
		}
	 	if (document.estiForm.postcardSize && document.estiForm.postcardSize.value=="12 x 18") {
			height = 18;
			width = 12;
			si = (height * width);
			document.estiForm.height.value="18";
			document.estiForm.width.value="12";
			colors = document.estiForm.colors.value;
		}
	 	if (document.estiForm.postcardSize && document.estiForm.postcardSize.value=="18 x 24") {
			height = 24;
			width = 18;
			si = (height * width);
			document.estiForm.height.value="24";
			document.estiForm.width.value="18";
			colors = document.estiForm.colors.value;
		}
	 	if (document.estiForm.postcardSize && document.estiForm.postcardSize.value=="22 x 28") {
			height = 28;
			width = 22;
			si = (height * width);
			document.estiForm.height.value="28";
			document.estiForm.width.value="22";
			colors = document.estiForm.colors.value;
		}
	}
	else {
		si = (document.estiForm.height.value * document.estiForm.width.value);
		height = document.estiForm.height.value;
		width = document.estiForm.width.value
		colors = document.estiForm.colors.value;
	}
	if (document.estiForm.finalHeight) {
		var finalHeight = document.estiForm.finalHeight.value;
		var finalWidth = document.estiForm.finalWidth.value;
	}
	//total square inches
	tsi = (si * quantity);
	if (document.estiForm.mailing) {
		var mailRate = document.estiForm.mailing.options[document.estiForm.mailing.selectedIndex].value;
		var mailQuant = document.estiForm.mailQuant.value;
		if (document.estiForm.mailing.options[document.estiForm.mailing.selectedIndex].value != "no" && mailQuant > 0) {
			var weightPerUnit = getUnitWeightOnces(tsi, quantity);
			if (document.estiForm.weightPerUnit) document.estiForm.weightPerUnit.value=weightPerUnit;
			if (document.estiForm.fold && document.estiForm.fold.options[document.estiForm.fold.selectedIndex].value != 'no') {
				var mailPostage = (calcPostage(productFamily, (finalHeight*finalWidth), weightPerUnit, mailQuant, mailRate))?calcPostage(productFamily, (finalHeight*finalWidth), weightPerUnit, mailQuant, mailRate):0;
			}
			else
				var mailPostage = (calcPostage(productFamily, si, weightPerUnit, mailQuant, mailRate))?calcPostage(productFamily, si, weightPerUnit, mailQuant, mailRate):0;
			var mailLabor = (calcMailLabor(si, weightPerUnit, mailQuant, mailRate))?calcMailLabor(si, weightPerUnit, mailQuant, mailRate):0;
			//alert("unitWeight:" + weightPerUnit + "\nmailPostage:" + mailPostage + "\nmailLabor:" + mailLabor);
			
			var totalMailingCost = (mailPostage + mailLabor);
			updateText("myMailCost", formatCurrency2(totalMailingCost));
			totalMailingCost = Math.round(totalMailingCost); //round it to the nearest buck
			document.estiForm.mailCost.value = formatAsMoney(totalMailingCost); //then add two zero's to the end
			var shipQuant = (quantity - mailQuant);
			updateText("myShipQuant", shipQuant);
			document.estiForm.shipQuant.value = shipQuant;
		}
		else {
			var totalMailingCost = 0;
			updateText("mailCostTop", formatCurrency2(totalMailingCost));
			updateText("myShipQuant", quantity);
			document.estiForm.shipQuant.value = quantity;
			document.estiForm.mailCost.value = "0.00";
		}
	}
	else {
		if (document.estiForm.shipQuant) document.estiForm.shipQuant.value = quantity;
		if (document.estiForm.mailCost) document.estiForm.mailCost.value = "0.00";
	}
	if (document.estiForm.mailing && document.estiForm.mailQuant) {
		checkMailDependencies(productFamily, quantity, document.estiForm.mailQuant.value);
	}
	//total price without rush charges
	tp_no_rush = ((calcPaper(tsi, si, "pages")) + calcPress(document.estiForm.realquant.value, si, "pages") + calcDrilling() + calcEyelets() + calcPerforating() + calcScoring() + calcFolding() + calcProof(si) + calcHandling(tsi));
	nexpress_tp_no_rush = (calcPaper(tsi, si, "pages") + calcNexPress(document.estiForm.realquant.value, si, "pages") + calcDrilling() + calcEyelets() + calcPerforating() + calcScoring() + calcFolding() + calcNexPressProof(si) + calcHandling(tsi));
	//alert("calcPaper:" + calcPaper(tsi, si, "pages")  + "\n" +  "calcNexPress" + calcNexPress(document.estiForm.realquant.value, si, "pages")  + "\n" +  calcDrilling()  + "\n" +  calcEyelets() + "\n" + calcPerforating()  + "\n" +  calcScoring() + calcFolding()  + "\n" +  calcNexPressProof(si)  + "\n" +  calcProof(si));// + "\n" +  calcHandling(tsi));
	//total price with rush charges
	tp = (tp_no_rush + calcRush(tp_no_rush, si));
	nexpress_tp = (nexpress_tp_no_rush + calcRush(nexpress_tp_no_rush, si));	

	//used for %5 addition to recycled paper orders
	tp = (tp + paperMarketAdjustment(tp, "single", quantity));
	nexpress_tp = (nexpress_tp + paperMarketAdjustment(nexpress_tp, "single", quantity));
		
	//adjust for market changes based on quantity 
	tp = (tp + marketAdjustmentByQuantity(tp, si, colors, "single", quantity));

	//nexpress_tp = (nexpress_tp + marketAdjustmentByQuantity(nexpress_tp, si, colors, "single", quantity));
	
	//adjust for market changes 
	tp = (tp + marketAdjustment(tp, "single", quantity));
	nexpress_tp = (nexpress_tp + marketAdjustment(nexpress_tp, "single", quantity));
	//add rounded corners charge	
		if (document.estiForm.round_corners && document.estiForm.round_corners.value == "yes") {
			if (document.estiForm.productFamily && (document.estiForm.productFamily.value == "HangTag" || document.estiForm.productFamily.value == "Bookmark") ) {
				if (document.estiForm.realquant.value <= 250) {				
					roundCorners = 25;
				}
				else if (document.estiForm.realquant.value > 250 && document.estiForm.realquant.value < 2500) {
					roundCorners = (document.estiForm.realquant.value * .1);
				}			
				else if (document.estiForm.realquant.value >= 2500 && document.estiForm.realquant.value < 5000) {
					roundCorners = (document.estiForm.realquant.value * .08);
				}			
				else if (document.estiForm.realquant.value >= 5000) {
					roundCorners = (document.estiForm.realquant.value * .06);
				}					
				nexpress_tp = nexpress_tp + roundCorners;
				tp = tp + roundCorners;
			}
			else {
				roundCorners = (25 + (((document.estiForm.realquant.value) - 250) * .03));
				nexpress_tp = nexpress_tp + roundCorners;
				tp = tp + roundCorners;
			}
		}

	//add shapeCut charge	
		if (document.estiForm.shapeCut && document.estiForm.shapeCut.value == "yes"){
			if (document.estiForm.realquant.value <= 250) {
				shapeCutCharge = 25;
			}
			else if (document.estiForm.realquant.value > 250 && document.estiForm.realquant.value < 2500) {
				shapeCutCharge = (document.estiForm.realquant.value * .1);
			}			
			else if (document.estiForm.realquant.value >= 2500 && document.estiForm.realquant.value < 5000) {
				shapeCutCharge = (document.estiForm.realquant.value * .08);
			}			
			else if (document.estiForm.realquant.value >= 5000) {
				shapeCutCharge = (document.estiForm.realquant.value * .06);
			}

			tp = (tp + shapeCutCharge);
			nexpress_tp = (nexpress_tp + shapeCutCharge);
		}
	//discounted pricing for postcards, 3/24/09 - BV Updated with digital 012810
	if (document.estiForm.productFamily.value == "Card" || document.estiForm.productFamily.value == "w2pCard") { // note: height and width are "flipped" on w2p cards, thus the convoluted logic - BV
		//alert("height: " + height + " x  width: " + width);
		if ((height == 6 && (width == 4.25 || width == 4)) || height == 4.25) {
			if (quantity <= 100) {
				tp = (tp - (tp * .175));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .175));
			}
			else if (quantity <= 150) {
				tp = (tp - (tp * .2));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .2));
			}
			else if (quantity <= 250) {
				tp = (tp - (tp * .218));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .218));
			}
			else if (quantity <= 500) {
				tp = (tp - (tp * .1));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .1));
			}
			else if (quantity > 10000) {
				tp = (tp - (tp * .15));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .15));
			}
			
			else {
				tp = (tp - (tp * .25));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .25));
			}
		}
		if (height == 7 || height == 5) {
			if (quantity <= 150) {
				tp = (tp - (tp * .52));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .52));
			}
			else if (quantity <= 250) {
				tp = (tp - (tp * .53));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .53));
			}
			else if (quantity == 500) {
				tp = (tp - (tp * .35));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .35));
			}
			else if (quantity >= 750 && quantity < 1500) {
				tp = (tp - (tp * .4));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .4));
			}
			else if (quantity == 1500) {
				tp = (tp - (tp * .35));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .35));
			}
			else if (quantity > 10000 && quantity <= 25000) {
				tp = (tp - (tp * .1));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .1));
			}
			else if (quantity > 25000) {
				tp = (tp - (tp * .15));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .15));
			}
			else {
				tp = (tp - (tp * .25));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .25));
			}
		}
		if (height == 8.5 && width == 5.5) {
			if (quantity <= 50) {
				tp = (tp - (tp * .515));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .515));
			}
			else if (quantity == 75) {
				tp = (tp - (tp * .5));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .5));
			}
			else if (quantity == 100) {
				tp = (tp - (tp * .49));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .49));
			}
			else if (quantity == 150) {
				tp = (tp - (tp * .47));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .47));
			}
			else if (quantity == 200) {
				tp = (tp - (tp * .455));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .455));
			}
			else if (quantity == 250) {
				tp = (tp - (tp * .435));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .435));
			}
			else if (quantity == 500) {
				tp = (tp - (tp * .25));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .25));
			}
			else if (quantity >= 750 && quantity <= 1500) {
				tp = (tp - (tp * .22));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .22));
			}
			else if (quantity > 1500 && quantity < 2500) {
				tp = (tp - (tp * .33));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .33));
			}
			else if (quantity >= 2500 && quantity < 5500) {
				tp = (tp - (tp * .36));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .36));
			}
			else if (quantity >= 5500 && quantity <= 7000) {
				tp = (tp - (tp * .33));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .33));
			}
			else if (quantity > 7000 && quantity < 9000) {
				tp = (tp - (tp * .28));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .28));
			}
			else if (quantity >= 9000 && quantity <= 10000) {
				tp = (tp - (tp * .2));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .2));
			}
			else if (quantity > 10000 && quantity <= 15000) {
				tp = (tp - (tp * .05));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .05));
			}
		}
		if (height == 9 || (height == 6 && width == 9)) {
			if (quantity == 50) {
				tp = (tp - (tp * .44));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .44));
			}
			else if (quantity == 75) {
				tp = (tp - (tp * .395));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .395));
			}
			else if (quantity == 100) {
				tp = (tp - (tp * .37));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .37));
			}
			else if (quantity == 150) {
				tp = (tp - (tp * .325));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .325));
			}
			else if (quantity == 200) {
				tp = (tp - (tp * .285));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .285));
			}
			else if (quantity == 250) {
				tp = (tp - (tp * .26));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .26));
			}
			else if (quantity <= 500) {
				tp = (tp - (tp * .1));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .1));
			}
			else if (quantity > 500 && quantity <= 1000) {
				tp = (tp - (tp * .2));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .2));
			}
			else if (quantity >= 9000 && quantity <= 10000) {
				tp = (tp - (tp * .2));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .2));
			}
			else if (quantity > 1000 && quantity < 2500) {
				tp = (tp - (tp * .33));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .33));
			}
			else if (quantity >= 2500 && quantity < 5500) {
				tp = (tp - (tp * .36));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .36));
			}
			else if (quantity >= 5500 && quantity <= 7000) {
				tp = (tp - (tp * .33));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .33));
			}
			else if (quantity > 7000 && quantity < 9000) {
				tp = (tp - (tp * .28));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .28));
			}
			else if (quantity > 10000 && quantity <= 15000) {
				tp = (tp - (tp * .05));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .05));
			}
		}
		if (height == 11) {
			if (quantity == 50) {
				tp = (tp - (tp * .28));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .28));
			}
			else if (quantity == 75) {
				tp = (tp - (tp * .27));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .27));
			}
			else if (quantity == 100) {
				tp = (tp - (tp * .28));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .28));
			}
			else if (quantity == 150) {
				tp = (tp - (tp * .219));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .219));
			}
			else if (quantity == 200) {
				tp = (tp - (tp * .26));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .26));
			}
			else if (quantity == 250) {
				tp = (tp - (tp * .295));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .295));
			}
			else if (quantity == 500) {
				tp = (tp - (tp * .19));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .19));
			}
			else if (quantity <= 750) {
				tp = (tp - (tp * .26));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .26));
			}
			else if (quantity == 1000) {
				tp = (tp - (tp * .34));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .34));
			}
			else if (quantity > 1000 && quantity < 3000) {
				tp = (tp - (tp * .39));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .39));
			}
			else if (quantity >= 3000 && quantity < 4000) {
				tp = (tp - (tp * .34));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .34));
			}
			else if (quantity >= 4000 && quantity < 5000) {
				tp = (tp - (tp * .26));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .26));
			}
			else if (quantity >= 5000 && quantity < 6000) {
				tp = (tp - (tp * .21));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .21));
			}
			else if (quantity >= 6000 && quantity < 7000) {
				tp = (tp - (tp * .18));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .18));
			}
			else if (quantity >= 7000 && quantity < 8000) {
				tp = (tp - (tp * .07));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .07));
			}
			else if (quantity >= 9000 && quantity < 10000) {
				tp = (tp + (tp * .12));
				nexpress_tp = (nexpress_tp + (nexpress_tp * .12));
			}
			else if (quantity >= 10000 && quantity < 11000) {
				tp = (tp + (tp * .17));
				nexpress_tp = (nexpress_tp + (nexpress_tp * .17));
			}
			else if (quantity >= 11000 && quantity < 12000) {
				tp = (tp + (tp * .18));
				nexpress_tp = (nexpress_tp + (nexpress_tp * .18));
			}
			else if (quantity >= 12000 && quantity < 13000) {
				tp = (tp + (tp * .19));
				nexpress_tp = (nexpress_tp + (nexpress_tp * .19));
			}
			else if (quantity >= 13000 && quantity < 14000) {
				tp = (tp + (tp * .16));
				nexpress_tp = (nexpress_tp + (nexpress_tp * .16));
			}
			else if (quantity >= 14000 && quantity < 15000) {
				tp = (tp + (tp * .17));
				nexpress_tp = (nexpress_tp + (nexpress_tp * .17));
			}
			else if (quantity >= 15000 && quantity < 20000) {
				tp = (tp + (tp * .2));
				nexpress_tp = (nexpress_tp + (nexpress_tp * .2));
			}
			else if (quantity >= 20000 && quantity <= 25000) {
				tp = (tp + (tp * .22));
				nexpress_tp = (nexpress_tp + (nexpress_tp * .22));
			}
			else if (quantity > 25000) {
				tp = (tp + (tp * .1));
				nexpress_tp = (nexpress_tp + (nexpress_tp * .1));
			}
		}
	}
	
	//Gang & digital discounts for standard quantities and sizes, January 7, 2010 - BV
		if (((height == 11 && width == 8.5) || (width == 11 && height == 8.5)) && document.estiForm.productFamily.value != "4cLetterhead") {
			if (quantity == 50) {
				tp = (tp - (tp * .3));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .3));
				if (document.estiForm.fold && document.estiForm.fold.value != null &&document.estiForm.fold.value != "no" ) {
					tp = (tp + 4);
					nexpress_tp = (nexpress_tp + 4);
				}				
			}
			if (quantity == 75) {
				tp = (tp - (tp * .35));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .35));
				if (document.estiForm.fold && document.estiForm.fold.value != null &&document.estiForm.fold.value != "no" ) {
					tp = (tp + 4);
					nexpress_tp = (nexpress_tp + 4);
				}				
			}
			if (quantity == 100) {
				tp = (tp - (tp * .42));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .42));
				if (document.estiForm.fold && document.estiForm.fold.value != null &&document.estiForm.fold.value != "no" ) {
					tp = (tp + 6);
					nexpress_tp = (nexpress_tp + 6);
				}				
			}
			if (quantity == 150) {
				tp = (tp - (tp * .45));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .45));
				if (document.estiForm.fold && document.estiForm.fold.value != null &&document.estiForm.fold.value != "no" ) {
					tp = (tp + 5);
					nexpress_tp = (nexpress_tp + 5);
				}				
			}
			if (quantity == 200) {
				tp = (tp - (tp * .55));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .55));
				if (document.estiForm.fold && document.estiForm.fold.value != null &&document.estiForm.fold.value != "no" ) {
					tp = (tp + 7);
					nexpress_tp = (nexpress_tp + 7);
				}				
			}
			if (quantity == 250) {
				tp = (tp - (tp * .5));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .5));
				if (document.estiForm.fold && document.estiForm.fold.value != null &&document.estiForm.fold.value != "no" ) {
					tp = (tp + 6);
					nexpress_tp = (nexpress_tp + 6);
				}				
			}
			if (quantity == 500) {
				tp = (tp - (tp * .48));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .48));
			}
			if (quantity == 750) {
				tp = (tp - (tp * .37));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .37));
			}	
			if (quantity == 1000) {
				tp = (tp - (tp * .295));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .295));
			}	
			if (quantity == 1500) {
				tp = (tp - (tp * .280));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .280));
			}	
			if (quantity == 2000) {
				tp = (tp - (tp * .265));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .265));
			}	
			if (quantity == 2500) {
				tp = (tp - (tp * .254));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .254));
			}
			if (quantity == 3000) {
				tp = (tp - (tp * .242));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .242));
			}	
			if (quantity == 3500) {
				tp = (tp - (tp * .232));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .232));
			}	
			if (quantity == 4000) {
				tp = (tp - (tp * .222));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .222));
			}	
			if (quantity == 4500) {
				tp = (tp - (tp * .213));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .213));
			}	
			if (quantity == 5000) {
				tp = (tp - (tp * .206));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .206));
			}	
			if (quantity == 5500) {
				tp = (tp - (tp * .198));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .198));
			}	
			if (quantity == 6000) {
				tp = (tp - (tp * .192));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .192));
			}	
			if (quantity == 6500) {
				tp = (tp - (tp * .185));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .185));
			}	
			if (quantity == 7000) {
				tp = (tp - (tp * .18));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .18));
			}	
			if (quantity == 7500) {
				tp = (tp - (tp * .173));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .173));
			}	
			if (quantity == 8000) {
				tp = (tp - (tp * .163));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .163));
			}	
			if (quantity == 8500) {
				tp = (tp - (tp * .154));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .154));
			}	
			if (quantity == 9000) {
				tp = (tp - (tp * .144));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .144));
			}	
			if (quantity == 9500) {
				tp = (tp - (tp * .136));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .136));
			}	
			if (quantity == 10000) {
				tp = (tp - (tp * .126));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .126));
			}	
			if (quantity == 12500) {
				tp = (tp - (tp * .082));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .082));
			}	
			if (quantity == 15000) {
				tp = (tp - (tp * .038));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .038));
			}	
			if (quantity == 20000) {
				tp = (tp - (tp * .019));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .019));
			}
		}	

		if ((height == 14 && width == 8.5) || (width == 14 && height == 8.5)) {
			if (quantity == 50) {
				tp = (tp - (tp * .1));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .1));
			}
			if (quantity == 75) {
				tp = (tp - (tp * .14));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .14));
			}
			if (quantity == 100) {
				tp = (tp - (tp * .18));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .18));
			}
			if (quantity == 150) {
				tp = (tp - (tp * .2));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .2));
			}
			if (quantity == 200) {
				tp = (tp - (tp * .2));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .2));
			}
			if (quantity == 250) {
				tp = (tp - (tp * .22));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .22));
			}
			if (quantity == 500) {
				tp = (tp - (tp * .32));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .32));
			}
			if (quantity == 750) {
				tp = (tp - (tp * .26));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .26));
			}	
			if (quantity == 1000) {
				tp = (tp - (tp * .226));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .226));
			}	
			if (quantity == 1500) {
				tp = (tp - (tp * .183));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .183));
			}	
			if (quantity == 2000) {
				tp = (tp - (tp * .147));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .147));
			}	
			if (quantity == 2500) {
				tp = (tp - (tp * .113));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .113));
			}
			if (quantity == 3000) {
				tp = (tp - (tp * .083));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .083));
			}	
			if (quantity == 3500) {
				tp = (tp - (tp * .099));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .099));
			}	
			if (quantity == 4000) {
				tp = (tp - (tp * .114));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .114));
			}	
			if (quantity == 4500) {
				tp = (tp - (tp * .128));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .128));
			}	
			if (quantity == 5000) {
				tp = (tp - (tp * .140));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .140));
			}	
			if (quantity == 5500) {
				tp = (tp - (tp * .153));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .153));
			}	
			if (quantity == 6000) {
				tp = (tp - (tp * .162));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .162));
			}	
			if (quantity == 6500) {
				tp = (tp - (tp * .173));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .173));
			}	
			if (quantity == 7000) {
				tp = (tp - (tp * .181));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .181));
			}	
			if (quantity == 7500) {
				tp = (tp - (tp * .19));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .19));
			}	
			if (quantity == 8000) {
				tp = (tp - (tp * .193));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .193));
			}	
			if (quantity == 8500) {
				tp = (tp - (tp * .197));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .197));
			}	
			if (quantity == 9000) {
				tp = (tp - (tp * .198));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .198));
			}	
			if (quantity == 9500) {
				tp = (tp - (tp * .201));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .201));
			}	
			if (quantity == 10000) {
				tp = (tp - (tp * .203));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .203));
			}	
			if (quantity == 12500) {
				tp = (tp - (tp * .165));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .165));
			}	
			if (quantity == 15000) {
				tp = (tp - (tp * .132));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .132));
			}	
			if (quantity == 20000) {
				tp = (tp - (tp * .118));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .118));
			}
			//folding needs an extra buck on digital quants - BV
			if (document.estiForm.fold && document.estiForm.fold.value != null &&document.estiForm.fold.value != "no" && quantity >= 50 && quantity <= 250) {
				tp = (tp + 1);
				nexpress_tp = (nexpress_tp + 1);
			}				
		}		

		if ((height == 17 && width == 11) || (width == 11 && height == 17) || (width == 12 && height == 18) || (width == 18 && height == 12)) {
			if (quantity == 50) {
				tp = (tp - (tp * .33));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .33));
				if (document.estiForm.fold && document.estiForm.fold.value != null &&document.estiForm.fold.value != "no" ) {
					tp = (tp + 4);
					nexpress_tp = (nexpress_tp + 4);
				}				
			}
			if (quantity == 75) {
				tp = (tp - (tp * .395));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .395));
				if (document.estiForm.fold && document.estiForm.fold.value != null &&document.estiForm.fold.value != "no" ) {
					tp = (tp + 5);
					nexpress_tp = (nexpress_tp + 5);
				}				
			}
			if (quantity == 100) {
				tp = (tp - (tp * .43));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .43));
				if (document.estiForm.fold && document.estiForm.fold.value != null &&document.estiForm.fold.value != "no" ) {
					tp = (tp + 5);
					nexpress_tp = (nexpress_tp + 5);
				}				
			}
			if (quantity == 150) {
				tp = (tp - (tp * .462));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .462));
				if (document.estiForm.fold && document.estiForm.fold.value != null &&document.estiForm.fold.value != "no" ) {
					tp = (tp + 6);
					nexpress_tp = (nexpress_tp + 6);
				}				
			}
			if (quantity == 200) {
				tp = (tp - (tp * .463));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .463));
				if (document.estiForm.fold && document.estiForm.fold.value != null &&document.estiForm.fold.value != "no" ) {
					tp = (tp + 5);
					nexpress_tp = (nexpress_tp + 5);
				}
			}
			if (quantity == 250) {
				tp = (tp - (tp * .496));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .496));
				if (document.estiForm.fold && document.estiForm.fold.value != null &&document.estiForm.fold.value != "no" ) {
					tp = (tp + 5);
					nexpress_tp = (nexpress_tp + 5);
				}				
			}
			if (quantity == 500) {
				tp = (tp - (tp * .329));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .329));
			}
			if (quantity == 750) {
				tp = (tp - (tp * .29));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .29));
			}	
			if (quantity == 1000) {
				tp = (tp - (tp * .302));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .302));
			}	
			if (quantity == 1500) {
				tp = (tp - (tp * .28));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .28));
			}	
			if (quantity == 2000) {
				tp = (tp - (tp * .261));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .261));
			}	
			if (quantity == 2500) {
				tp = (tp - (tp * .245));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .245));
			}
			if (quantity == 3000) {
				tp = (tp - (tp * .232));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .232));
			}	
			if (quantity == 3500) {
				tp = (tp - (tp * .22));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .22));
			}	
			if (quantity == 4000) {
				tp = (tp - (tp * .208));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .208));
			}	
			if (quantity == 4500) {
				tp = (tp - (tp * .199));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .199));
			}	
			if (quantity == 5000) {
				tp = (tp - (tp * .192));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .192));
			}	
			if (quantity == 5500) {
				tp = (tp - (tp * .164));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .164));
			}	
			if (quantity == 6000) {
				tp = (tp - (tp * .138));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .138));
			}	
			if (quantity == 6500) {
				tp = (tp - (tp * .113));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .113));
			}	
			if (quantity == 7000) {
				tp = (tp - (tp * .089));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .089));
			}	
			if (quantity == 7500) {
				tp = (tp - (tp * .065));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .065));
			}	
			if (quantity == 8000) {
				tp = (tp - (tp * .038));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .038));
			}	
			if (quantity == 8500) {
				tp = (tp - (tp * .012));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .012));
			}	
			if (quantity == 9000) {
				tp = (tp + (tp * .014));
				nexpress_tp = (nexpress_tp + (nexpress_tp * .014));
			}	
			if (quantity == 9500) {
				tp = (tp + (tp * .038));
				nexpress_tp = (nexpress_tp + (nexpress_tp * .038));
			}	
			if (quantity == 10000) {
				tp = (tp + (tp * .008));
				nexpress_tp = (nexpress_tp + (nexpress_tp * .008));
			}	
			if (quantity == 12500) {
				tp = (tp + (tp * .031));
				nexpress_tp = (nexpress_tp + (nexpress_tp * .031));
			}	
			if (quantity == 15000) {
				tp = (tp + (tp * .055));
				nexpress_tp = (nexpress_tp + (nexpress_tp * .055));
			}	
			if (quantity == 20000) {
				tp = (tp + (tp * .029));
				nexpress_tp = (nexpress_tp + (nexpress_tp * .029));
			}
		}		
		if ((height == 25.5 && width == 11) || (width == 25.5 && height == 11)) {
			if (quantity <= 500) {
				tp = (tp - (tp * .159));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .159));
			}
			if (quantity == 750) {
				tp = (tp - (tp * .166));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .166));
			}	
			if (quantity == 1000) {
				tp = (tp - (tp * .172));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .172));
			}	
			if (quantity == 1500) {
				tp = (tp - (tp * .224));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .224));
			}	
			if (quantity == 2000) {
				tp = (tp - (tp * .194));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .194));
			}	
			if (quantity == 2500) {
				tp = (tp - (tp * .203));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .203));
			}
			if (quantity == 3000) {
				tp = (tp - (tp * .21));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .21));
			}	
			if (quantity == 3500) {
				tp = (tp - (tp * .217));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .217));
			}	
			if (quantity == 4000) {
				tp = (tp - (tp * .223));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .223));
			}	
			if (quantity == 4500) {
				tp = (tp - (tp * .228));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .228));
			}	
			if (quantity == 5000) {
				tp = (tp - (tp * .233));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .233));
			}	
			if (quantity == 5500) {
				tp = (tp - (tp * .238));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .238));
			}	
			if (quantity == 6000) {
				tp = (tp - (tp * .242));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .242));
			}	
			if (quantity == 6500) {
				tp = (tp - (tp * .247));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .247));
			}	
			if (quantity == 7000) {
				tp = (tp - (tp * .251));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .251));
			}	
			if (quantity == 7500) {
				tp = (tp - (tp * .255));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .255));
			}	
			if (quantity == 8000) {
				tp = (tp - (tp * .254));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .254));
			}	
			if (quantity == 8500) {
				tp = (tp - (tp * .253));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .253));
			}	
			if (quantity == 9000) {
				tp = (tp - (tp * .252));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .252));
			}	
			if (quantity == 9500 || quantity == 10000) {
				tp = (tp - (tp * .25));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .25));
			}	
			if (quantity == 12500) {
				tp = (tp - (tp * .238));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .238));
			}	
			if (quantity == 15000) {
				tp = (tp - (tp * .225));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .225));
			}	
			if (quantity == 20000) {
				tp = (tp - (tp * .238));
				nexpress_tp = (nexpress_tp - (nexpress_tp * .238));
			}
		}
		
	//digital pricing discounts, 1/27/10
	if ((document.estiForm.productFamily.value.indexOf("Greeting") != -1 || productFamily == "Invitation") && quantity >= 50 && quantity <= 250) {
		if (height == 8) {
			if (quantity == 50)
			  nexpress_tp = (nexpress_tp - (nexpress_tp * .395));
			else if (quantity == 75)
			  nexpress_tp = (nexpress_tp - (nexpress_tp * .37));
			else if (quantity == 100)
			  nexpress_tp = (nexpress_tp - (nexpress_tp * .245));
			else if (quantity == 150)
			  nexpress_tp = (nexpress_tp - (nexpress_tp * .1));
			else if (quantity == 200)
			  nexpress_tp = (nexpress_tp + (nexpress_tp * .02));
			else if (quantity == 250)
			  nexpress_tp = (nexpress_tp + (nexpress_tp * .08));
		}
		if (height == 8.5) {
			if (quantity == 50)
			  nexpress_tp = (nexpress_tp - (nexpress_tp * .375));
			else if (quantity == 75)
			  nexpress_tp = (nexpress_tp - (nexpress_tp * .35));
			else if (quantity == 100)
			  nexpress_tp = (nexpress_tp - (nexpress_tp * .235));
			else if (quantity == 150)
			  nexpress_tp = (nexpress_tp - (nexpress_tp * .105));
			else if (quantity == 200)
			  nexpress_tp = (nexpress_tp + (nexpress_tp * .016));
			else if (quantity == 250)
			  nexpress_tp = (nexpress_tp + (nexpress_tp * .046));
		}
		if (height == 10) {
			if (quantity == 50)
			  nexpress_tp = (nexpress_tp - (nexpress_tp * .23));
			else if (quantity == 75)
			  nexpress_tp = (nexpress_tp - (nexpress_tp * .23));
			else if (quantity == 100)
			  nexpress_tp = (nexpress_tp - (nexpress_tp * .13));
			else if (quantity == 150)
			  nexpress_tp = (nexpress_tp - (nexpress_tp * .045));
			else if (quantity == 200)
			  nexpress_tp = (nexpress_tp + (nexpress_tp * .025));
			else if (quantity == 250)
			  nexpress_tp = (nexpress_tp + (nexpress_tp * .02));
		}
	}
	if (productFamily == "Bookmark" && quantity <= 250) {
		nexpress_tp = (nexpress_tp - (nexpress_tp * .1));
	}
	if (productFamily == "Rackcard" && quantity <= 250) {
		nexpress_tp = (nexpress_tp - (nexpress_tp * .2));
	}

	//if (nexpress_tp < 65) nexpress_tp = 65;
	//ADD BLANK ENVELOPES
	tp = (tp + calcBlankEnvelopes());
	nexpress_tp = (nexpress_tp + calcBlankEnvelopes());

	//ADD BLACK ENVELOPES
	tp = (tp + calcKonlyEnvelopes());
	nexpress_tp = (nexpress_tp + calcKonlyEnvelopes());
	//alert(nexpress_tp);

	//ADD BLANK ENVELOPES FOR W2P PRODUCTS
	tp = (tp + calcW2pBlankEnvelopes());
	nexpress_tp = (nexpress_tp + calcW2pBlankEnvelopes());
		
	//ADD PRINTED ENVELOPES FOR W2P PRODUCTS
	tp = (tp + calcW2pPrintedEnvelopes());
	nexpress_tp = (nexpress_tp + calcW2pPrintedEnvelopes());

	//ADD BLANK LETTERHEAD FOR STATIONERY PRODUCTS
	if (document.estiForm.stationeryLetterheadBlank && document.estiForm.stationeryLetterheadBlank.selectedIndex != 0){
		tp += (document.estiForm.stationeryLetterheadBlank.value / 500) * 20;
		nexpress_tp += (document.estiForm.stationeryLetterheadBlank.value / 500) * 20;
	}

	//ADD BLANK BOXES FOR GREETING CARDS
	if (document.estiForm.greetingCardBoxes && document.estiForm.greetingCardBoxes != null && document.estiForm.greetingCardBoxes.value != "0") {
		tp = (tp + (document.estiForm.greetingCardBoxes.value * .95));
		nexpress_tp = (nexpress_tp + (document.estiForm.greetingCardBoxes.value * .95));
	}
		
	if (document.estiForm.paper.value == "20pt_kraftboard") { //plus 20% for kraft board
		tp = (tp + (tp * .2));
		nexpress_tp = (nexpress_tp + (nexpress_tp * .2));
	}
	if (document.estiForm.productFamily.value == "Brochure" || document.estiForm.productFamily.value == "Sellsheet" || document.estiForm.productFamily.value == "HangTag" || document.estiForm.productFamily.value == "Flyer") {					
		nexpress_tp = (nexpress_tp + (nexpress_tp * .15));
		tp = (tp + (tp * .15));
	}					
	if (document.estiForm.productFamily.value == "Card" || document.estiForm.productFamily.value == "w2pCard") { 
		nexpress_tp = (nexpress_tp + (nexpress_tp * .1));
		tp = (tp + (tp * .1));
	}

	//alert('nexpress price = ' + nexpress_tp + '. 74-CD price = ' + tp);
	document.estiForm.si.value=si;
	document.estiForm.tsi.value=tsi;
	//IF THE NEXPRESS IS THE CHOSEN PRESS DO THE CONTENTS OF THIS IF
	if (nexpress_tp < tp && si <= 216 && height <= 18 && width <= 18) {
		ppu = (nexpress_tp / (document.estiForm.realquant.value));
		document.estiForm.press.value="NexP";
		if (mode && mode == 1) {
			updatePrice("ppu", formatCurrency(ppu), ppu, quantity);
			updatePrice("tp", formatCurrency2(nexpress_tp), Math.round(nexpress_tp), quantity);
		}
		else {
			if (document.estiForm.mailing && 
			  document.estiForm.mailing.options[document.estiForm.mailing.selectedIndex].value != "no" && 
 			  document.estiForm.mailQuant.value > 0) { //IF MAILING IS ON AND HAS A VALID QUANTITY
				if (document.estiForm.productFamily.value == "Brochure" || document.estiForm.productFamily.value == "Sellsheet" || 
				document.estiForm.productFamily.value == "Card" || document.estiForm.productFamily.value == "w2pCard" || document.estiForm.productFamily.value == "HangTag" || document.estiForm.productFamily.value == "Flyer") {
					if (document.estiForm.productFamily.value == "Brochure" || document.estiForm.productFamily.value == "Sellsheet" || document.estiForm.productFamily.value == "HangTag" || document.estiForm.productFamily.value == "Flyer") {					
						var printDiscount = (nexpress_tp * .15);
					}					
					if (document.estiForm.productFamily.value == "Card" || document.estiForm.productFamily.value == "w2pCard") { 
						var printDiscount = (nexpress_tp * .1);
					}
					nexpress_tp = (nexpress_tp - printDiscount);
					var printFullPrice = (nexpress_tp + printDiscount);
					updateText("myPrintDiscount", formatCurrency(printDiscount));
					updateText("myPrintFullPrice", formatCurrency(printFullPrice));
				}

				var printTotal = nexpress_tp;
				if (document.estiForm.purchMailListCost && document.estiForm.purchMailListCost.value != '') {
					var grandTotal = (nexpress_tp + Math.round(totalMailingCost) + Math.round(document.estiForm.purchMailListCost.value));
				}
				else {
					var grandTotal = (nexpress_tp + Math.round(totalMailingCost));
				}
				updateText("myMailCost", formatCurrency2(totalMailingCost));
				updateText("myPrintCost", formatCurrency2(nexpress_tp));
				updateText("myTp", formatCurrency2(grandTotal));
				updateText("myTp2", formatCurrency2(grandTotal));
				document.estiForm.printCost.value = formatAsMoney(printTotal); //adds two zeros to the end of the price.
				document.estiForm.ppu.value = formatCurrency(ppu);
				document.estiForm.tp.value = formatCurrency(grandTotal);
			}
			else if (document.estiForm.purchMailListCost && document.estiForm.purchMailListCost.value != '') {
				if (document.estiForm.productFamily.value == "Brochure" || document.estiForm.productFamily.value == "Sellsheet" || 
				document.estiForm.productFamily.value == "Card" || document.estiForm.productFamily.value == "w2pCard" || document.estiForm.productFamily.value == "HangTag" || document.estiForm.productFamily.value == "Flyer") {
					if (document.estiForm.productFamily.value == "Brochure" || document.estiForm.productFamily.value == "Sellsheet" || document.estiForm.productFamily.value == "HangTag" || document.estiForm.productFamily.value == "Flyer") {					
						var printDiscount = (nexpress_tp * .15);
					}					
					if (document.estiForm.productFamily.value == "Card" || document.estiForm.productFamily.value == "w2pCard") { 
						var printDiscount = (nexpress_tp * .1);
					}
					nexpress_tp = (nexpress_tp - printDiscount);
					var printFullPrice = (nexpress_tp + printDiscount);
					updateText("myPrintDiscount", formatCurrency(printDiscount));
					updateText("myPrintFullPrice", formatCurrency(printFullPrice));
				}
				var grandTotal = (nexpress_tp + Math.round(document.estiForm.purchMailListCost.value));
				//alert("nexpress_tp:" + nexpress_tp + "\n" + "mailList:" + Math.round(document.estiForm.purchMailListCost.value) + "\n" + "grandTotal:" + grandTotal);
				updateText("myPrintCost", formatCurrency2(nexpress_tp));
				updateText("myTp", formatCurrency2(grandTotal));
				updateText("myTp2", formatCurrency2(grandTotal));
				document.estiForm.printCost.value = formatAsMoney(printTotal); //adds two zeros to the end of the price.
				document.estiForm.ppu.value = formatCurrency(ppu);
				document.estiForm.tp.value = formatCurrency(grandTotal);
			}
			else { //NO MAILING
				if (document.estiForm.productFamily.value == "Brochure" || document.estiForm.productFamily.value == "Sellsheet" || 
				document.estiForm.productFamily.value == "Card" || document.estiForm.productFamily.value == "w2pCard" || document.estiForm.productFamily.value == "HangTag" || document.estiForm.productFamily.value == "Flyer") {
					if (document.estiForm.productFamily.value == "Brochure" || document.estiForm.productFamily.value == "Sellsheet" || document.estiForm.productFamily.value == "HangTag" || document.estiForm.productFamily.value == "Flyer") {					
						var printDiscount = (nexpress_tp * .15);
					}					
					if (document.estiForm.productFamily.value == "Card" || document.estiForm.productFamily.value == "w2pCard") { 
						var printDiscount = (nexpress_tp * .1);
					}
					nexpress_tp = (nexpress_tp - printDiscount);
					var printFullPrice = (nexpress_tp + printDiscount);
					updateText("myPrintDiscount", formatCurrency(printDiscount));
					updateText("myPrintFullPrice", formatCurrency(printFullPrice));
				}
				var printTotal = nexpress_tp;
				var grandTotal = nexpress_tp;
				updateText("myPrintCost", formatCurrency2(nexpress_tp));
				updateText("myMailCost", formatCurrency2(0));					
				updateText("myTp", formatCurrency2(grandTotal));
				updateText("myTp2", formatCurrency2(grandTotal));
				document.estiForm.ppu.value=formatCurrency(ppu);
				document.estiForm.tp.value=formatCurrency2(nexpress_tp);
				printTotal = Math.round(printTotal); //round to the nearest buck
				document.estiForm.printCost.value = formatAsMoney(printTotal); //adds two zeros to the end of the price.
				document.estiForm.shipQuant.value = quantity;
			}
		}
	}
	//ELSE THE 74CD IS THE CHOSEN PRESS DO THE CONTENTS OF THIS ELSE
	else {
		ppu = (tp / (document.estiForm.realquant.value));
		document.estiForm.press.value="74CD";
		if (mode && mode == 1) { //mode 1 used for calc prices from the re-order page.
			updatePrice("ppu", formatCurrency(ppu), ppu, quantity);
			updatePrice("tp", formatCurrency(tp), tp, quantity);
		}
		else {
			if (document.estiForm.mailing &&
			  document.estiForm.mailing.options[document.estiForm.mailing.selectedIndex].value != "no" && 
 			  document.estiForm.mailQuant.value > 0) { //IF MAILING IS ON AND HAS A VALID QUANTITY
				if (document.estiForm.purchMailListCost && document.estiForm.purchMailListCost.value != '') {
				if (document.estiForm.productFamily.value == "Brochure" || document.estiForm.productFamily.value == "Sellsheet" || 
				document.estiForm.productFamily.value == "Card" || document.estiForm.productFamily.value == "w2pCard" || document.estiForm.productFamily.value == "HangTag" || document.estiForm.productFamily.value == "Flyer") {
					if (document.estiForm.productFamily.value == "Brochure" || document.estiForm.productFamily.value == "Sellsheet" || document.estiForm.productFamily.value == "HangTag" || document.estiForm.productFamily.value == "Flyer") {					
						var printDiscount = (tp * .15);
					}					
					if (document.estiForm.productFamily.value == "Card" || document.estiForm.productFamily.value == "w2pCard") { 
						var printDiscount = (tp * .1);
					}
					tp = (tp - printDiscount);
					var printFullPrice = (tp + printDiscount);
					updateText("myPrintDiscount", formatCurrency(printDiscount));
					updateText("myPrintFullPrice", formatCurrency(printFullPrice));
					}
					var grandTotal = (tp + Math.round(totalMailingCost) + Math.round(document.estiForm.purchMailListCost.value));
				}
				else {
				if (document.estiForm.productFamily.value == "Brochure" || document.estiForm.productFamily.value == "Sellsheet" || 
				document.estiForm.productFamily.value == "Card" || document.estiForm.productFamily.value == "w2pCard" || document.estiForm.productFamily.value == "HangTag" || document.estiForm.productFamily.value == "Flyer") {
						if (document.estiForm.productFamily.value == "Brochure" || document.estiForm.productFamily.value == "Sellsheet" || document.estiForm.productFamily.value == "HangTag" || document.estiForm.productFamily.value == "Flyer") {					
							var printDiscount = (tp * .15);
						}					
						if (document.estiForm.productFamily.value == "Card" || document.estiForm.productFamily.value == "w2pCard") { 
							var printDiscount = (tp * .1);
						}
						tp = (tp - printDiscount);
						var printFullPrice = (tp + printDiscount);
						updateText("myPrintDiscount", formatCurrency(printDiscount));
						updateText("myPrintFullPrice", formatCurrency(printFullPrice));
					}
					var grandTotal = (tp + Math.round(totalMailingCost));
				}
				updateText("myPrintCost", formatCurrency(tp));
				updateText("myTp", formatCurrency(grandTotal));
				updateText("myTp2", formatCurrency(grandTotal));
				document.estiForm.printCost.value = formatAsMoney(tp); //this trick adds two zeros to the end of the price.
				document.estiForm.ppu.value = formatCurrency(ppu);
				document.estiForm.tp.value = formatCurrency(grandTotal);
			}
			else if (document.estiForm.purchMailListCost && document.estiForm.purchMailListCost.value != '') {
				if (document.estiForm.productFamily.value == "Brochure" || document.estiForm.productFamily.value == "Sellsheet" || 
				document.estiForm.productFamily.value == "Card" || document.estiForm.productFamily.value == "w2pCard" || document.estiForm.productFamily.value == "HangTag" || document.estiForm.productFamily.value == "Flyer") {
						if (document.estiForm.productFamily.value == "Brochure" || document.estiForm.productFamily.value == "Sellsheet" || document.estiForm.productFamily.value == "HangTag" || document.estiForm.productFamily.value == "Flyer") {					
							var printDiscount = (tp * .15);
						}					
						if (document.estiForm.productFamily.value == "Card" || document.estiForm.productFamily.value == "w2pCard") { 
							var printDiscount = (tp * .1);
						}
						tp = (tp - printDiscount);
						var printFullPrice = (tp + printDiscount);
						updateText("myPrintDiscount", formatCurrency(printDiscount));
						updateText("myPrintFullPrice", formatCurrency(printFullPrice));
					}
				var grandTotal = (tp + Math.round(document.estiForm.purchMailListCost.value));				
				updateText("myPrintCost", formatCurrency(tp));
				updateText("myTp", formatCurrency(grandTotal));
				updateText("myTp2", formatCurrency(grandTotal));
				document.estiForm.printCost.value = formatAsMoney(tp); //this trick adds two zeros to the end of the price.
				document.estiForm.ppu.value = formatCurrency(ppu);
				document.estiForm.tp.value = formatCurrency(grandTotal);
			}
			else { //NO MAILING
				if (document.estiForm.productFamily.value == "Brochure" || document.estiForm.productFamily.value == "Sellsheet" || 
				document.estiForm.productFamily.value == "Card" || document.estiForm.productFamily.value == "w2pCard" || document.estiForm.productFamily.value == "HangTag" || document.estiForm.productFamily.value == "Flyer") {
						if (document.estiForm.productFamily.value == "Brochure" || document.estiForm.productFamily.value == "Sellsheet" || document.estiForm.productFamily.value == "HangTag" || document.estiForm.productFamily.value == "Flyer") {					
							var printDiscount = (tp * .15);
						}					
						if (document.estiForm.productFamily.value == "Card" || document.estiForm.productFamily.value == "w2pCard") { 
							var printDiscount = (tp * .1);
						}
						tp = (tp - printDiscount);
						var printFullPrice = (tp + printDiscount);
						updateText("myPrintDiscount", formatCurrency(printDiscount));
						updateText("myPrintFullPrice", formatCurrency(printFullPrice));
					}
				var printTotal = tp;
				var grandTotal = tp;
				updateText("myPrintCost", formatCurrency(tp));
				updateText("myMailCost", formatCurrency2(0));					
				updateText("myTp", formatCurrency(grandTotal));
				updateText("myTp2", formatCurrency(grandTotal));
				document.estiForm.ppu.value=formatCurrency(ppu);
				document.estiForm.tp.value=formatCurrency(tp);
				document.estiForm.printCost.value = formatAsMoney(printTotal);
			}
				
		}
	}
	//alert(document.estiForm.press.value);
	/*if (si <= 234)
		document.estiForm.nexpress_tp.value=formatCurrency2(nexpress_tp);
	else
		document.estiForm.nexpress_tp.value='flat size too large';
	*/
	//document.estiForm.ppu.value=formatCurrency(ppu);
	
	
	/*
	alert("calculated the following:"+
	"\nsSquare Inches: " + si +
	"\nTotal Square Inches: " + tsi +
	"\n74 Total Price: " + tp +
	"\nNP Total Price: " + nexpress_tp +
	"\nFolding: " + calcFolding() +		
	"\npaper: " + calcPaper(tsi, si, "pages") + "\n" +
	"\nnexpress: " + calcNexPress(document.estiForm.realquant.value, si, "pages") + "\n" + 
	"\ndrilling: " + calcDrilling() + "\n" + 
	"\nperfing: " + calcPerforating() + "\n" + 
	"\nscore: " + calcScoring() + "\n" + 
	"\nfolding: " + calcFolding() + "\n" + 
	"\nproof: " + calcNexPressProof(si) + "\n" + 
	"\nhandling: " + calcHandling(tsi) + "\n");
	*/
}

function calcBlankEnvelopes() {
	if (document.estiForm.productFamily && document.estiForm.productFamily.value != "Greeting Card" && document.estiForm.productFamily.value != "Invitation") {
		if (document.estiForm.blankEnvelopes && document.estiForm.blankEnvelopes.options && document.estiForm.blankEnvelopesSize.options && 
			document.estiForm.blankEnvelopes.options[document.estiForm.blankEnvelopes.selectedIndex].value != "no" && 
			document.estiForm.blankEnvelopesSize.options[document.estiForm.blankEnvelopesSize.selectedIndex].value != "") {
				var env = document.estiForm.blankEnvelopes.options[document.estiForm.blankEnvelopes.selectedIndex].value;
				var envSize = document.estiForm.blankEnvelopesSize.options[document.estiForm.blankEnvelopesSize.selectedIndex].value;
				if (envSize == "A-6")
					document.estiForm.blankEnvCost.value = ( (env/250) * 28);
				else if (envSize == "A-7")
					document.estiForm.blankEnvCost.value = ( (env/250) * 35);
				else if (envSize == "A-2")
					document.estiForm.blankEnvCost.value = ( (env/250) * 25);				
				if (document.estiForm.blankEnvCost.value && document.estiForm.blankEnvCost.value != "") {
					return parseInt(document.estiForm.blankEnvCost.value);
				}
				else
					return 0;
			}
		else if (document.estiForm.blankEnvelopes && document.estiForm.blankEnvelopes.value != "no" && document.estiForm.blankEnvelopesSize.value != "") {
				var env = document.estiForm.blankEnvelopes.value;
				var envSize = document.estiForm.blankEnvelopesSize.value;
				if (envSize == "A-6")
					document.estiForm.blankEnvCost.value = ( (env/250) * 28);
				else if (envSize == "A-7")
					document.estiForm.blankEnvCost.value = ( (env/250) * 35);
				else if (envSize == "A-2")
					document.estiForm.blankEnvCost.value = ( (env/250) * 25);				
				if (document.estiForm.blankEnvCost.value && document.estiForm.blankEnvCost.value != "")
					return parseInt(document.estiForm.blankEnvCost.value);
				else
					return 0;
			}
		else {
			return 0;
		}
	}
	else if (document.estiForm.productFamily && (document.estiForm.productFamily.value == "Greeting Card" || document.estiForm.productFamily.value == "Invitation")) {
		if (document.estiForm.greetingCardEnvelopes.options[document.estiForm.greetingCardEnvelopes.selectedIndex].value == "Blank") {			
			var envQuant = (Math.ceil(document.estiForm.quantity.value / 25) * 25);
			document.estiForm.blankEnvelopes.value = envQuant;				
			if (document.estiForm.greetingCardSize.value == "4.25 x 6") {
				document.estiForm.blankEnvCost.value = ( (envQuant/250) * 28);
				return parseInt(document.estiForm.blankEnvCost.value);
			}
			else if (document.estiForm.greetingCardSize.value == "5 x 7") {
				document.estiForm.blankEnvCost.value = ( (envQuant/250) * 35);
				return parseInt(document.estiForm.blankEnvCost.value);
			}
			else if (document.estiForm.greetingCardSize.value == "4 x 5.5") {
				document.estiForm.blankEnvCost.value = ( (envQuant/250) * 25);
				return parseInt(document.estiForm.blankEnvCost.value);
			}
		}
		else {
			if (document.estiForm.greetingCardEnvelopes.options[document.estiForm.greetingCardEnvelopes.selectedIndex].value == "None") {
				document.estiForm.blankEnvelopesSize.value = "no";
			}						
			document.estiForm.blankEnvelopes.value = "no";							
			return 0;
		}
	}
	else {
		return 0;
	}
}

function calcKonlyEnvelopes() {
	if (document.estiForm.productFamily && document.estiForm.productFamily.value != "Greeting Card" && document.estiForm.productFamily.value != "Invitation") {
		if (document.estiForm.konlyEnvelopes && document.estiForm.konlyEnvelopes.options && 
			document.estiForm.konlyEnvelopes.options[document.estiForm.konlyEnvelopes.selectedIndex].value != "no" && 
			document.estiForm.blankEnvelopesSize.options[document.estiForm.blankEnvelopesSize.selectedIndex].value != "") {
				var env = document.estiForm.konlyEnvelopes.options[document.estiForm.konlyEnvelopes.selectedIndex].value;
				var envSize = document.estiForm.blankEnvelopesSize.options[document.estiForm.blankEnvelopesSize.selectedIndex].value;
				//alert(env + " " + envSize);
			if (envSize == "A-2") //price per 1000
				var envPerM = 43.12
			if (envSize == "A-6")
				var envPerM = 50.99
			if (envSize == "A-7")
				var envPerM = 65.96
		
			if (env <= 500) //env Quant plus makeready
				 envMR = (env * 1.4)
			else if (env <= 1000)
				 envMR = (env * 1.2)
			else if (env <= 8000) 
				 envMR = (env * 1.1)
			else if (env <= 50000)
				 envMR = (env * 1.05)
			var envPrice = ((((envMR / 1000) * envPerM) * 1.4) + 130) //envelope price plus dt, proof and plate
			if (envMR <= 700) // time on press = no. per hour times 78
				var pressHours = (envMR / 1400) * 78
			else if (envMR <= 1200)
				var pressHours = (envMR / 1600) * 78
			else if (envMR <= 5500)
				var pressHours = (envMR / 2200) * 78
			else
				var pressHours = (envMR / 2500) * 78
			document.estiForm.konlyEnvCost.value = (envPrice + pressHours);
			return parseInt(document.estiForm.konlyEnvCost.value);
		}
		else {
			return 0;
		}
	}
	else if (document.estiForm.productFamily && (document.estiForm.productFamily.value == "Greeting Card" || document.estiForm.productFamily.value == "Invitation" ) && 
			(document.estiForm.greetingCardEnvelopes.options && document.estiForm.greetingCardEnvelopes.options[document.estiForm.greetingCardEnvelopes.selectedIndex].value == "Printed - Return Address, Black Ink")) {
		var env = (Math.ceil(document.estiForm.quantity.value / 25) * 25);
		if (document.estiForm.greetingCardSize.value == "4.25 x 6") {		
			var envSize = "A-6";
		}
		if (document.estiForm.greetingCardSize.value == "5 x 7") {		
			var envSize = "A-7";
		}
		if (document.estiForm.greetingCardSize.value == "4 x 5.5") {		
			var envSize = "A-2";
		}
		if (envSize == "A-2") //price per 1000
			var envPerM = 43.12
		if (envSize == "A-6")
			var envPerM = 50.99
		if (envSize == "A-7")
			var envPerM = 65.96
	
		if (env <= 500) //env Quant plus makeready
			 envMR = (env * 1.4)
		else if (env <= 1000)
			 envMR = (env * 1.2)
		else if (env <= 8000) 
			 envMR = (env * 1.1)
		else if (env <= 50000)
			 envMR = (env * 1.05)
		
		var envPrice = ((((envMR / 1000) * envPerM) * 1.4) + 130) //envelope price plus markup, dt, proof and plate
		if (envMR <= 700) // time on press = no. per hour times 78
			var pressHours = (envMR / 1400) * 78
		else if (envMR <= 1200)
			var pressHours = (envMR / 1600) * 78
		else if (envMR <= 5500)
			var pressHours = (envMR / 2200) * 78
		else
			var pressHours = (envMR / 2500) * 78

		document.estiForm.konlyEnvelopes.value = env;	
		document.estiForm.konlyEnvCost.value = (envPrice + pressHours);
		/* alert("Envelope Printing Costs:"+
		"\nPrice per 1000: " + envPerM +
		"\nTotal envelopes without makeready: " + env +
		"\nTotal envelopes incl. makeready: " + envMR +
		"\nEnvelopes Price (incl. dt & plate): " + envPrice +
		"\nPress costs ($78/hr): " + pressHours +
		"\nTotal: " + document.estiForm.konlyEnvCost.value);
		*/
		return parseInt(document.estiForm.konlyEnvCost.value);
	}		
	else {
		if (document.estiForm.greetingCardEnvelopes.options[document.estiForm.greetingCardEnvelopes.selectedIndex].value == "None") {
			document.estiForm.blankEnvelopesSize.value = "no";
		}						
		document.estiForm.konlyEnvelopes.value = "no";	
		return 0;
	}
}

function calcW2pBlankEnvelopes() {
	if (document.estiForm.w2pEnvelopesBlank && 
	  document.estiForm.w2pEnvelopesBlank.options[document.estiForm.w2pEnvelopesBlank.selectedIndex].value != "0") {
		var env = document.estiForm.w2pEnvelopesBlank.options[document.estiForm.w2pEnvelopesBlank.selectedIndex].value;
		//alert(env);
		if (document.estiForm.finalWidth.value == "7") {			
			document.estiForm.w2pBlankEnvCost.value = ( (env/250) * 35);
		}

		else if (document.estiForm.finalWidth.value == "6") {
			//alert("adding a-6 env")
			document.estiForm.w2pBlankEnvCost.value = ( (env/250) * 28);
		}
		
		if (document.estiForm.w2pBlankEnvCost.value && document.estiForm.w2pBlankEnvCost.value != "") {
			return parseInt(document.estiForm.w2pBlankEnvCost.value);
		}
		else {
			//alert("returning 0")
			return 0;
		}
	}
	else {
		return 0;
	}
}

function calcW2pPrintedEnvelopes() {
	if (document.estiForm.w2pEnvelopesPrint && 
	  document.estiForm.w2pEnvelopesPrint.options[document.estiForm.w2pEnvelopesPrint.selectedIndex].value != "0") {
		var env = document.estiForm.w2pEnvelopesPrint.options[document.estiForm.w2pEnvelopesPrint.selectedIndex].value;
			if (document.estiForm.finalWidth.value == "6") {
				var envSize = "A-6";
			}
			if (document.estiForm.finalWidth.value == "7") {				
				var envSize = "A-7";
			}
			if (envSize == "A-6")
				var envPerM = 50.99
			if (envSize == "A-7")
				var envPerM = 65.96
		
			if (env <= 500) //env Quant plus makeready
				 envMR = (env * 1.4)
			else if (env <= 1000)
				 envMR = (env * 1.2)
			else if (env <= 8000) 
				 envMR = (env * 1.1)
			else if (env <= 50000)
				 envMR = (env * 1.05)
			
			var envPrice = ((((envMR / 1000) * envPerM) * 1.4) + 130) //envelope price plus markup, dt, proof and plate
			if (envMR <= 700) // time on press = no. per hour times 78
				var pressHours = (envMR / 1400) * 78
			else if (envMR <= 1200)
				var pressHours = (envMR / 1600) * 78
			else if (envMR <= 5500)
				var pressHours = (envMR / 2200) * 78
			else
				var pressHours = (envMR / 2500) * 78
			document.estiForm.w2pPrintedEnvCost.value = (envPrice + pressHours);
		if (document.estiForm.w2pPrintedEnvCost.value && document.estiForm.w2pPrintedEnvCost.value != "") {
			return parseInt(document.estiForm.w2pPrintedEnvCost.value);
		}
		else {
			//alert("returning 0")
			return 0;
		}
	}
	else {
		return 0;
	}
}

function calcMailLabor(si, weightPerUnit, mailQuant, mailRate) {


	var mailLabor = ((mailQuant * 0.05) + 80); //increased labor fee by $20 due to NCOA req's. Jan.27, 2010 - BV
	if (si > 70.4375)
		mailLabor += (mailQuant * 0.03);
	
	if (((document.estiForm.blankEnvelopes && document.estiForm.blankEnvelopes.value != "no") || 
		(document.estiForm.konlyEnvelopes && document.estiForm.konlyEnvelopes.value != "no"))
		&& mailQuant != "0")
		mailLabor += (mailQuant * .18);
	
	if (mailLabor != null && mailLabor > 0 && document.estiForm.mailLabor)
		document.estiForm.mailLabor.value = mailLabor;
	else {
		if (document.estiForm.mailLabor)
			document.estiForm.mailLabor.value = 0;
	}
	return mailLabor;
}



function calcPostage(productFamily, si, weightPerUnit, mailQuant, mailRate) {
	var finalHeight = document.estiForm.finalHeight.value;
	var finalWidth = document.estiForm.finalWidth.value;
	if ((productFamily == 'Card' || productFamily == 'w2pCard') && document.estiForm.blankEnvelopes.value == "no" && document.estiForm.konlyEnvelopes.value == "no") {

		if (mailRate == "firstClass") {
			if (si >= 17.5 && si <= 25.5) { // sizes between 3.5 x 5 --> 4.25 x 6
				var postage = (mailQuant * 0.23);
			}
			else if (si > 25.5 && si <= 70.4375) { // sizes bigger than 4.25 x 6 and up to 6.125 x 11.5
				var postage = (mailQuant * 0.382);
			}
		}
		
		if (mailRate == "bulkMail") {
			if (si <= 25.5) { // sizes between 3.5 x 5 --> 6.125 x 11.5
				return null; //not an option should be caught by the dependency checking function, but just in case, return null
			}
			else if (si > 25.5 && si <= 70.4375) { // sizes bigger than 4.25 x 6 and up to 6.125 x 11.5
				var postage = (mailQuant * 0.27); 
			}
		}
		
		// This is Grant's attempt to add non-profit to postcards
		// See commented section below to see if script is correct. 
		// I know that I have a redundent else if but I didn't want to change it
		if (mailRate == "nonProfit") {
			if (si >= 17.5 && si <= 25.5) { // sizes between 3.5 x 5 --> 4.25 x 6
				var postage = (mailQuant * 0.159);
			}
			else if (si > 25.5 && si <= 70.4375) { // sizes bigger than 4.25 x 6 and up to 6.125 x 11.5
			var postage = (mailQuant * 0.169);
			}
		}
		
		if (mailRate == "stamps") {
			if (si >= 17.5 && si <= 25.5) { // sizes between 3.5 x 5 --> 4.25 x 6
				var postage = (mailQuant * 0.33); //.28 for postage + .05 for applying stamps
			}
			else if (si > 25.5 && si <= 70.4375) { // sizes bigger than 4.25 x 6 and up to 6.125 x 11.5
				var postage = (mailQuant * 0.49); //.44 for postage + .05 for applying stamps
			}
		}
	}
		
	else {  //the non-postcard stuff
		if (document.estiForm.fold && document.estiForm.fold.value != "no" && document.estiForm.fold.value != "SignatureFold") { // have to "switch" height and width on some folded pieces for proper postage calculations! - BV, 010809
			var finalHeight = document.estiForm.finalWidth.value;
			var finalWidth = document.estiForm.finalHeight.value;
			//alert("switching height & width: \nfinal height :" + finalHeight + "\nfinal width: " +finalWidth);
		}
		if (mailRate == "firstClass") {
			if (si >= 17.5 && si <= 70.4375 && finalWidth <= 6.125 && finalHeight <= 11.5) { // sizes between 3.5 x 5 --> 6.125 x 11.5
				if(weightPerUnit <= 1) {
					var postage = (mailQuant * 0.382);
				}
				else if(weightPerUnit <= 2) {
					var postage = (mailQuant * 0.507);
				}
				else if(weightPerUnit <= 3.3) {
					var postage = (mailQuant * 0.632);
				}
				else {
					return null;
				}
			}
			else if ((si > 70.4375 && si <= 180) || (finalWidth > 6.125) || (finalHeight > 11.5)) { // sizes between 6.125 x 11.5 --> 12 x 15
				if(weightPerUnit <= 1) {
					var postage = (mailQuant * 0.725);
				}
				else if(weightPerUnit <= 2) {
					var postage = (mailQuant * 0.895);
				}
				else if(weightPerUnit <= 3.3) {
					var postage = (mailQuant * 1.065);
				}
				else {
					return null;
				}
			}
		}
			
		if (mailRate == "bulkMail") {
			if(weightPerUnit <= 3.3) {
				if (si >= 17.5 && si <= 70.4375 && finalWidth <= 6.125 && finalHeight <= 11.5) { // sizes between 3.5 x 5 --> 6.125 x 11.5
					var postage = (mailQuant * 0.270); 
				}
				else if ((si > 70.4375 && si <= 180) || (finalWidth > 6.125) || (finalHeight > 11.5)) { // sizes between 6.125 x 11.5 --> 12 x 15
					var postage = (mailQuant * 0.496); 
				}
			}
			else if(weightPerUnit > 3.3) {
				if (si >= 17.5 && si <= 70.4375 && finalWidth <= 6.125 && finalHeight <= 11.5) { // sizes between 3.5 x 5 --> 6.125 x 11.5
					var postage = (mailQuant * (0.725 + 0.120));
				}
				else if ((si > 70.4375 && si <= 180) || (finalWidth > 6.125) || (finalHeight > 11.5)) { // sizes between 6.125 x 11.5 --> 12 x 15
					var postage = (mailQuant * (0.725 + 0.346));
				}
			}
		}
			
		if (mailRate == "nonProfit") {
			if(weightPerUnit <= 3.3) {
				if (si >= 17.5 && si <= 70.4375 && finalWidth <= 6.125 && finalHeight <= 11.5) { // sizes between 3.5 x 5 --> 6.125 x 11.5
					var postage = (mailQuant * 0.169);
				}
				else if ((si > 70.4375 && si <= 180) || (finalWidth > 6.125) || (finalHeight > 11.5)) { // sizes between 6.125 x 11.5 --> 12 x 15
					var postage = (mailQuant * 0.362);
				}
			}
			else if (weightPerUnit > 3.3) {
				if (si >= 17.5 && si <= 70.4375 && finalWidth <= 6.125 && finalHeight <= 11.5) { // sizes between 3.5 x 5 --> 6.125 x 11.5
					var postage = (mailQuant * (0.628 + .039));
				}
				else if ((si > 70.4375 && si <= 180) || (finalWidth > 6.125) || (finalHeight > 11.5)) { // sizes between 6.125 x 11.5 --> 12 x 15
					var postage = (mailQuant * (0.628 + 0.232));
				}
			}
		}
			
		if (mailRate == "stamps") {
			if (si >= 17.5 && si <= 70.4375 && finalWidth <= 6.125 && finalHeight <= 11.5) { // sizes between 3.5 x 5 --> 6.125 x 11.5
				if(weightPerUnit <= 1) {
					var postage = (mailQuant * 0.49); // postage plus 5 cents for adding stamp
				}
				else if(weightPerUnit <= 2) {
					var postage = (mailQuant * 0.66);
				}
				else if(weightPerUnit <= 3.3) {
					var postage = (mailQuant * 0.83);
				}
				else {
					return null;
				}
			}
			else if ((si > 70.4375 && si <= 180) || (finalWidth > 6.125) || (finalHeight > 11.5)) { // sizes between 6.125 x 11.5 --> 12 x 15
				if(weightPerUnit <= 1) {
					var postage = (mailQuant * 0.93); // postage plus 5 cents for adding stamp
				}
				else if(weightPerUnit <= 2) {
					var postage = (mailQuant * 1.10);
				}
				else if(weightPerUnit <= 3.3) {
					var postage = (mailQuant * 1.27);
				}
				else {
					return null;
				}
			}
		}
	}
	if (postage != null && postage > 0) 
	document.estiForm.postage.value = postage;
	
	else 
	document.estiForm.postage.value = 0;
	return postage;
}

function calcNexPress(quantity, si, page_type) {
	if (page_type == "cover") {
		this_type = (document.estiForm.coverColors.options) ? document.estiForm.coverColors.options[document.estiForm.coverColors.selectedIndex].value : document.estiForm.coverColors.value;
	}
	else {
		this_type = (document.estiForm.colors.options) ? document.estiForm.colors.options[document.estiForm.colors.selectedIndex].value : document.estiForm.colors.value;
	}
	
	
	if (page_type == "postcard_gr") {
		nexpress = (getNexPressFactor(quantity, si, this_type));
	}
	else {
		nexpress = (getNexPressFactor(quantity, si, this_type));
	}
	
	
	if (page_type == "cover") {
		document.estiForm.coverPresscharge.value=formatCurrency(press);
	}
	else if (page_type == "pages1") {
		document.estiForm.presscharge1.value=formatCurrency(press);
	}
	else if (page_type == "pages2") {
		document.estiForm.presscharge2.value=formatCurrency(press);
	}
	else if (page_type == "pages3") {
		document.estiForm.presscharge3.value=formatCurrency(press);
	}
	else if (page_type == "pages4") {
		document.estiForm.presscharge4.value=formatCurrency(press);
	}
	else if (page_type == "pages5") {
		document.estiForm.presscharge5.value=formatCurrency(press);
	}
	else if (page_type == "pages6") {
		document.estiForm.presscharge6.value=formatCurrency(press);
	}
	return nexpress;
}

function enableLock() {
	locked = true;
}
function disableLock() {
	locked = false;
}

function calculate_folder(mode) { // this is also used for doorhangers and CD/DVD sleeves) - BV

	// Remove non-numeric characters
	document.estiForm.quantity.value = document.estiForm.quantity.value.replace(/\D/g, "");
	if (setQuant() <= 0 && document.estiForm.tp) {
		document.estiForm.tp.value=formatCurrency(0);
		document.estiForm.ppu.value=formatCurrency(0);
		return true;
	}
	else if (setQuant() <= 0) {
		updatePrice("tp", formatCurrency(0), 0, document.estiForm.quantity.value);
		updatePrice("ppu", formatCurrency(0), 0, document.estiForm.quantity.value);
		return true;
	}
	
	quantity = document.estiForm.realquant.value;
	//square inches
	
	if (document.estiForm.productFamily.value == "Folder" || document.estiForm.productFamily.value.indexOf("w2pPresFolder") != -1) {
		si = (18 * 24); // starting flat sheet size in square inches
	}

	if (document.estiForm.productFamily.value == "Folder 4x9") {
		si = (18 * 12); // starting flat sheet size in square inches, this will run 2-up
	}

	if (document.estiForm.productFamily.value == "3 Panel Folder") {
		si = (28 * 22); // starting flat sheet size in square inches, this will run 1-up
	}

	if (document.estiForm.productFamily.value=="CD Sleeve 5x5") {
		si = (9 * 12); // starting flat sheet size in square inches, this will run 4-up
	}
	
	if (document.estiForm.productFamily.value=="Doorhanger") {
		si = (5 * 10); // starting flat sheet size in square inches, these will run 8-up - BV
		if (document.estiForm.doorhangerSize.options && document.estiForm.doorhangerSize.options[document.estiForm.doorhangerSize.selectedIndex].value == "4 x 9") { 
			document.estiForm.height.value = 9;
			document.estiForm.width.value = 4;
		}			
		if (document.estiForm.doorhangerSize.options && document.estiForm.doorhangerSize.options[document.estiForm.doorhangerSize.selectedIndex].value == "4.25 x 11") { 
			document.estiForm.height.value = 11;
			document.estiForm.width.value = 4.25;
		}			
	}

	if (document.estiForm.productFamily.value=="Doorhanger") { //doorhangers (for now) use hard-coded pricing - BV 6/26/09
		if (document.estiForm.quantity.value == 100){
			tp = 345.01
		}
		if (document.estiForm.quantity.value == 250){
			tp = 350.31
		}
		if (document.estiForm.quantity.value == 500){
			tp = 384.13
		}
		if (document.estiForm.quantity.value == 750){
			tp = 417.96
		}
		if (document.estiForm.quantity.value == 1000){
			tp = 476.78
		}
		if (document.estiForm.quantity.value == 1250){
			tp = 500.61
		}
		if (document.estiForm.quantity.value == 1500){
			tp = 519.43
		}
		if (document.estiForm.quantity.value == 1750){
			tp = 543.26
		}
		if (document.estiForm.quantity.value == 2000){
			tp = 562.08
		}
		if (document.estiForm.quantity.value == 2500){
			tp = 604.73
		}
		if (document.estiForm.quantity.value == 3000){
			tp = 647.38
		}
		if (document.estiForm.quantity.value == 3500){
			tp = 690.03
		}
		if (document.estiForm.quantity.value == 4000){
			tp = 732.68
		}
		if (document.estiForm.quantity.value == 4500){
			tp = 800.33
		}
		if (document.estiForm.quantity.value == 5000){
			tp = 867.98
		}
		if (document.estiForm.quantity.value == 6000){
			tp = 953.28
		}
		if (document.estiForm.quantity.value == 7000){
			tp = 1038.58
		}
		if (document.estiForm.quantity.value == 7500){
			tp = 1081.23
		}
		if (document.estiForm.quantity.value == 8000){
			tp = 1123.88
		}
		if (document.estiForm.quantity.value == 9000){
			tp = 1259.18
		}
		if (document.estiForm.quantity.value == 10000){
			tp = 1344.48
		}
		if (document.estiForm.quantity.value == 12500){
			tp = 2083.73
		}
		if (document.estiForm.quantity.value == 15000){
			tp = 1870.98
		}
		if (document.estiForm.quantity.value == 20000){
			tp = 2397.48
		}
		if (document.estiForm.quantity.value == 25000){
			tp = 2923.98
		}
		if (document.estiForm.quantity.value == 30000){
			tp = 3406.48
		}
		
		tp_no_rush = (tp + calcProof(si));

		//total price with rush charges
		tp = (tp_no_rush + calcRush(tp_no_rush, si));

		//finalSheets = ((si * document.estiForm.realquant.value)/8); // total sheets needed without makeready... div. by 8 so that doorhangers will NOT price W&T (calculates as 18x24 sheet) -BV
		tsi = (document.estiForm.realquant.value * 50); // sheets needed plus 200 sheets plus 3% for extra makeready
	}
	else {
		finalSheets = (si * document.estiForm.realquant.value); // total sheets needed without makeready
		tsi = ((finalSheets * 1.05) + 86400); // sheets needed plus 200 18x24 sheets plus 5% for extra makeready
		//total price without rush charges
		tp_no_rush = (calcPaper(tsi, si, "pages") + calcPress(document.estiForm.realquant.value, si, "pages") + calcProof(si) + calcHandling(tsi) );
	
		//total price with rush charges
		tp = (tp_no_rush + calcRush(tp_no_rush, si));
		//used for %5 addition to recycled paper orders
		tp = (tp + paperMarketAdjustment(tp, "single", quantity));
	
		//adjust for market changes based on quantity 
		tp = (tp + marketAdjustmentByQuantity(tp, si, "", "single", quantity));
		
		//adjust for market changes 
		tp = (tp + marketAdjustment(tp, "single", quantity));

		if (document.estiForm.paper.value == "20pt_kraftboard") { //plus 5% for kraft board
			tp = (tp + (tp * .05));
		}
		//add makeready from below
		tp = (tp + calcFolderMakeReady());	
	
		document.estiForm.si.value=si;
		document.estiForm.tsi.value=tsi;
	}

	//Grant's discounts, 08/12/09 - BV
	if (document.estiForm.productFamily.value == "Folder" || document.estiForm.productFamily.value.indexOf("w2pPresFolder") != -1) {
		if (quantity <= 250)
			tp = (tp - 200)
		else if (quantity <= 500)
			tp = (tp - 175)
		else if (quantity <= 750)
			tp = (tp - 125)
		else if (quantity <= 1500)
			tp = (tp - 150)
		else if (quantity <= 2000)
			tp = (tp - 225)
		else if (quantity <= 2500)
			tp = (tp - 300)
		else if (quantity <= 3000)
			tp = (tp - 350)
		else if (quantity <= 3500)
			tp = (tp - 425)
		else if (quantity <= 4000)
			tp = (tp - 525)
		else if (quantity <= 4500)
			tp = (tp - 600)
		else if (quantity <= 5000)
			tp = (tp - 700)
		else if (quantity <= 7000)
			tp = (tp - 800)
		else if (quantity <= 8000)
			tp = (tp - 850)
		else if (quantity <= 9000)
			tp = (tp - 900)
		else if (quantity <= 10000)
			tp = (tp - 950)
		else if (quantity <= 15000)
			tp = (tp - 1000)
		else if (quantity <= 20000)
			tp = (tp - 1250)
		else if (quantity <= 25000)
			tp = (tp - 1500)
		else if (quantity <= 30000)
			tp = (tp - 2000)
	}
		

		
	//alert(mode);
	if (mode && mode==1) {
		document.estiForm.press.value="74CD";
		updatePrice("ppu", formatCurrency(tp / (document.estiForm.realquant.value)), (tp / (document.estiForm.realquant.value)), quantity);
		//alert(tp);
		updatePrice("tp", formatCurrency2(tp), Math.round(tp), quantity);
	}
	else {
		//document.estiForm.tp.value=formatCurrency2(tp);
		//document.estiForm.press.value="74CD";
		//document.estiForm.ppu.value=formatCurrency(ppu);
		ppu = (tp / (document.estiForm.realquant.value));
		var printTotal = tp;
		var grandTotal = tp;
		updateText("myTp", formatCurrency(grandTotal));
		updateText("myTp2", formatCurrency(grandTotal));
		document.estiForm.ppu.value=formatCurrency(ppu);
		document.estiForm.tp.value=formatCurrency(tp);
		document.estiForm.printCost.value = formatAsMoney(printTotal);
		document.estiForm.shipQuant.value = quantity;

	}
		
	/*
	alert("calculated the following:"+
	"\nsSquare Inches: " + si +
	"\nTotal Square Inches: " + tsi +
	"\n74 Total Price: " + tp +
	"\nFolding: " + calcFolding() +		
	"\npaper: " + calcPaper(tsi, si, "pages") + "\n" +
	"\ndrilling: " + calcDrilling() + "\n" + 
	"\nperfing: " + calcPerforating() + "\n" + 
	"\nscore: " + calcScoring() + "\n" + 
	"\nfolding: " + calcFolding() + "\n" + 
	"\nproof: " + calcNexPressProof(si) + "\n" + 
	"\nhandling: " + calcHandling(tsi) + "\n");
	*/
}

function calcFolderMakeReady() {	
	if (document.estiForm.productFamily.value == "Folder" || document.estiForm.productFamily.value.indexOf("w2pPresFolder") != -1 || document.estiForm.productFamily.value == "3 Panel Folder") {
		makereadySheets = ((quantity * 1.05) + 200); //makeready sheets: total plus 200 plus 5%
		var diecutting = (50 + ((makereadySheets/2000) * 100) + (quantity * .015));	 // Diecutting: $50 flat-fee, plus 2k per hour at $100/hr, plus 1.5 cents per to punch out
	}

	if (document.estiForm.productFamily.value == "Folder 4x9" || document.estiForm.productFamily.value == "CD Sleeve 5x5") {
		makereadySheets = (((quantity * .5) * 1.05) + 200); //makeready sheets: total (2-up) plus 200 plus 5%
		var diecutting = (50 + ((makereadySheets/2000) * 100) + (quantity * .025)); // Diecutting: $50 flat-fee, plus 2k per hour at $100/hr, plus 2.5 cents per to punch out
	}

	if (document.estiForm.productFamily.value == "Doorhanger") {
		//makereadySheets = (((quantity * .125) * 1.03) + 200); //makeready sheets: total (2-up) plus 200 plus 3%
		//var diecutting = (100 + ((makereadySheets/2000) * 100) + (quantity * .025)); // Diecutting: $100 flat-fee, plus 2k per hour at $100/hr, plus 2.5 cents per to punch out ("inner weed")
	}


	// Next, glueing and folding: $75 flat, plus 5k per hour at $100/hr, 
	if (document.estiForm.productFamily.value != "Doorhanger") {
		var glueing = (75 + ((makereadySheets/5000) * 100));
		return (glueing + diecutting);
	}

	// Doorhanger "Post-trim" work 
		//if (document.estiForm.productFamily.value == "Doorhanger") {
			//var cuts = ((makereadySheets/500)*12)
			//var posttrim = (25 + ((cuts/60) * 75));
			//alert ("Post-trim and diecutting = " + (posttrim + diecutting));
			//return (posttrim + diecutting);
		//}
	
}

function getFolderFactor(quantity) {
	 var folder_markup = 1.3;
	 return ((0.0977 * quantity) + 140) * folder_markup;
}

function calcBooklet(quantity, pages, inside_quantity) {	

	var booklet = (getBookletFactor(quantity, pages, inside_quantity));
	//booklet = (booklet * 1.15);
	
	// add $15 per 1000 for shipping back and forth to bindery buyout plant
	booklet = (booklet + (Math.ceil(quantity / 1000) * 15));
	//alert ((Math.ceil(quantity / 1000) * 15));		
    if (document.estiForm.bind.options) {
		if (document.estiForm.bind.options[document.estiForm.bind.selectedIndex].value == "wiro") {//they chose a wire-o bind
			booklet = (booklet + eval(quantity)) //add $1 per book for wire-o
		}
	}
	else {
		if (document.estiForm.bind.value == "wiro") {//they chose a wire-o bind
			booklet = (booklet + eval(quantity)) //add $1 per book for wire-o
		}
	}
	document.estiForm.booklet.value=formatCurrency(booklet);
	//alert("pages: " + pages + "\nquantity: " + quantity + "\nbooklet: " + booklet);
	return booklet;
}

function getBookletFactor(quantity, pages, inside_quantity) {
	
	if (quantity <= 1000) {
		if (pages <= 4) {	 // up 4 pages	
			return ( (inside_quantity * .0115) + 15); //folding only
		}
		if (pages > 4 && pages <= 8) {	 // over 4 and up to 8 pages	
			return ((0.06667 * quantity + 143));
		}
		if (pages > 8 && pages <= 12) {	 // over 8 and up to 12 pages	
			return ((0.10000 * quantity + 150));
		}
		if (pages > 12 && pages <= 16) {	 // over 12 and up to 16 pages	
			return ((0.08889 * quantity + 161));
		}
		if (pages > 16 && pages <= 20) {	 // over 16 and up to 20 pages	
			return ((0.09444 * quantity + 166));
		}
		if (pages > 20 && pages <= 24) {	 // over 20 and up to 24 pages	
			return ((0.11111 * quantity + 179));
		}
		if (pages > 24 && pages <= 28) {	 // over 24 and up to 28 pages	
			return ((0.11111 * quantity + 174));
		}
		if (pages > 28 && pages <= 64) {	 // over 28 and up to 32 pages	
			return ((0.11111 * quantity + 179));
		}
	}
	if (quantity > 1000 && quantity <= 2500) {
		if (pages <= 4) {	 // up 4 pages	
			return ( (inside_quantity * .0115) + 15); //folding only
		}
		if (pages > 4 && pages <= 8) {	 // over 4 and up to 8 pages	
			return ((0.02667 * quantity + 183));
		}
		if (pages > 8 && pages <= 12) {	 // over 8 and up to 12 pages	
			return ((0.03667 * quantity + 213));
		}
		if (pages > 12 && pages <= 16) {	 // over 12 and up to 16 pages	
			return ((0.05000 * quantity + 208));
		}
		if (pages > 16 && pages <= 20) {	 // over 16 and up to 20 pages	
			return ((0.05333 * quantity + 207));
		}
		if (pages > 20 && pages <= 24) {	 // over 20 and up to 24 pages	
			return ((0.07667 * quantity + 203));
		}
		if (pages > 24 && pages <= 28) {	 // over 24 and up to 28 pages	
			return ((0.09333 * quantity + 192));
		}
		if (pages > 28 && pages <= 64) {	 // over 28 and up to 32 pages	
			return ((0.11000 * quantity + 180));
		}
	}
	if (quantity > 2500) {
		if (pages <= 4) {	 // up 4 pages	
			return ( (inside_quantity * .0115) + 15); //folding only
		}
		if (pages > 4 && pages <= 8) {	 // over 4 and up to 8 pages	
			return ((.01911 * quantity + 202));
		}
		if (pages > 8 && pages <= 12) {	 // over 8 and up to 12 pages	
			return ((.02667 * quantity + 238));
		}
		if (pages > 12 && pages <= 16) {	 // over 12 and up to 16 pages	
			return ((.03133 * quantity + 247));
		}
		if (pages > 16 && pages <= 20) {	 // over 16 and up to 20 pages	
			return ((.03956 * quantity + 241));
		}
		if (pages > 20 && pages <= 24) {	 // over 20 and up to 24 pages	
			return ((.04489 * quantity + 283));
		}
		if (pages > 24 && pages <= 28) {	 // over 24 and up to 28 pages	
			return ((.04911 * quantity + 302));
		}
		if (pages > 28 && pages <= 64) {	 // over 28 and up to 32 pages	
			return ((.04778 * quantity + 336));
		}
	}
}



function setFinalSize() {
	if (document.estiForm.fold && document.estiForm.fold.options && document.estiForm.fold.options[document.estiForm.fold.selectedIndex].value != "no") {
		if ((document.estiForm.height.options && document.estiForm.height.options[document.estiForm.height.selectedIndex].value <= parseFloat("5.5")) || (document.estiForm.width.options && document.estiForm.width.options[document.estiForm.width.selectedIndex].value <= parseFloat("5.5"))) {
			alert("Folding on Custom Sizes is allowed only on pieces that are at least 6 inches long on each dimension. If you need folding on a smaller piece, please request a 'Custom Quote' from the menu to the left.");
			document.estiForm.fold.selectedIndex=0;
			}
		else if (document.estiForm.fold.options[document.estiForm.fold.selectedIndex].value == "HalfFold" || document.estiForm.fold.options[document.estiForm.fold.selectedIndex].value == "GateFold") {			
			if (document.estiForm.height.options) {
				document.estiForm.finalHeight.value = roundAmount((document.estiForm.height.options[document.estiForm.height.selectedIndex].value / 2));
				document.estiForm.finalWidth.value = document.estiForm.width.options[document.estiForm.width.selectedIndex].value;
				updateText("myFinalHeight", roundAmount((document.estiForm.height.options[document.estiForm.height.selectedIndex].value / 2)));
				updateText("myFinalWidth", document.estiForm.width.options[document.estiForm.width.selectedIndex].value);
			}
			else {
				document.estiForm.finalHeight.value = roundAmount(document.estiForm.height.value / 2);
				document.estiForm.finalWidth.value = document.estiForm.width.value;
				updateText("myFinalHeight", roundAmount(document.estiForm.height.value / 2));
				updateText("myFinalWidth", document.estiForm.width.value);
			}			
		}
		else if (document.estiForm.fold.options[document.estiForm.fold.selectedIndex].value == "TriFold" || document.estiForm.fold.options[document.estiForm.fold.selectedIndex].value == "ZFold") {			
			if (document.estiForm.height.options) {
				document.estiForm.finalHeight.value = roundAmount((document.estiForm.height.options[document.estiForm.height.selectedIndex].value / 3));
				document.estiForm.finalWidth.value = document.estiForm.width.options[document.estiForm.width.selectedIndex].value;
				updateText("myFinalHeight", roundAmount((document.estiForm.height.options[document.estiForm.height.selectedIndex].value / 3)));
				updateText("myFinalWidth", document.estiForm.width.options[document.estiForm.width.selectedIndex].value);
			}
			else {
				document.estiForm.finalHeight.value = roundAmount(document.estiForm.height.value / 3);
				document.estiForm.finalWidth.value = document.estiForm.width.value;
				updateText("myFinalHeight", roundAmount(document.estiForm.height.value / 3));
				updateText("myFinalWidth", document.estiForm.width.value);
			}
		}
		else if (document.estiForm.fold.options[document.estiForm.fold.selectedIndex].value == "AccordianFold" || document.estiForm.fold.options[document.estiForm.fold.selectedIndex].value == "DoubleGateFold" || document.estiForm.fold.options[document.estiForm.fold.selectedIndex].value == "RollFold" || document.estiForm.fold.options[document.estiForm.fold.selectedIndex].value == "DoubleParallelFold") {			
			if (document.estiForm.height.options) {
				document.estiForm.finalHeight.value = roundAmount((document.estiForm.height.options[document.estiForm.height.selectedIndex].value / 4));
				document.estiForm.finalWidth.value = document.estiForm.width.options[document.estiForm.width.selectedIndex].value;
				updateText("myFinalHeight", roundAmount((document.estiForm.height.options[document.estiForm.height.selectedIndex].value / 4)));
				updateText("myFinalWidth", document.estiForm.width.options[document.estiForm.width.selectedIndex].value);
			}
			else {
				document.estiForm.finalHeight.value = roundAmount(document.estiForm.height.value / 4);
				document.estiForm.finalWidth.value = document.estiForm.width.value;
				updateText("myFinalHeight", roundAmount(document.estiForm.height.value / 4));
				updateText("myFinalWidth", document.estiForm.width.value);
			}
		}
		else if (document.estiForm.fold.options[document.estiForm.fold.selectedIndex].value == "SignatureFold") {			
			if (document.estiForm.height.options) {
				document.estiForm.finalHeight.value = roundAmount((document.estiForm.height.options[document.estiForm.height.selectedIndex].value / 2));
				document.estiForm.finalWidth.value = roundAmount((document.estiForm.width.options[document.estiForm.width.selectedIndex].value / 2));
				updateText("myFinalHeight", roundAmount((document.estiForm.height.options[document.estiForm.height.selectedIndex].value / 2)));
				updateText("myFinalWidth", roundAmount((document.estiForm.width.options[document.estiForm.width.selectedIndex].value / 2)));
			}
			else {
				document.estiForm.finalHeight.value = roundAmount(document.estiForm.height.value / 2);
				document.estiForm.finalWidth.value = roundAmount(document.estiForm.width.value / 2);
				updateText("myFinalHeight", roundAmount(document.estiForm.height.value / 2));
				updateText("myFinalWidth", roundAmount(document.estiForm.width.value / 2));
			}
		}
	}
		
	else if (document.estiForm.multi && document.estiForm.productFamily != "DLCalendar" && document.estiForm.productFamily != "HouseCalendar") {
		document.estiForm.height.value = (document.estiForm.finalHeight.options[document.estiForm.finalHeight.selectedIndex].value);
		document.estiForm.width.value = (document.estiForm.finalWidth.options[document.estiForm.finalWidth.selectedIndex].value * 2);
		//updateText("finalHeight", roundAmount((document.estiForm.height.options[document.estiForm.height.selectedIndex].value / 2)));
		//updateText("finalWidth", roundAmount((document.estiForm.width.options[document.estiForm.width.selectedIndex].value / 2)));

		//alert(document.estiForm.width.value + " x " + document.estiForm.height.value);
	}
	
	else if (document.estiForm.productFamily.value.indexOf("Stationery") != -1) {
		document.estiForm.height.value = (3.5);
		document.estiForm.width.value = (2);
	}
	
	
	else {
		if (document.estiForm.height.options && document.estiForm.width.options) {
			document.estiForm.finalHeight.value = document.estiForm.height.options[document.estiForm.height.selectedIndex].value;
			document.estiForm.finalWidth.value = document.estiForm.width.options[document.estiForm.width.selectedIndex].value;
			updateText("myFinalHeight", document.estiForm.height.options[document.estiForm.height.selectedIndex].value);
			updateText("myFinalWidth", document.estiForm.width.options[document.estiForm.width.selectedIndex].value);
		}
		else {
			document.estiForm.finalHeight.value = document.estiForm.height.value;
			document.estiForm.finalWidth.value = document.estiForm.width.value;
			updateText("myFinalHeight", document.estiForm.height.value);
			updateText("myFinalWidth", document.estiForm.width.value);
		}		
	}
	
	if (document.estiForm.mailing && document.estiForm.mailing.options[document.estiForm.mailing.selectedIndex].value != "no" && document.estiForm.mailQuant.value > 0) {
		checkFinalMailDependencies(document.estiForm.productFamily.value, document.estiForm.realquant.value, document.estiForm.mailQuant.value);
	}
}

function setHeightWidth(select_object) {
	if (select_object.options[select_object.selectedIndex].value=="24") {
		document.estiForm.height.value="6";
		document.estiForm.width.value="4";
	}
	if (select_object.options[select_object.selectedIndex].value=="25.5") {
		document.estiForm.height.value="6";
		document.estiForm.width.value="4.25";
	}	
	if (select_object.options[select_object.selectedIndex].value=="35") {
		document.estiForm.height.value="7";
		document.estiForm.width.value="5";
	}
	if (select_object.options[select_object.selectedIndex].value=="40") {
		document.estiForm.height.value="8";
		document.estiForm.width.value="5";
	}
	if (select_object.options[select_object.selectedIndex].value=="46.75") {
		document.estiForm.height.value="8.5";
		document.estiForm.width.value="5.5";
	}
	if (select_object.options[select_object.selectedIndex].value=="51") {
		document.estiForm.height.value="8.5";
		document.estiForm.width.value="6";
	}
	if (select_object.options[select_object.selectedIndex].value=="54") {
		document.estiForm.height.value="9";
		document.estiForm.width.value="6";
	}
	if (select_object.options[select_object.selectedIndex].value=="66") {
		document.estiForm.height.value="11";
		document.estiForm.width.value="6";
	}
	if (select_object.options[select_object.selectedIndex].value=="70.4375") {
		document.estiForm.height.value="11.5";
		document.estiForm.width.value="6.125";
	}
}
		

function calcPaper(tsi, si, sheet_type) {
	if (sheet_type == "cover") {		
		if (document.estiForm.coverPaper.options) {
			if (document.estiForm.coverPaper.options[document.estiForm.coverPaper.selectedIndex].value == document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value) {
				type = "0";
			}
			else {
				type = document.estiForm.coverPaper.options[document.estiForm.coverPaper.selectedIndex].value;
		   }
		}
		else {
			if (document.estiForm.coverPaper.value == document.estiForm.paper.value) {
				type = "0";
			}
			else {
				type = document.estiForm.coverPaper.value;
		   }
		}
	}
	else {
		if (document.estiForm.paper.options) // for doing estimate when option lists are present
			type = document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value;
		else if (document.estiForm.paper.value)
			type = document.estiForm.paper.value;
	}
	//price per square inch
	ppsi = getPaperFactor(si, type);
	paper = ((ppsi * tsi));
	// add for paper overs...either 10% or 35 whichever is more
	if ( (paper / 10) > 35) {
		paper = (paper * 1.1);
	}
	else if (paper == 0) {
		paper = 0;
	}
	else {
		paper = (paper + 35);
	}
	if (sheet_type == "cover") {
		document.estiForm.coverPapercharge.value=formatCurrency(paper);
	}
	else {
		document.estiForm.papercharge.value=formatCurrency(paper);
	}
	return paper;
}



function getNexPressFactor(quantity, si, page_type) {
	if (page_type == "4over4") {
		nexpresscharges = get44NexPressPricing(quantity, si);
	}
	if (page_type == "4over1") {
		nexpresscharges = get41NexPressPricing(quantity, si);
	}
	if (page_type == "4over0") {
		nexpresscharges = get40NexPressPricing(quantity, si);
	}
	
	if (page_type == "1over1") {
		nexpresscharges = get11NexPressPricing(quantity, si);
	}
	if (page_type == "NoCover") {
		nexpresscharges = 0;
	}
	if (document.estiForm.nexpresscharge) {
		document.estiForm.nexpresscharge.value=formatCurrency(nexpresscharges);
	}
	return nexpresscharges;

}

function get44NexPressPricing(quantity, si) {	
	/*  87.5 setup, 216/168 ratio of total vs. used sheet space
			$xx.xx / sheetsize
		using y = mx+b:
		b = 87.5
		x = quantity
		m = si * 216/168 * .1/(12*18)
		*/
	if (si <= 7 && (document.estiForm.productFamily.value == "BusCard")) {
		//return (87.5 + (quantity * si * 216/168 * (.2/(12*18)) )); //  87.5 setup, 216/168 ratio of used vs. unused sheet space, 20¢ / sheetsize
		return (0 + (quantity * .14)); //  Extremely simplified biz card pricing, 082407 BV
	}

	else if (si < 35) {
        if (quantity <= 1000)
            return (21 + (quantity * si * 216/168 * (.89/(12*18)) ));
        else if (quantity > 1000 && quantity <= 3000)
            return (81 + (quantity * si * 216/168 * (.59/(12*18)) ));
        else
            return (163 + (quantity * si * 216/168 * (.4/(12*18)) ));
	}
	else if (si >= 35 && si < 40) {
        if (quantity <= 1000)
            return (74 + (quantity * si * 216/140 * (.76/(12*18)) ));
        else if (quantity > 1000 && quantity <= 3000)
            return (217 + (quantity * si * 216/140 * (.27/(12*18)) ));
        else
            return (235 + (quantity * si * 216/140 * (.246/(12*18)) ));
	}
	else if (si >= 40 && si < 54) {
        if (quantity <= 1000)
            return (74 + (quantity * si * 216/160 * (.89/(12*18)) ));
        else if (quantity > 1000 && quantity <= 3000)
            return (116 + (quantity * si * 216/160 * (.53/(12*18)) ));
        else
            return (75 + (quantity * si * 216/160 * (.576/(12*18)) ));
	}
	else if (si >= 54 && si < 66) {
        if (quantity <= 1000)
            return (56 + (quantity * si * 216/108 * (.57/(12*18)) ));
        else if (quantity > 1000 && quantity <= 3000)
            return (251 + (quantity * si * 216/108 * (.255/(12*18)) ));
        else
            return (279 + (quantity * si * 216/108 * (.239/(12*18)) ));
	}
	else if (si >= 66 && si < 75) {
        if (quantity <= 1000)
            return (25 + (quantity * si * 216/132 * (.915/(12*18)) ));
        else if (quantity > 1000 && quantity <= 3000)
            return (337 + (quantity * si * 216/132 * (.338/(12*18)) ));
        else
            return (373 + (quantity * si * 216/132 * (.316/(12*18)) ));
	}
	else if (si < 93.5)
		return (quantity * si * 1.5  * .0092593);
	else
		return (quantity * si * 1.25  * .0092593);
}
function get41NexPressPricing(quantity, si) {	
	if (si <= 7 && (document.estiForm.productFamily.value == "BusCard")) {
		return (0 + (quantity * .115)); //  Extremely simplified biz card pricing, 082407 BV
	}
	else if (si < 35) {
        if (quantity <= 1000)
            return (8 + (quantity * si * 216/168 * (.655/(12*18)) ));
        else if (quantity > 1000 && quantity <= 3000)
            return (51 + (quantity * si * 216/168 * (.44/(12*18)) ));
        else
            return (116 + (quantity * si * 216/168 * (.284/(12*18)) ));
	}
	else if (si >= 35 && si < 40) {
        if ((document.estiForm.productFamily.value == "Card" || document.estiForm.productFamily.value == "w2pCard") && quantity <= 250) {
            return (55 + (quantity * si * 216/140 * (.57/(12*18)) ));
         }
        else if (quantity <= 1000)
            return (46 + (quantity * si * 216/140 * (.57/(12*18)) ));
        else if (quantity > 1000 && quantity <= 3000)
            return (155 + (quantity * si * 216/140 * (.195/(12*18)) ));
        else
            return (171 + (quantity * si * 216/140 * (.174/(12*18)) ));
	}
	else if (si >= 40 && si < 54) {
        if (quantity <= 1000)
            return (46 + (quantity * si * 216/160 * (.67/(12*18)) ));
        else if (quantity > 1000 && quantity <= 3000)
            return (79 + (quantity * si * 216/160 * (.39/(12*18)) ));
        else
            return (47 + (quantity * si * 216/160 * (.426/(12*18)) ));
	}
	else if (si >= 54 && si < 66) {
        if (quantity <= 1000)
            return (32 + (quantity * si * 216/108 * (.43/(12*18)) ));
        else if (quantity > 1000 && quantity <= 3000)
            return (183 + (quantity * si * 216/108 * (.185/(12*18)) ));
        else
            return (202 + (quantity * si * 216/108 * (.173/(12*18)) ));
	}
	else if (si >= 66 && si < 75) {
        if (quantity <= 1000)
            return (13 + (quantity * si * 216/132 * (.69/(12*18)) ));
        else if (quantity > 1000 && quantity <= 3000)
            return (250 + (quantity * si * 216/132 * (.245/(12*18)) ));
        else
            return (100 + (quantity * si * 216/132 * (.2285/(12*18)) ));
	}
	else if (si < 93.5)
		return (quantity * si * 1.5  * .0083333); 
	else 
		return (quantity * si * 1.25  * .0083333);
}
function get40NexPressPricing(quantity, si) {	
	if (si <= 7 && (document.estiForm.productFamily.value == "BusCard")) {
		return (0 + (quantity * .115)); //  Extremely simplified biz card pricing, 082407 BV
	}
	else if (si < 35) {
        if (quantity <= 1000)
            return (4 + (quantity * si * 216/168 * (.655/(12*18)) ));
        else if (quantity > 1000 && quantity <= 3000)
            return (45 + (quantity * si * 216/168 * (.44/(12*18)) ));
        else
            return (100 + (quantity * si * 216/168 * (.284/(12*18)) ));
	}
	else if (si >= 35 && si < 40) {
        if ((document.estiForm.productFamily.value == "Card" || document.estiForm.productFamily.value == "w2pCard") && quantity <= 250) {
            return (50 + (quantity * si * 216/140 * (.57/(12*18)) ));
         }
        else if (quantity <= 1000)
            return (40 + (quantity * si * 216/140 * (.57/(12*18)) ));
        else if (quantity > 1000 && quantity <= 3000)
            return (135 + (quantity * si * 216/140 * (.195/(12*18)) ));
        else
            return (150 + (quantity * si * 216/140 * (.174/(12*18)) ));
	}
	else if (si >= 40 && si < 54) {
        if (quantity <= 1000)
            return (40 + (quantity * si * 216/160 * (.67/(12*18)) ));
        else if (quantity > 1000 && quantity <= 3000)
            return (69 + (quantity * si * 216/160 * (.39/(12*18)) ));
        else
            return (27 + (quantity * si * 216/160 * (.426/(12*18)) ));
	}
	else if (si >= 54 && si < 66) {
        if (quantity <= 1000)
            return (26 + (quantity * si * 216/108 * (.43/(12*18)) ));
        else if (quantity > 1000 && quantity <= 3000)
            return (163 + (quantity * si * 216/108 * (.185/(12*18)) ));
        else
            return (182 + (quantity * si * 216/108 * (.173/(12*18)) ));
	}
	else if (si >= 66 && si < 75) {
        if (quantity <= 1000)
            return (6 + (quantity * si * 216/132 * (.69/(12*18)) ));
        else if (quantity > 1000 && quantity <= 3000)
            return (230 + (quantity * si * 216/132 * (.245/(12*18)) ));
        else
            return (50 + (quantity * si * 216/132 * (.2285/(12*18)) ));
	}
	else if (si < 93.5)
		return (quantity * si * 1.35  * .0083333); 
	else 
		return (quantity * si * 1.15  * .0083333);
}
function get11NexPressPricing(quantity, si) {	
		if (si < 93.5)
			return (quantity * si * 1.5  * .0046296);
		else
			return (quantity * si * 1.25  * .0046296);
}

function get11Pricing(quantity, si) {
	
	my11setup=266;
	
	if (si > 432 && si <= 616 && document.estiForm.multi && document.estiForm.coverColors.value!="NoCover") {	 // bigger than 18 x 24 up to 22 x 28	
		if (quantity <= 1499) {
			return ((.121591592 * quantity + 55) + my11setup); //c458//
		}
		else if (quantity > 1499 && quantity <= 4500) {
			return ((0 * quantity + 237) + my11setup);
		}
		else if (quantity > 4500) {
			return ((.02 * quantity + 227) + my11setup);
		}
	}
	else if (si > 432 && si <= 616 && document.estiForm.multi && document.estiForm.coverColors.value=="NoCover") {	 // bigger than 18 x 24 up to 22 x 28	
		if (quantity <= 1499) {
			return ((.121591592 * quantity + 55) + my11setup); //c458//
		}
		else if (quantity > 1499 && quantity <= 4500) {
			return ((0 * quantity + 237) + my11setup);
		}
		else if (quantity > 4500) {
			return ((.04 * quantity + 117) + my11setup);
		}
	}
	else {
		return (get40Pricing(quantity, si) - 133);
	}
	
}



/*function calcPressIdent(quantity, si, page_type) {
	if (page_type == "black_1pms") {
		press = getPressFactor(quantity, si, page_type);
	}
	return press;
}*/



function calcPress(quantity, si, page_type) {
	if (page_type == "cover") {
       	if (document.estiForm.coverColors.options) {
			if ((document.estiForm.coverColors.options[document.estiForm.coverColors.selectedIndex].value == document.estiForm.colors.options[document.estiForm.colors.selectedIndex].value) || 
				(document.estiForm.coverColors.options[document.estiForm.coverColors.selectedIndex].value != document.estiForm.colors.options[document.estiForm.colors.selectedIndex].value)) {
				this_type = "NoCover"; 
			}
			else { 
				this_type = document.estiForm.coverColors.options[document.estiForm.coverColors.selectedIndex].value;
			}
		}
		else {
			if (document.estiForm.coverColors.value == document.estiForm.colors.value) {
				this_type = "NoCover"; 
			}
			else { 
				this_type = document.estiForm.coverColors.value;
			}
		}
	}

	else {
		if (document.estiForm.colors.options) //select menu value
			this_type = document.estiForm.colors.options[document.estiForm.colors.selectedIndex].value;
		else if (document.estiForm.colors) // hidden value
			this_type = document.estiForm.colors.value;
	}
	
	press = (getPressFactor(quantity, si, this_type));
	
	if (page_type == "cover") {
		document.estiForm.coverPresscharge.value=formatCurrency(press);
	}
	else if (page_type == "pages1") {
		document.estiForm.presscharge1.value=formatCurrency(press);
	}
	else if (page_type == "pages2") {
		document.estiForm.presscharge2.value=formatCurrency(press);
	}
	else if (page_type == "pages3") {
		document.estiForm.presscharge3.value=formatCurrency(press);
	}
	else if (page_type == "pages4") {
		document.estiForm.presscharge4.value=formatCurrency(press);
	}
	else if (page_type == "pages5") {
		document.estiForm.presscharge5.value=formatCurrency(press);
	}
	else if (page_type == "pages6") {
		document.estiForm.presscharge6.value=formatCurrency(press);
	}
	return press;
}


function calcEyelets() {
	var eyelets = 0;
	if (document.estiForm.eyelet && document.estiForm.eyelet.options && document.estiForm.eyelet.selectedIndex > 0) { //if eyelet is chosen
		if (document.estiForm.score && document.estiForm.score.options && document.estiForm.score.selectedIndex > 0) { //if piece is scored
			if (document.estiForm.realquant.value < 200) { //min. charge is $50 for eyelets
				eyelets = 50;
			}	
			else {
				eyelets = (document.estiForm.realquant.value * .25); //or .25 ea (for scored pieces)
			}
		}
		else {
			if (document.estiForm.realquant.value < 250) { //if piece is flat
				eyelets = 50; //min. charge is $50 for eyelets
			}					
			else {
				eyelets = (document.estiForm.realquant.value * .20); //or .20 ea (for flat pieces)
			}
		}
		document.estiForm.drill.selectedIndex = 3;					
		document.estiForm.drill.disabled=true;
	}
	else {
		if (document.estiForm.eyelet && document.estiForm.eyelet.options && document.estiForm.drill && document.estiForm.drill.options) {
			document.estiForm.drill.disabled=false;
		}
	}
	return eyelets;
}


function calcNexPressProof(si) {
	if (document.estiForm.proof.options) {
		if (document.estiForm.proof.selectedIndex == 0) {
			proof = 0;
		}
		else {
			proof = 50;
		}
	}
	else {
		if (document.estiForm.proof.value == 'SoftProof') {
			proof = 0;
		}
		else {
			proof = 50;
		}
	}
	document.estiForm.proofcharge.value=formatCurrency(proof);	
	return proof;
}


function calcRush(total, si) {
	//unit price
	rush_factor = getRushFactor(si);	
	rush = (total * rush_factor);
	//alert(rush);
	document.estiForm.rush.value=formatCurrency(rush);
	return rush;
}




function getUnitWeightOnces(tsi, quantity) {
	if (document.estiForm.pages) { //this is a multipage document 
		//alert( ((getJobWeight(tsi) / quantity) * 16) + ((coverWeight(tsi_cover) / quantity) * 16));
		return ( ((getJobWeight(tsi) / quantity) * 16) + ((coverWeight(tsi_cover) / quantity) * 16));
	}	
	else {
		return ((getJobWeight(tsi) / quantity) * 16) ;
	}
}

function getBlankEnvelopesWeight() {
	if (document.estiForm.blankEnvelopes && document.estiForm.blankEnvelopes.value != "no" && 
	  document.estiForm.blankEnvelopesSize && document.estiForm.blankEnvelopesSize.value != "") {
		var env = document.estiForm.blankEnvelopes.options[document.estiForm.blankEnvelopes.selectedIndex].value;
		var envWeight = ( (env/250) * 5);
	}
	if (document.estiForm.konlyEnvelopes && document.estiForm.konlyEnvelopes.value != "no" && 
	  document.estiForm.blankEnvelopesSize && document.estiForm.blankEnvelopesSize.value != "") {
		var env = document.estiForm.konlyEnvelopes.options[document.estiForm.konlyEnvelopes.selectedIndex].value;
		var envWeight = ( (env/250) * 5);
	}

	if (envWeight && envWeight > 0) {
		return envWeight;
	}
	else {
		return 0;
	}
}


function switchDiv(div_id) {
  if (document.getElementById(div_id)) {
	  var style_sheet = getStyleObject(div_id);
	  
	  if (style_sheet) {
	    hideAll();
	    changeObjectVisibility(div_id, "visible");
	  }
	  
	  else {
	    alert("Sorry, this only works in browsers that support Dynamic HTML (sd)");
	  }
  }
}


function switchDivBetter(div_id) {
  if (document.getElementById(div_id)) {
	  var style_sheet = getStyleObject(div_id);
	  
	  if (style_sheet) {
	    hideAllBetter();
	    changeObjectVisibilityBetter(div_id, "block");
	  }
	  
	  else {
	    alert("Sorry, this only works in browsers that support Dynamic HTML (sdb)");
	  }
  }
}

function changeObjectVisibility(objectId, newVisibility) {
    
    // first get the object's stylesheet
    var styleObject = getStyleObject(objectId);

    
    /* then if we find a stylesheet, set its visibility
       as requested */

    if (styleObject) {
		styleObject.visibility = newVisibility;
		return true;
    } 
    
    else {
		return false;
    }
}

function stationerySmartQuantitySum() {
	document.estiForm.stationeryBizCardQuantity.value = 0;
	if (document.getElementById('bc_name_one') && document.getElementById('bc_name_one').style.display == 'block') {
		document.estiForm.stationeryBizCardQuantity.value = parseInt(document.estiForm.stationeryBizCardQuantity.value) + parseInt(document.estiForm.cardQuant1.value);
	}

	if (document.getElementById('bc_name_two') && document.getElementById('bc_name_two').style.display == 'block') {
		document.estiForm.stationeryBizCardQuantity.value = parseInt(document.estiForm.stationeryBizCardQuantity.value) + parseInt(document.estiForm.cardQuant2.value);
	}

	if (document.getElementById('bc_name_three') && document.getElementById('bc_name_three').style.display == 'block') {
		document.estiForm.stationeryBizCardQuantity.value = parseInt(document.estiForm.stationeryBizCardQuantity.value) + parseInt(document.estiForm.cardQuant3.value);
	}

	if (document.getElementById('bc_name_four') && document.getElementById('bc_name_four').style.display == 'block') {
		document.estiForm.stationeryBizCardQuantity.value = parseInt(document.estiForm.stationeryBizCardQuantity.value) + parseInt(document.estiForm.cardQuant4.value);
	}

	if (document.getElementById('bc_name_five') && document.getElementById('bc_name_five').style.display == 'block') {
		document.estiForm.stationeryBizCardQuantity.value = parseInt(document.estiForm.stationeryBizCardQuantity.value) + parseInt(document.estiForm.cardQuant5.value);
	}

	if (document.getElementById('bc_name_six') && document.getElementById('bc_name_six').style.display == 'block') {
		document.estiForm.stationeryBizCardQuantity.value = parseInt(document.estiForm.stationeryBizCardQuantity.value) + parseInt(document.estiForm.cardQuant6.value);
	}

	if (document.getElementById('bc_name_seven') && document.getElementById('bc_name_seven').style.display == 'block') {
		document.estiForm.stationeryBizCardQuantity.value = parseInt(document.estiForm.stationeryBizCardQuantity.value) + parseInt(document.estiForm.cardQuant7.value);
	}

	if (document.getElementById('bc_name_eight') && document.getElementById('bc_name_eight').style.display == 'block') {
		document.estiForm.stationeryBizCardQuantity.value = parseInt(document.estiForm.stationeryBizCardQuantity.value) + parseInt(document.estiForm.cardQuant8.value);
	}

}



function smartQuantitySum() {
	document.estiForm.quantity.value = 0;
	if (document.getElementById('bc_name_one') && document.getElementById('bc_name_one').style.display == 'block') {
		document.estiForm.quantity.value = parseInt(document.estiForm.quantity.value) + parseInt(document.estiForm.cardQuant1.value);
	}

	if (document.getElementById('bc_name_two') && document.getElementById('bc_name_two').style.display == 'block') {
		document.estiForm.quantity.value = parseInt(document.estiForm.quantity.value) + parseInt(document.estiForm.cardQuant2.value);
	}
	if (document.getElementById('bc_name_three') && document.getElementById('bc_name_three').style.display == 'block') {
		document.estiForm.quantity.value = parseInt(document.estiForm.quantity.value) + parseInt(document.estiForm.cardQuant3.value);
	}

	if (document.getElementById('bc_name_four') && document.getElementById('bc_name_four').style.display == 'block') {
		document.estiForm.quantity.value = parseInt(document.estiForm.quantity.value) + parseInt(document.estiForm.cardQuant4.value);
	}

	if (document.getElementById('bc_name_five') && document.getElementById('bc_name_five').style.display == 'block') {
		document.estiForm.quantity.value = parseInt(document.estiForm.quantity.value) + parseInt(document.estiForm.cardQuant5.value);
	}

	if (document.getElementById('bc_name_six') && document.getElementById('bc_name_six').style.display == 'block') {
		document.estiForm.quantity.value = parseInt(document.estiForm.quantity.value) + parseInt(document.estiForm.cardQuant6.value);
	}

	if (document.getElementById('bc_name_seven') && document.getElementById('bc_name_seven').style.display == 'block') {
		document.estiForm.quantity.value = parseInt(document.estiForm.quantity.value) + parseInt(document.estiForm.cardQuant7.value);
	}

	if (document.getElementById('bc_name_eight') && document.getElementById('bc_name_eight').style.display == 'block') {
		document.estiForm.quantity.value = parseInt(document.estiForm.quantity.value) + parseInt(document.estiForm.cardQuant8.value);
	}
}

function w2pBizCardSum() {
	document.estiForm.quantity.value = 0;
	productFamily = document.estiForm.productFamily.value;
	cardQuant1 = document.estiForm.cardQuant1.value;
	if (productFamily == "w2pBusCard-1person" || productFamily == "w2pBusCardSS-1person") {
		document.estiForm.quantity.value = cardQuant1;
		}
	
	else if (productFamily == "w2pBusCard-2person" || productFamily == "w2pBusCardSS-2person") {
		if (cardQuant1 == "250") {
			document.estiForm.quantity.value = 500;
		}
		if (cardQuant1 == "500") {
			document.estiForm.quantity.value = 1000;
		}
		if (cardQuant1 == "1000") {
			document.estiForm.quantity.value = 2000;
		}
		if (cardQuant1 == "1500") {
			document.estiForm.quantity.value = 3000;
		}
		if (cardQuant1 == "2000") {
			document.estiForm.quantity.value = 4000;
		}
	}

	else if (productFamily == "w2pBusCard-3person" || productFamily == "w2pBusCardSS-3person") {
		if (cardQuant1 == "250") {
			document.estiForm.quantity.value = 750;
		}
		if (cardQuant1 == "500") {
			document.estiForm.quantity.value = 1500;
		}
		if (cardQuant1 == "1000") {
			document.estiForm.quantity.value = 3000;
		}
		if (cardQuant1 == "1500") {
			document.estiForm.quantity.value = 4500;
		}
		if (cardQuant1 == "2000") {
			document.estiForm.quantity.value = 6000;
		}
	}

	else if (productFamily == "w2pBusCard-4person" || productFamily == "w2pBusCardSS-4person") {
		if (cardQuant1 == "250") {
			document.estiForm.quantity.value = 1000;
		}
		if (cardQuant1 == "500") {
			document.estiForm.quantity.value = 2000;
		}
		if (cardQuant1 == "1000") {
			document.estiForm.quantity.value = 4000;
		}
		if (cardQuant1 == "1500") {
			document.estiForm.quantity.value = 6000;
		}
		if (cardQuant1 == "2000") {
			document.estiForm.quantity.value = 8000;
		}
	}
}


function formatCurrency2(num) {
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
		num = "0";
		sign = (num == (num = Math.abs(num)));
		num = Math.floor(num*100+0.50000000001);
		num = Math.round(num/100).toString();
		for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
			num = num.substring(0,num.length-(4*i+3))+','+
			num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') + '$' + num + ".00");

}

function formatCurrency(num) {
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
		num = "0";
		sign = (num == (num = Math.abs(num)));
		num = Math.floor(num*100+0.50000000001);
		cents = num%100;
		num = Math.floor(num/100).toString();
	if(cents<10)
		cents = "0" + cents;
		for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
			num = num.substring(0,num.length-(4*i+3))+','+
			num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') + '$' + num + '.' + cents);

}

function roundAmount(n) { 
	var s = "" + Math.round(n * 100) / 100 
	var i = s.indexOf('.') 
	if (i < 0) return s + ".00" 
		var t = s.substring(0, i + 1) + s.substring(i + 1, i + 3) 
	if (i + 2 == s.length) t += "0" 
		return t 
}


function roundToInteger(n) { 
	var s = "" + Math.round(n * 100) / 100 
	var i = s.indexOf('.') 
	var t = s.substring(0, s.indexOf('.'));
	return t;
	
	/*if (i < 0) return s + ".00" 
		var t = s.substring(0, i + 1) + s.substring(i + 1, i + 3) 
	if (i + 2 == s.length) t += "0" 
		return t */
}



function showDiv(div_id) {
  
  var style_sheet = getStyleObject(div_id);
  
  if (style_sheet) {
    //set
    changeObjectVisibility(div_id, "visible");
  }
  
  else {
    alert("sorry, this only works in browsers that support Dynamic HTML");
  }
}

function hideDiv(div_id) {
  
  var style_sheet = getStyleObject(div_id);
  
  if (style_sheet) {
    changeObjectVisibility(div_id, "hidden");
  }
  
  else {
    alert("sorry, this only works in browsers that support Dynamic HTML");
  }
}

function popUp(url) {
	
	sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=500,height=450');
	
	self.name = "mainWin";

}

function popUp(url,height,width) {
	
	sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=' + width + ',height=' + height);
	
	self.name = "mainWin";

}

function infoBanner() {
	if (document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value.indexOf("_nl_") > -1) {
		pull();
	}
	else if (document.estiForm.coverPaper)
		if (document.estiForm.coverPaper.options[document.estiForm.coverPaper.selectedIndex].value.indexOf("_nl_") > -1) {
		pull();
	}
	else {
		draw();
	}
}

function paperMarketAdjustment(my_total, type, quantity) {
	
	paperMarketFactor = getPaperMarketFactor(type, quantity);	
	paperMarketAdj = (my_total * paperMarketFactor);
	//alert(paperMarketAdj);
	document.estiForm.paperMarketAdj.value=formatCurrency(paperMarketAdj);
	return paperMarketAdj;

}

function getPaperMarketFactor(type, quantity) {
	
	if (type == "multi") {		
		if (document.estiForm.coverPaper.disabled == false  && 
			((document.estiForm.coverPaper.options && document.estiForm.coverPaper.options[document.estiForm.coverPaper.selectedIndex].value.indexOf("_nl_") > -1) 
			|| document.estiForm.coverPaper.value.indexOf("_nl_") > -1 )) {
			return ".05";
		}
		else if ( (document.estiForm.paper.options && document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value.indexOf("_nl_") > -1) 
			|| document.estiForm.paper.value.indexOf("_nl_") > -1 ) {
			return ".05";
		}
		else {
			return "0";
		}	
	}
	else if (type == "single") {
		if ( (document.estiForm.paper.options && document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value.indexOf("_nl_") > -1) 
			|| document.estiForm.paper.value.indexOf("_nl_") > -1 || document.estiForm.paper.value == "20pt_kraftboard") {
			if (quantity > 7499 && quantity < 15000) {
				//alert ( (((quantity * .00001333) - .1) * (-1)) + .05);
				return ( (((quantity * .00001333) - .1) * (-1)) + .05);
			}
			else if (quantity > 14999) {
				return "-.05";
			}			
			else {
				return ".05";
			}
		}
		else if (quantity > 7499 && quantity < 15000) {
			//alert((quantity * .00001333) - .1) * (-1);
			return ((quantity * .00001333) - .1) * (-1);
		}
		else if (quantity >= 15000) {
			return "-.1";
		}	
		else {
			return "0";
		}
	}
}



function marketAdjustment(my_total, type, quantity) {
	
	marketFactor = getMarketFactor(type, quantity);	
	marketAdj = (my_total * marketFactor);
	
	document.estiForm.marketAdj.value=formatCurrency(marketAdj);
	return marketAdj;

}




function marketAdjustmentByQuantity(my_total, si, colors, type, quantity) {
	if (si <= 7)
		marketFactorByQuantity = getMarketFactorByQuantity("buscard", colors, quantity);	
	else
		marketFactorByQuantity = getMarketFactorByQuantity(type, colors, quantity);	
	
	marketAdjByQuantity = (my_total * marketFactorByQuantity);
	//alert(marketAdjByQuantity);
	document.estiForm.marketAdjByQuantity.value=formatCurrency(marketAdjByQuantity);
	return marketAdjByQuantity;

}

function getEcoAudit() {
	//alert ("Job Weight: " + getJobWeight(tsi));
	var env_trees = 0;
	var env_water = 0;
	var env_solidwaste = 0;
	var env_ghgasses = 0;
	var env2_trees = 0;
	var env2_water = 0;
	var env2_solidwaste = 0;
	var env2_ghgasses = 0;
	var env_carmiles = 0;
	var env2_lbswood = 0;
	var env_lbswood = 0;
	var coverTrees = 0;
	var coverWater = 0;
	var coverSolidwaste = 0;
	var coverGhgasses = 0;
	var coverCarmiles = 0;
	var coverLbswood = 0;
	var A6_weight = 0;
	var A7_weight = 0;
	var ltrhd_weight = 0;
	var ltrhd_trees = 0;
	var ltrhd_water = 0;
	var ltrhd_solidwaste = 0;
	var ltrhd_ghgasses = 0;
	var ltrhd_carmiles = 0;
	var ltrhd_lbswood = 0;
	var blnkltrhd_weight = 0;
	var blnkltrhd_trees = 0;
	var blnkltrhd_water = 0;
	var blnkltrhd_solidwaste = 0;
	var blnkltrhd_ghgasses = 0;
	var blnkltrhd_carmiles = 0;
	var blnkltrhd_lbswood = 0;
	// do blank envelopes first	
	if (document.estiForm.blankEnvelopes && document.estiForm.blankEnvelopes.value != "no" && 
	  document.estiForm.blankEnvelopesSize && document.estiForm.blankEnvelopesSize.value != "") {

		 if (document.estiForm.blankEnvelopesSize.value == "A-6") {
			var A6_weight = ( (parseInt(document.estiForm.blankEnvelopes.value)/250) * 3.3125)  
			var env_trees = ( .96 * (A6_weight/2000) * 24 + .04 * (A6_weight/2000) * 12);
			var env_water = ( (20519.6 * (A6_weight/2000)) - (10484 * (A6_weight/2000)) )
			var env_solidwaste = ( (2278.349 * (A6_weight/2000)) - (1168.1357 * (A6_weight/2000)) )
			var env_ghgasses = ( (5789.724 * (A6_weight/2000)) - (3597.112 * (A6_weight/2000)) )
			var env_carmiles = ( (env_ghgasses/11440) * 10000 )
			var env_lbswood = ( 3.46666666666667 * (A6_weight) )
			updateText("A6_weight" , (A6_weight.toFixed(1)));
		}	

		 else if (document.estiForm.blankEnvelopesSize.value == "A-7") {
			var A7_weight = ( (parseInt(document.estiForm.blankEnvelopes.value)/250) * 3.569)  
			var env_trees = ( .96 * (A7_weight/2000) * 24 + .04 * (A7_weight/2000) * 12);
			var env_water = ( (20519.6 * (A7_weight/2000)) - (10484 * (A7_weight/2000)) )
			var env_solidwaste = ( (2278.349 * (A7_weight/2000)) - (1168.1357 * (A7_weight/2000)) )
			var env_ghgasses = ( (5789.724 * (A7_weight/2000)) - (3597.112 * (A7_weight/2000)) )
			var env_carmiles = ( (env_ghgasses/11440) * 10000 )
			var env_lbswood = ( 3.46666666666667 * (A7_weight) )
			updateText("A7_weight" , (A7_weight.toFixed(1)));
		}
		
		updateText("env_trees", (env_trees.toFixed(2)));
		updateText("env_water", (env_water.toFixed(1)));
		updateText("env_solidwaste", (env_solidwaste.toFixed(1)));
		updateText("env_ghgasses", (env_ghgasses.toFixed(1)));
		updateText("env_carmiles", (env_carmiles.toFixed(1)));
		updateText("env_lbswood", (env_lbswood.toFixed(1)));

	}

	// printed black envelopes	
	if (document.estiForm.konlyEnvelopes && document.estiForm.konlyEnvelopes.value != "no" && 
	  document.estiForm.blankEnvelopesSize && document.estiForm.blankEnvelopesSize.value != "") {

		 if (document.estiForm.blankEnvelopesSize.value == "A-6") {
			var A6_weight2 = ( (parseInt(document.estiForm.konlyEnvelopes.value)/250) * 3.3125)  
			var env2_trees = ( .96 * (A6_weight2/2000) * 24 + .04 * (A6_weight2/2000) * 12);
			var env2_water = ( (20519.6 * (A6_weight2/2000)) - (10484 * (A6_weight2/2000)) )
			var env2_solidwaste = ( (2278.349 * (A6_weight2/2000)) - (1168.1357 * (A6_weight2/2000)) )
			var env2_ghgasses = ( (5789.724 * (A6_weight2/2000)) - (3597.112 * (A6_weight2/2000)) )
			var env2_carmiles = ( (env2_ghgasses/11440) * 10000 )
			var env2_lbswood = ( 3.46666666666667 * (A6_weight) )
			updateText("A6_weight2" , (A6_weight2.toFixed(1)));
		}	

		 else if (document.estiForm.blankEnvelopesSize.value == "A-7") {
			var A7_weight2 = ( (parseInt(document.estiForm.konlyEnvelopes.value)/250) * 3.569)  
			var env2_trees = ( .96 * (A7_weight/2000) * 24 + .04 * (A7_weight2/2000) * 12);
			var env2_water = ( (20519.6 * (A7_weight2/2000)) - (10484 * (A7_weight2/2000)) )
			var env2_solidwaste = ( (2278.349 * (A7_weight2/2000)) - (1168.1357 * (A7_weight2/2000)) )
			var env2_ghgasses = ( (5789.724 * (A7_weight2/2000)) - (3597.112 * (A7_weight2/2000)) )
			var env2_carmiles = ( (env2_ghgasses/11440) * 10000 )
			var env2_lbswood = ( 3.46666666666667 * (A7_weight) )
			updateText("A7_weight2" , (A7_weight2.toFixed(1)));
		}
		
		updateText("env2_trees", (env_trees.toFixed(2)));
		updateText("env2_water", (env_water.toFixed(1)));
		updateText("env2_solidwaste", (env_solidwaste.toFixed(1)));
		updateText("env2_ghgasses", (env_ghgasses.toFixed(1)));
		updateText("env2_carmiles", (env_carmiles.toFixed(1)));
		updateText("env2_lbswood", (env2_lbswood.toFixed(1)));
	}

	// w2p product blank envelopes	
	if (document.estiForm.w2pEnvelopesBlank && document.estiForm.w2pEnvelopesBlank.value != "0") {
		 if (document.estiForm.finalWidth.value == "6") {
			var A6_weight = ( (parseInt(document.estiForm.w2pEnvelopesBlank.value)/250) * 3.3125)  
			var env_trees = ( .96 * (A6_weight/2000) * 24 + .04 * (A6_weight/2000) * 12);
			var env_water = ( (20519.6 * (A6_weight/2000)) - (10484 * (A6_weight/2000)) )
			var env_solidwaste = ( (2278.349 * (A6_weight/2000)) - (1168.1357 * (A6_weight/2000)) )
			var env_ghgasses = ( (5789.724 * (A6_weight/2000)) - (3597.112 * (A6_weight/2000)) )
			var env_carmiles = ( (env_ghgasses/11440) * 10000 )
			var env_lbswood = ( 3.46666666666667 * (A6_weight) )
			updateText("A6_weight" , (A6_weight.toFixed(1)));
		}	

		 else if (document.estiForm.finalWidth.value == "7") {
			var A7_weight = ( (parseInt(document.estiForm.w2pEnvelopesBlank.value)/250) * 3.569)  
			var env_trees = ( .96 * (A7_weight/2000) * 24 + .04 * (A7_weight/2000) * 12);
			var env_water = ( (20519.6 * (A7_weight/2000)) - (10484 * (A7_weight/2000)) )
			var env_solidwaste = ( (2278.349 * (A7_weight/2000)) - (1168.1357 * (A7_weight/2000)) )
			var env_ghgasses = ( (5789.724 * (A7_weight/2000)) - (3597.112 * (A7_weight/2000)) )
			var env_carmiles = ( (env_ghgasses/11440) * 10000 )
			var env_lbswood = ( 3.46666666666667 * (A7_weight) )
			updateText("A7_weight" , (A7_weight.toFixed(1)));
		}
		
		updateText("env_trees", (env_trees.toFixed(2)));
		updateText("env_water", (env_water.toFixed(1)));
		updateText("env_solidwaste", (env_solidwaste.toFixed(1)));
		updateText("env_ghgasses", (env_ghgasses.toFixed(1)));
		updateText("env_carmiles", (env_carmiles.toFixed(1)));
		updateText("env_lbswood", (env_lbswood.toFixed(1)));

	}

	// w2p product printed envelopes	
	if (document.estiForm.w2pEnvelopesPrint && document.estiForm.w2pEnvelopesPrint.value != "0") {

		 if (document.estiForm.finalWidth.value == "6") {
			var A6_weight2 = ( (parseInt(document.estiForm.w2pEnvelopesPrint.value)/250) * 3.3125)  
			var env2_trees = ( .96 * (A6_weight2/2000) * 24 + .04 * (A6_weight2/2000) * 12);
			var env2_water = ( (20519.6 * (A6_weight2/2000)) - (10484 * (A6_weight2/2000)) )
			var env2_solidwaste = ( (2278.349 * (A6_weight2/2000)) - (1168.1357 * (A6_weight2/2000)) )
			var env2_ghgasses = ( (5789.724 * (A6_weight2/2000)) - (3597.112 * (A6_weight2/2000)) )
			var env2_carmiles = ( (env2_ghgasses/11440) * 10000 )
			var env2_lbswood = ( 3.46666666666667 * (A6_weight) )
			updateText("A6_weight2" , (A6_weight2.toFixed(1)));
		}	

		 else if (document.estiForm.finalWidth.value == "7") {
			var A7_weight2 = ( (parseInt(document.estiForm.w2pEnvelopesPrint.value)/250) * 3.569)  
			var env2_trees = ( .96 * (A7_weight2/2000) * 24 + .04 * (A7_weight2/2000) * 12);
			var env2_water = ( (20519.6 * (A7_weight2/2000)) - (10484 * (A7_weight2/2000)) )
			var env2_solidwaste = ( (2278.349 * (A7_weight2/2000)) - (1168.1357 * (A7_weight2/2000)) )
			var env2_ghgasses = ( (5789.724 * (A7_weight2/2000)) - (3597.112 * (A7_weight2/2000)) )
			var env2_carmiles = ( (env2_ghgasses/11440) * 10000 )
			var env2_lbswood = ( 3.46666666666667 * (A7_weight) )
			updateText("A7_weight2" , (A7_weight2.toFixed(1)));
		}
		
		updateText("env2_trees", (env_trees.toFixed(2)));
		updateText("env2_water", (env_water.toFixed(1)));
		updateText("env2_solidwaste", (env_solidwaste.toFixed(1)));
		updateText("env2_ghgasses", (env_ghgasses.toFixed(1)));
		updateText("env2_carmiles", (env_carmiles.toFixed(1)));
		updateText("env2_lbswood", (env2_lbswood.toFixed(1)));
	}
	
	// next, if stationery...
	if (document.estiForm.productFamily && document.estiForm.productFamily.value.indexOf("Stationery") != -1) {
		tsi = (7 * (parseInt(document.estiForm.stationeryBizCardQuantity.value)));
		if (document.estiForm.stationeryEnvelopes && document.estiForm.stationeryEnvelopes.value != "none") { 
			if (document.estiForm.stationeryEnvelopesSize.value == "#10 (9.5 x 4.125)") {
				var no10_weight = ( (parseInt(document.estiForm.stationeryEnvelopes.value)/500) * 5.7375)  
				var env_trees = ( .96 * (no10_weight/2000) * 24 + .04 * (no10_weight/2000) * 12);
				var env_water = ( (20519.6 * (no10_weight/2000)) - (10484 * (no10_weight/2000)) )
				var env_solidwaste = ( (2278.349 * (no10_weight/2000)) - (1168.1357 * (no10_weight/2000)) )
				var env_ghgasses = ( (5789.724 * (no10_weight/2000)) - (3597.112 * (no10_weight/2000)) )
				var env_carmiles = ( (env_ghgasses/11440) * 10000 )
				var env_lbswood = ( 3.46666666666667 * (no10_weight) )
				updateText("no10_weight" , (no10_weight.toFixed(1)));
				}
				
			else if (document.estiForm.stationeryEnvelopesSize.value == "#9 (8.875 x 3.875)") {
				var no9_weight = ( (parseInt(document.estiForm.stationeryEnvelopes.value)/500) * 5.0438)  
				var env_trees = ( .96 * (no9_weight/2000) * 24 + .04 * (no9_weight/2000) * 12);
				var env_water = ( (20519.6 * (no9_weight/2000)) - (10484 * (no9_weight/2000)) )
				var env_solidwaste = ( (2278.349 * (no9_weight/2000)) - (1168.1357 * (no9_weight/2000)) )
				var env_ghgasses = ( (5789.724 * (no9_weight/2000)) - (3597.112 * (no9_weight/2000)) )
				var env_carmiles = ( (env_ghgasses/11440) * 10000 )
				var env_lbswood = ( 3.46666666666667 * (no9_weight) )
				updateText("no9_weight" , (no9_weight.toFixed(1)));
				}
			
			 else if (document.estiForm.stationeryEnvelopesSize.value == "A6 (6.5 x 4.75)") {
				var A6_weight = ( (parseInt(document.estiForm.stationeryEnvelopes.value)/250) * 3.3125)  
				var env_trees = ( .96 * (A6_weight/2000) * 24 + .04 * (A6_weight/2000) * 12);
				var env_water = ( (20519.6 * (A6_weight/2000)) - (10484 * (A6_weight/2000)) )
				var env_solidwaste = ( (2278.349 * (A6_weight/2000)) - (1168.1357 * (A6_weight/2000)) )
				var env_ghgasses = ( (5789.724 * (A6_weight/2000)) - (3597.112 * (A6_weight/2000)) )
				var env_carmiles = ( (env_ghgasses/11440) * 10000 )
				var env_lbswood = ( 3.46666666666667 * (A6_weight) )
				updateText("A6_weight" , (A6_weight.toFixed(1)));
			}	
	
			 else if (document.estiForm.stationeryEnvelopesSize.value == "A7 (7.25 x 5.25)") {
				var A7_weight = ( (parseInt(document.estiForm.stationeryEnvelopes.value)/250) * 3.569)  
				var env_trees = ( .96 * (A7_weight/2000) * 24 + .04 * (A7_weight/2000) * 12);
				var env_water = ( (20519.6 * (A7_weight/2000)) - (10484 * (A7_weight/2000)) )
				var env_solidwaste = ( (2278.349 * (A7_weight/2000)) - (1168.1357 * (A7_weight/2000)) )
				var env_ghgasses = ( (5789.724 * (A7_weight/2000)) - (3597.112 * (A7_weight/2000)) )
				var env_carmiles = ( (env_ghgasses/11440) * 10000 )
				var env_lbswood = ( 3.46666666666667 * (A7_weight) )
				updateText("A7_weight" , (A7_weight.toFixed(1)));
			}
				
		}
		
		updateText("env_trees", (env_trees.toFixed(2)));
		updateText("env_water", (env_water.toFixed(1)));
		updateText("env_solidwaste", (env_solidwaste.toFixed(1)));
		updateText("env_ghgasses", (env_ghgasses.toFixed(1)));
		updateText("env_carmiles", (env_carmiles.toFixed(1)));
		updateText("env_lbswood", (env_lbswood.toFixed(1)));
		if (document.estiForm.stationeryLetterhead && document.estiForm.stationeryLetterhead.value != "none") { 
			var ltrhd_weight = ( (parseInt(document.estiForm.stationeryLetterhead.value)/500) * 6.35)  
			var ltrhd_trees = ( .96 * (ltrhd_weight/2000) * 24 + .04 * (ltrhd_weight/2000) * 12);
			var ltrhd_water = ( (20519.6 * (ltrhd_weight/2000)) - (10484 * (ltrhd_weight/2000)) )
			var ltrhd_solidwaste = ( (2278.349 * (ltrhd_weight/2000)) - (1168.1357 * (ltrhd_weight/2000)) )
			var ltrhd_ghgasses = ( (5789.724 * (ltrhd_weight/2000)) - (3597.112 * (ltrhd_weight/2000)) )
			var ltrhd_carmiles = ( (ltrhd_weight/11440) * 10000 )
			var ltrhd_lbswood = ( 3.46666666666667 * (ltrhd_weight) )
			
			updateText("ltrhd_weight" , (ltrhd_weight.toFixed(1)));
			updateText("ltrhd_trees", (ltrhd_trees.toFixed(2)));
			updateText("ltrhd_water", (ltrhd_water.toFixed(1)));
			updateText("ltrhd_solidwaste", (ltrhd_solidwaste.toFixed(1)));
			updateText("ltrhd_ghgasses", (ltrhd_ghgasses.toFixed(1)));
			updateText("ltrhd_carmiles", (ltrhd_carmiles.toFixed(1)));			
			updateText("ltrhd_lbswood", (ltrhd_lbswood.toFixed(1)));			
			}
			
		if (document.estiForm.stationeryLetterheadBlank && document.estiForm.stationeryLetterheadBlank.value != "none") { 
			var blnkltrhd_weight = ( (parseInt(document.estiForm.stationeryLetterheadBlank.value)/500) * 6.35)  
			var blnkltrhd_trees = ( .96 * (blnkltrhd_weight/2000) * 24 + .04 * (blnkltrhd_weight/2000) * 12);
			var blnkltrhd_water = ( (20519.6 * (blnkltrhd_weight/2000)) - (10484 * (blnkltrhd_weight/2000)) )
			var blnkltrhd_solidwaste = ( (2278.349 * (blnkltrhd_weight/2000)) - (1168.1357 * (blnkltrhd_weight/2000)) )
			var blnkltrhd_ghgasses = ( (5789.724 * (blnkltrhd_weight/2000)) - (3597.112 * (blnkltrhd_weight/2000)) )
			var blnkltrhd_carmiles = ( (blnkltrhd_weight/11440) * 10000 )
			var blnkltrhd_lbswood = ( 3.46666666666667 * (blnkltrhd_weight) )
			
			updateText("blnkltrhd_weight" , (blnkltrhd_weight.toFixed(1)));
			updateText("blnkltrhd_trees", (blnkltrhd_trees.toFixed(2)));
			updateText("blnkltrhd_water", (blnkltrhd_water.toFixed(1)));
			updateText("blnkltrhd_solidwaste", (blnkltrhd_solidwaste.toFixed(1)));
			updateText("blnkltrhd_ghgasses", (blnkltrhd_ghgasses.toFixed(1)));
			updateText("blnkltrhd_carmiles", (blnkltrhd_carmiles.toFixed(1)));			
			updateText("blnkltrhd_lbswood", (blnkltrhd_lbswood.toFixed(1)));			
			}
		
		}
			
	// next, if multi
	//alert(document.estiForm.productFamily.value);
	if ((document.estiForm.pages && document.estiForm.productFamily.value != "DLCalendar" && document.estiForm.productFamily.value != "HouseCalendar" && document.estiForm.productFamily != "DLPhotobook") || document.estiForm.productFamily == "Pad")  { //this is a multipage document

		if (document.estiForm.finalHeight.options) {
			height = document.estiForm.finalHeight.options[document.estiForm.finalHeight.selectedIndex].value;
			width = document.estiForm.finalWidth.options[document.estiForm.finalWidth.selectedIndex].value;
		}
		else {
			height = document.estiForm.finalHeight.value;
			width = document.estiForm.finalWidth.value
		}		
		quantity = document.estiForm.realquant.value;
		
		//square inches for unfolded sheets
		si = (height * width * 2);
		//total square inches for cover
		tsi_cover = (si * quantity);
		if (document.estiForm.coverPaper.options && // cover is Everest
			(document.estiForm.coverPaper.options[document.estiForm.coverPaper.selectedIndex].value == "24_nl_ew" || document.estiForm.coverPaper.value == "24_nl_ew"
			|| document.estiForm.coverPaper.options[document.estiForm.coverPaper.selectedIndex].value == "80_nl_eb_book" || document.estiForm.coverPaper.value == "80_nl_eb_book"
			|| document.estiForm.coverPaper.options[document.estiForm.coverPaper.selectedIndex].value == "80_nl_ec_cover" || document.estiForm.coverPaper.value == "80_nl_ec_cover"
			|| document.estiForm.coverPaper.options[document.estiForm.coverPaper.selectedIndex].value == "100_nl_ec_cover" || document.estiForm.coverPaper.value == "100_nl_ec_cover"
			|| (document.estiForm.coverPaper.options[document.estiForm.coverPaper.selectedIndex].value == "same as inside" && document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value == "80_nl_eb_book"))) {
						
			var coverTrees = ( .96 * (coverWeight(tsi_cover)/2000) * 24 + .04 * (coverWeight(tsi_cover)/2000) * 12);
			var coverWater = ( (20519.6 * (coverWeight(tsi_cover)/2000)) - (10484 * (coverWeight(tsi_cover)/2000)) );
			var coverSolidwaste = ( (2278.349 * (coverWeight(tsi_cover)/2000)) - (1168.1357 * (coverWeight(tsi_cover)/2000)) );
			var coverGhgasses = ( (5789.724 * (coverWeight(tsi_cover)/2000)) - (3597.112 * (coverWeight(tsi_cover)/2000)) );
			var coverCarmiles = ( (coverGhgasses/11440) * 10000 );
			var coverLbswood = ( 3.46666666666667 * (coverWeight(tsi_cover)) );

		}
		
		else if ((document.estiForm.coverPaper.options && // cover is Reincarnation
				(document.estiForm.coverPaper.options[document.estiForm.coverPaper.selectedIndex].value == "70_nl_rein_book" || document.estiForm.coverPaper.value == "70_nl_rein_book" 
			|| document.estiForm.coverPaper.options[document.estiForm.coverPaper.selectedIndex].value == "80_nl_rein_book" || document.estiForm.coverPaper.value == "80_nl_rein_book" 
			|| document.estiForm.coverPaper.options[document.estiForm.coverPaper.selectedIndex].value == "105_nl_rein_book" || document.estiForm.coverPaper.value == "105_nl_rein_book" 
			|| document.estiForm.coverPaper.options[document.estiForm.coverPaper.selectedIndex].value == "65_nl_rein_cover" || document.estiForm.coverPaper.value == "65_nl_rein_cover"
			|| document.estiForm.coverPaper.options[document.estiForm.coverPaper.selectedIndex].value == "80_nl_rein_cover" || document.estiForm.coverPaper.value == "80_nl_rein_cover" 
			|| document.estiForm.coverPaper.options[document.estiForm.coverPaper.selectedIndex].value == "95_nl_rein_cover" || document.estiForm.coverPaper.value == "95_nl_rein_cover"
			|| (document.estiForm.coverPaper.options[document.estiForm.coverPaper.selectedIndex].value == "same as inside" && 
				(document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value == "80_nl_rein_book" || (document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value == "105_nl_rein_book")))))
				|| (document.estiForm.coverPaper.value == "20pt_kraftboard"))  {
			var coverTrees = ( .47 * (coverWeight(tsi_cover)/2000) * 24 + .03 * (coverWeight(tsi_cover)/2000) * 12);
			var coverWater = ( (17851.968 * (coverWeight(tsi_cover)/2000)) - (15320.5 * (coverWeight(tsi_cover)/2000)) );
			var coverSolidwaste = ( (2207.67 * (coverWeight(tsi_cover)/2000)) - (1653.874 * (coverWeight(tsi_cover)/2000)) );
			var coverGhgasses = ( (5569.508 * (coverWeight(tsi_cover)/2000)) - (4633.694 * (coverWeight(tsi_cover)/2000)) );
			var coverCarmiles = ( (coverGhgasses/11440) * 10000 );
			var coverLbswood = ( (2.84444444444444 * (coverWeight(tsi_cover))) - (1.55555555555556 * (coverWeight(tsi_cover))) );
		}

		else if (document.estiForm.coverPaper.options && // cover is Sakura (still awaiting these numbers!)
			  (document.estiForm.coverPaper.options[document.estiForm.coverPaper.selectedIndex].value == "87_nl_sak_book" || document.estiForm.coverPaper.value == "87_nl_sak_book" 
			|| document.estiForm.coverPaper.options[document.estiForm.coverPaper.selectedIndex].value == "106_nl_sak_book" || document.estiForm.coverPaper.value == "106_nl_sak_book"
			|| document.estiForm.coverPaper.options[document.estiForm.coverPaper.selectedIndex].value == "96_nl_sak_cover" || document.estiForm.coverPaper.value == "96_nl_sak_cover"
			|| (document.estiForm.coverPaper.options[document.estiForm.coverPaper.selectedIndex].value == "same as inside" && 
				(document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value == "87_nl_sak_book" || (document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value == "106_nl_sak_book"))))) {
						
			var coverTrees = ( .96 * (coverWeight(tsi_cover)/2000) * 24 + .04 * (coverWeight(tsi_cover)/2000) * 12);
			var coverWater = ( (20519.6 * (coverWeight(tsi_cover)/2000)) - (10484 * (coverWeight(tsi_cover)/2000)) );
			var coverSolidwaste = ( (2278.349 * (coverWeight(tsi_cover)/2000)) - (1168.1357 * (coverWeight(tsi_cover)/2000)) );
			var coverGhgasses = ( (5789.724 * (coverWeight(tsi_cover)/2000)) - (3597.112 * (coverWeight(tsi_cover)/2000)) );
			var coverCarmiles = ( (coverGhgasses/11440) * 10000 );
			var coverLbswood = ( 3.46666666666667 * (coverWeight(tsi_cover)) );
		}	

		else if (document.estiForm.coverPaper.options && // Cover is Primavera
				(document.estiForm.coverPaper.options[document.estiForm.coverPaper.selectedIndex].value == "88_nl_pvg_book" || document.estiForm.coverPaper.value == "88_nl_pvg_book"  
			|| document.estiForm.coverPaper.options[document.estiForm.coverPaper.selectedIndex].value == "101_nl_pvg_book" || document.estiForm.coverPaper.value == "101_nl_pvg_book"
			|| document.estiForm.coverPaper.options[document.estiForm.coverPaper.selectedIndex].value == "89_nl_pvg_cover" || document.estiForm.coverPaper.value == "89_nl_pvg_cover" 
			|| document.estiForm.coverPaper.options[document.estiForm.coverPaper.selectedIndex].value == "111_nl_pvg_cover" || document.estiForm.coverPaper.value == "111_nl_pvg_cover"
			|| (document.estiForm.coverPaper.options[document.estiForm.coverPaper.selectedIndex].value == "same as inside" && document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value == "101_nl_pvg_book"))) {
							
			var coverTrees = ( .40 * (coverWeight(tsi_cover)/2000) * 24 + .0 * (coverWeight(tsi_cover)/2000) * 12);
			var coverWater = ( (17851.968 * (coverWeight(tsi_cover)/2000)) - (11931.2 * (coverWeight(tsi_cover)/2000)) );
			var coverSolidwaste = ( (2207.67 * (coverWeight(tsi_cover)/2000)) - (1732.493 * (coverWeight(tsi_cover)/2000)) );
			var coverGhgasses = ( (5569.508 * (coverWeight(tsi_cover)/2000)) - (4333.0106 * (coverWeight(tsi_cover)/2000)) );
			var coverCarmiles = ( (coverGhgasses/11440) * 10000 );
			var coverLbswood = ( (2.84444444444444 * (coverWeight(tsi_cover))) - (1.70666666666667 * (coverWeight(tsi_cover))) );
		}
		
		updateText("coverTrees", (coverTrees.toFixed(2)));
		updateText("coverWater", (coverWater.toFixed(1)));
		updateText("coverSolidwaste", (coverSolidwaste.toFixed(1)));
		updateText("coverGhgasses", (coverGhgasses.toFixed(1)));
		updateText("coverCarmiles", (coverCarmiles.toFixed(1)));
		updateText("coverLbswood" , (coverLbswood.toFixed(1)));
		updateText("coverWeight" , (coverWeight(tsi_cover).toFixed(1)));
	}

	if (document.estiForm.stationeryLetterheadBlank && document.estiForm.stationeryLetterheadBlank.value != "none") { 
		var blnkltrhd_weight = ( (parseInt(document.estiForm.stationeryLetterheadBlank.value)/500) * 6.35)  
		var blnkltrhd_trees = ( .96 * (blnkltrhd_weight/2000) * 24 + .04 * (blnkltrhd_weight/2000) * 12);
		var blnkltrhd_water = ( (20519.6 * (blnkltrhd_weight/2000)) - (10484 * (blnkltrhd_weight/2000)) )
		var blnkltrhd_solidwaste = ( (2278.349 * (blnkltrhd_weight/2000)) - (1168.1357 * (blnkltrhd_weight/2000)) )
		var blnkltrhd_ghgasses = ( (5789.724 * (blnkltrhd_weight/2000)) - (3597.112 * (blnkltrhd_weight/2000)) )
		var blnkltrhd_carmiles = ( (blnkltrhd_weight/11440) * 10000 )
		
		updateText("blnkltrhd_weight" , (blnkltrhd_weight.toFixed(1)));
		updateText("blnkltrhd_trees", (blnkltrhd_trees.toFixed(2)));
		updateText("blnkltrhd_water", (blnkltrhd_water.toFixed(1)));
		updateText("blnkltrhd_solidwaste", (blnkltrhd_solidwaste.toFixed(1)));
		updateText("blnkltrhd_ghgasses", (blnkltrhd_ghgasses.toFixed(1)));
		updateText("blnkltrhd_carmiles", (blnkltrhd_carmiles.toFixed(1)));			
		
	}
	if (document.estiForm.paper.options &&
			(document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value == "70_nl_rein_book" || document.estiForm.paper.value == "70_nl_rein_book" 
		|| document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value == "80_nl_rein_book" || document.estiForm.paper.value == "80_nl_rein_book" 
		|| document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value == "105_nl_rein_book" || document.estiForm.paper.value == "105_nl_rein_book" 
		|| document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value == "65_nl_rein_cover" || document.estiForm.paper.value == "65_nl_rein_cover"
		|| document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value == "80_nl_rein_cover" || document.estiForm.paper.value == "80_nl_rein_cover" 
		|| document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value == "95_nl_rein_cover" || document.estiForm.paper.value == "95_nl_rein_cover"
		|| document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value == "20pt_kraftboard" || document.estiForm.paper.value == "20pt_kraftboard"
		|| document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value == "16pt_nl_rein_dblthick" || document.estiForm.paper.value == "16pt_nl_rein_dblthick"
		|| document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value == "87_nl_sak_book" || document.estiForm.paper.value == "87_nl_sak_book" 
		|| document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value == "106_nl_sak_book" || document.estiForm.paper.value == "106_nl_sak_book"
		|| document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value == "96_nl_sak_cover" || document.estiForm.paper.value == "96_nl_sak_cover")) {

			var trees = ( (.47 * (getJobWeight(tsi)/2000) * 24 + .03 * (getJobWeight(tsi)/2000) * 12) + env_trees + env2_trees + coverTrees + blnkltrhd_trees + ltrhd_trees);
			var water = ( ((17851.968 * (getJobWeight(tsi)/2000)) - (15320.5 * (getJobWeight(tsi)/2000))) + env_water + env2_water + coverWater + ltrhd_water + blnkltrhd_water);
			var solidwaste = ( ((2207.67 * (getJobWeight(tsi)/2000)) - (1653.874 * (getJobWeight(tsi)/2000))) + env_solidwaste + env2_solidwaste + coverSolidwaste + ltrhd_solidwaste + blnkltrhd_solidwaste);
			var ghgasses = ( ((5569.508 * (getJobWeight(tsi)/2000)) - (4633.694 * (getJobWeight(tsi)/2000))) + env_ghgasses + env2_ghgasses + coverGhgasses + ltrhd_ghgasses + blnkltrhd_ghgasses);
			var carmiles = ( (ghgasses/11440) * 10000 );
			var lbswood = ( ((2.84444444444444 * (getJobWeight(tsi))) - (1.55555555555556 * (getJobWeight(tsi)))) + env_lbswood + env2_lbswood + coverLbswood + blnkltrhd_lbswood + ltrhd_lbswood );
	}

	else if (document.estiForm.paper.options &&
			(document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value == "88_nl_pvg_book" || document.estiForm.paper.value == "88_nl_pvg_book"  
		|| document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value == "101_nl_pvg_book" || document.estiForm.paper.value == "101_nl_pvg_book"
		|| document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value == "89_nl_pvg_cover" || document.estiForm.paper.value == "89_nl_pvg_cover" 
		|| document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value == "111_nl_pvg_cover" || document.estiForm.paper.value == "111_nl_pvg_cover")) {

			var trees = (( .40 * (getJobWeight(tsi)/2000) * 24 + .0 * (getJobWeight(tsi)/2000) * 12) + env_trees + env2_trees + coverTrees + blnkltrhd_trees + ltrhd_trees);
			var water = ( ((17851.968 * (getJobWeight(tsi)/2000)) - (11931.2 * (getJobWeight(tsi)/2000))) + env_water + env2_water + coverWater + ltrhd_water + blnkltrhd_water);
			var solidwaste = ( ((2207.67 * (getJobWeight(tsi)/2000)) - (1732.493 * (getJobWeight(tsi)/2000))) + env_solidwaste + env2_solidwaste + coverSolidwaste + ltrhd_solidwaste + blnkltrhd_solidwaste);
			var ghgasses = ( ((5569.508 * (getJobWeight(tsi)/2000)) - (4333.0106 * (getJobWeight(tsi)/2000))) + env_ghgasses + env2_ghgasses + coverGhgasses + ltrhd_ghgasses + blnkltrhd_ghgasses);
			var carmiles = ( (ghgasses/11440) * 10000 );
			var lbswood = ( ((2.84444444444444 * (getJobWeight(tsi))) - (1.70666666666667 * (getJobWeight(tsi)))) + env_lbswood + env2_lbswood + coverLbswood + blnkltrhd_lbswood + ltrhd_lbswood );
			}

	else if ((document.estiForm.paper.options &&		
		(document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value == "24_nl_ew" || document.estiForm.paper.value == "24_nl_ew"
		|| document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value == "80_nl_eb_book" || document.estiForm.paper.value == "80_nl_eb_book"
		|| document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value == "80_nl_ec_cover" || document.estiForm.paper.value == "80_nl_ec_cover"
		|| document.estiForm.paper.options[document.estiForm.paper.selectedIndex].value == "100_nl_ec_cover" || document.estiForm.paper.value == "100_nl_ec_cover"
		))
		|| document.estiForm.paper.value == "70_nl_imag_text") {
			if (document.estiForm.paper.value == "70_nl_imag_text")
				tsi = (tsi * 50)
			var trees = (( .96 * (getJobWeight(tsi)/2000) * 24 + .04 * (getJobWeight(tsi)/2000) * 12) + env_trees + env2_trees + coverTrees + blnkltrhd_trees + ltrhd_trees);
			var water = ( ((20519.6 * (getJobWeight(tsi)/2000)) - (10484 * (getJobWeight(tsi)/2000))) + env_water + env2_water + coverWater + ltrhd_water + blnkltrhd_water);
			var solidwaste = ( ((2278.349 * (getJobWeight(tsi)/2000)) - (1168.1357 * (getJobWeight(tsi)/2000))) + env_solidwaste + env2_solidwaste + env2_solidwaste + coverSolidwaste + ltrhd_solidwaste + blnkltrhd_solidwaste);
			var ghgasses = ( ((5789.724 * (getJobWeight(tsi)/2000)) - (3597.112 * (getJobWeight(tsi)/2000))) + env_ghgasses + env2_ghgasses + coverGhgasses + ltrhd_ghgasses + blnkltrhd_ghgasses);
			var carmiles = ( (ghgasses/11440) * 10000 );
			var lbswood = ( (3.46666666666667 * (getJobWeight(tsi))) + env_lbswood + env2_lbswood + coverLbswood + blnkltrhd_lbswood + ltrhd_lbswood) ;
		}
	else if (document.estiForm.paper.value == "95_nl_rein_cover" || document.estiForm.paper.value == "16pt_nl_rein_dblthick" || document.estiForm.paper.value == "24_nl_ew" || document.estiForm.paper.value == "80_nl_rein_cover" || document.estiForm.paper.value == "105_nl_rein_book" ||  document.estiForm.paper.value == "80_nl_rein_book" || document.estiForm.paper.value == "20pt_kraftboard") {
			var trees = ( (.47 * (getJobWeight(tsi)/2000) * 24 + .03 * (getJobWeight(tsi)/2000) * 12) + env_trees + env2_trees + coverTrees + blnkltrhd_trees + ltrhd_trees);
			var water = ( ((17851.968 * (getJobWeight(tsi)/2000)) - (15320.5 * (getJobWeight(tsi)/2000))) + env_water + env2_water + coverWater + ltrhd_water + blnkltrhd_water);
			var solidwaste = ( ((2207.67 * (getJobWeight(tsi)/2000)) - (1653.874 * (getJobWeight(tsi)/2000))) + env_solidwaste + env2_solidwaste + coverSolidwaste + ltrhd_solidwaste + blnkltrhd_solidwaste);
			var ghgasses = ( ((5569.508 * (getJobWeight(tsi)/2000)) - (4633.694 * (getJobWeight(tsi)/2000))) + env_ghgasses + env2_ghgasses + coverGhgasses + ltrhd_ghgasses + blnkltrhd_ghgasses);
			var carmiles = ( (ghgasses/11440) * 10000 );
			var lbswood = ( ((2.84444444444444 * (getJobWeight(tsi))) - (1.55555555555556 * (getJobWeight(tsi)))) + env_lbswood + env2_lbswood + coverLbswood + blnkltrhd_lbswood + ltrhd_lbswood );
			}

		updateText("myJobWeight", (getJobWeight(tsi).toFixed(1)));
		updateText("trees", (trees.toFixed(2)));
		updateText("water", (water.toFixed(1)));
		updateText("solidwaste", (solidwaste.toFixed(1)));
		updateText("ghgasses", (ghgasses.toFixed(1)));
		updateText("carmiles", (carmiles.toFixed(1)));
		updateText("lbswood", (lbswood.toFixed(1)));	
	}	
/* <bean:message key="server.copyright.text" />
<bean:message key="server.copyright.text" />
<bean:message key="server.copyright.text" /> */