	////////////////////
	// useful global vars
	var isValid; // boold
	
	////////////////////
	// user selection vars 

	var qty; // int

	var isFaxEmailProof; // bool
	var isStandardProof; // bool

	////////////////////
	// price vars

	var coverPrice = 0;
	var insidePrice = 0;
	var binderyPrice = 0;
	var subtotalPrice = 0;
	var costEach = 0;
	var proofPrice = 0;
	var shippingPrice = 0;
	var totalPrice = 0;


	////////////////////
	// price data

	// -- quantity-based items --

	// quantity
	var qtyArray = new Array(4);
	qtyArray[0] = 250;
	qtyArray[1] = 500;
	qtyArray[2] = 1000;
	qtyArray[3] = 2500;
	
	// printing one side
	var oneSideArray = new Array(4);
	oneSideArray[0] = 952;
	oneSideArray[1] = 1055;
	oneSideArray[2] = 1290;
	oneSideArray[3] = 1850;

	// folding
	var foldingArray = new Array(4);
	foldingArray[0] = 0;
	foldingArray[1] = 0;
	foldingArray[2] = 0;
	foldingArray[3] = 0;

	// shipping
	var shippingArray = new Array(4);
	shippingArray[0] = 25;
	shippingArray[1] = 40;
	shippingArray[2] = 0;
	shippingArray[3] = 0;

	// -- flat rate items --

	var faxEmailProofRate = 12;
	var standardProofRate = 60;


	/////////////////////////////////////
	// update prices
	function updatePrices()
	{
		// check selections
		checkSelections();

		if (!isValid)
		{
			showCall();
			return;
		}
		
		// calculate prices
		calcPrices();

		// display prices
		showPrices();

	}
	/////////////////////////////////////

	function checkSelections()
	{
		// quantity (always done first)
		var selQty = document.getElementById("selQty");
		
		qty = selQty.options[selQty.selectedIndex].value;

		if (qty =="10000+")
		{
			isValid = false;
			return;
		}

		
		// printing on both sides?
		var back_4_color = document.getElementById("back_4_color_1");

		// proofs
		var proof = document.getElementById("proof_1");

		isFaxEmailProof = proof.checked;
		isStandardProof = !proof.checked;
		
		isValid = true;

	}

	function calcPrices()
	{
		var priceIndex = getIndexOfQty( qty );

		// cover price
		coverPrice = oneSideArray[priceIndex];

		insidePrice = 0;
		
		binderyPrice = 0;
	


		if (isFaxEmailProof)
			proofPrice = faxEmailProofRate;

		if (isStandardProof)
			proofPrice = standardProofRate;

		shippingPrice = shippingArray[priceIndex];

		// universal calcs
		subtotalPrice = coverPrice + insidePrice + binderyPrice;
		costEach = subtotalPrice / qty;
		totalPrice = subtotalPrice + proofPrice + shippingPrice;
	}

	function showPrices()
	{
		var txtBoxCoverPrice = document.getElementById("txtBoxCoverPrice");
		txtBoxCoverPrice.value = numberToFixed(coverPrice, 2);

		//var txtBoxInsidePrice = document.getElementById("txtBoxInsidePrice");
		//txtBoxInsidePrice.value = numberToFixed(insidePrice, 2);

		//var txtBoxBinderyPrice = document.getElementById("txtBoxBinderyPrice");
		//txtBoxBinderyPrice.value = numberToFixed(binderyPrice, 2);

		var txtBoxSubtotalPrice = document.getElementById("txtBoxSubtotalPrice");
		txtBoxSubtotalPrice.value = numberToFixed(subtotalPrice, 2);

		var txtBoxCostEach = document.getElementById("txtBoxCostEach");
		txtBoxCostEach.value = numberToFixed(costEach, 2);

		var txtBoxProofPrice = document.getElementById("txtBoxProofPrice");
		txtBoxProofPrice.value = numberToFixed(proofPrice, 2);

		var txtBoxShippingPrice = document.getElementById("txtBoxShippingPrice");
		txtBoxShippingPrice.value = numberToFixed(shippingPrice, 2);

		var txtBoxTotalPrice = document.getElementById("txtBoxTotalPrice");
		txtBoxTotalPrice.value = numberToFixed(totalPrice, 2);

		var callRow = document.getElementById("callRow");
		callRow.style.display = "none";

	}

	function showCall()
	{
		var txtBoxCoverPrice = document.getElementById("txtBoxCoverPrice");
		txtBoxCoverPrice.value = "";

		//var txtBoxInsidePrice = document.getElementById("txtBoxInsidePrice");
		//txtBoxInsidePrice.value = "";

		//var txtBoxBinderyPrice = document.getElementById("txtBoxBinderyPrice");
		//txtBoxBinderyPrice.value = "";

		var txtBoxSubtotalPrice = document.getElementById("txtBoxSubtotalPrice");
		txtBoxSubtotalPrice.value = "";

		var txtBoxCostEach = document.getElementById("txtBoxCostEach");
		txtBoxCostEach.value = "";

		var txtBoxProofPrice = document.getElementById("txtBoxProofPrice");
		txtBoxProofPrice.value = "";

		var txtBoxShippingPrice = document.getElementById("txtBoxShippingPrice");
		txtBoxShippingPrice.value = "";

		var txtBoxTotalPrice = document.getElementById("txtBoxTotalPrice");
		txtBoxTotalPrice.value = "";

		var callRow = document.getElementById("callRow");
		callRow.style.display = "";


	}
	
	// util functions

	function getIndexOfQty( iQty )
	{
		for (var i = 0 ; i < qtyArray.length; i++ )
		{
			if (qtyArray[i] == iQty)
				return i;
		}

	}

	function numberToFixed( n , decimals )
	{
		if (n.toFixed)
		{
			return n.toFixed(decimals);
		} else {
			var factor = Math.pow(10, decimals);
			return Math.round(n * factor) / factor;
		}
	}

	function submitOrder()
	{
		document.forms[0].submit();
	}