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

	var qty; // int
	var pages; // int

	var isSize1; // bool
	var isSize2; // bool

	var isOneSide; // bool
	var isTwoSides; // bool

	var isFolded; // bool

	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] = 1000;
	qtyArray[1] = 2500;
	qtyArray[2] = 5000;
	qtyArray[3] = 10000;
	
	// printing one side - size 1
	var oneSideArraySize1 = new Array(4);
	oneSideArraySize1[0] = 468;
	oneSideArraySize1[1] = 567;
	oneSideArraySize1[2] = 676;
	oneSideArraySize1[3] = 1160;

	// printing two sides - - size 1
	var twoSidesArraySize1 = new Array(4);
	twoSidesArraySize1[0] = 468;
	twoSidesArraySize1[1] = 567;
	twoSidesArraySize1[2] = 676;
	twoSidesArraySize1[3] = 1160;

	// shipping - size 1
	var shippingArraySize1 = new Array(4);
	shippingArraySize1[0] = 35;
	shippingArraySize1[1] = 68;
	shippingArraySize1[2] = 0;
	shippingArraySize1[3] = 0;

	// printing one side - size 2
	var oneSideArraySize2 = new Array(4);
	oneSideArraySize2[0] = 629;
	oneSideArraySize2[1] = 831;
	oneSideArraySize2[2] = 1031;
	oneSideArraySize2[3] = 1769;

	// printing two sides - size 2
	var twoSidesArraySize2 = new Array(4);
	twoSidesArraySize2[0] = 629;
	twoSidesArraySize2[1] = 831;
	twoSidesArraySize2[2] = 1031;
	twoSidesArraySize2[3] = 1769;

	// shipping - size 2
	var shippingArraySize2 = new Array(4);
	shippingArraySize2[0] = 30;
	shippingArraySize2[1] = 68;
	shippingArraySize2[2] = 0;
	shippingArraySize2[3] = 0;

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


	// -- flat rate items --

	var faxEmailProofRate = 10;
	var standardProofRate = 50;


	/////////////////////////////////////
	// 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;
		}

		var size1 = document.getElementById("size_1");

		isSize1 = size1.checked;
		isSize2 = !size1.checked;

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

		isOneSide = !back_4_color.checked;
		isTwoSides = back_4_color.checked;



		var bindery = document.getElementById("bindery_1");
		isFolded = !bindery.checked;

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

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

	}

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

		// cover price

		var size = ( isSize1 ) ? 1 : 2;
		if (isOneSide)
			coverPrice = eval("oneSideArraySize" + size + "[priceIndex]");
		
		if (isTwoSides)
			coverPrice = eval("twoSidesArraySize" + size + "[priceIndex]");


		insidePrice = 0;

		
		if (isFolded == true)
		{
			binderyPrice = foldingArray[priceIndex];
		}
		else
		{
			binderyPrice = 0;
		}
		
		if (isFaxEmailProof)
			proofPrice = faxEmailProofRate;

		if (isStandardProof)
			proofPrice = standardProofRate;

		shippingPrice = eval("shippingArraySize" + size + "[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();
	}