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

	var qty; // int

	var isSize1; // bool
	var isSize2; // bool
	var isSize3; // 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(5);
	qtyArray[0] = 1;
	qtyArray[1] = 2;
	qtyArray[2] = 3;
	qtyArray[3] = 4;
	qtyArray[4] = 1000;
	
	// printing one side - size 1
	var oneSideArraySize1 = new Array(5);
	oneSideArraySize1[0] = 69;
	oneSideArraySize1[1] = 112.5;
	oneSideArraySize1[2] = 135;
	oneSideArraySize1[3] = 0;
	oneSideArraySize1[4] = 792;

	// printing one side - size 1
	var oneSideArraySize2 = new Array(5);
	oneSideArraySize2[0] = 135;
	oneSideArraySize2[1] = 180;
	oneSideArraySize2[2] = 240;
	oneSideArraySize2[3] = 0;
	oneSideArraySize2[4] = 1479;

	// printing one side - size 1
	var oneSideArraySize3 = new Array(5);
	oneSideArraySize3[0] = 149;
	oneSideArraySize3[1] = 278;
	oneSideArraySize3[2] = 381;
	oneSideArraySize3[3] = 0;
	oneSideArraySize3[4] = 0;

	// -- flat rate items --

	var faxEmailProofRate = 25;
	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 =="4+")
		{
			isValid = false;
			return;
		}



		var size1 = document.getElementById("size_1");
		var size2 = document.getElementById("size_2");
		var size3 = document.getElementById("size_3");



		isSize1 = size1.checked;
		isSize2 = size2.checked;
		isSize3 = size3.checked;

		if (isSize3 && qty == "1000")
		{
			isValid = false;
			return;
		}

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

		isOneSide = true;


		// 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 = 0;

		if (isSize1) size = 1;
		if (isSize2) size = 2;
		if (isSize3) size = 3;

		if (isOneSide)
			coverPrice = eval("oneSideArraySize" + size + "[priceIndex]");
		

		insidePrice = 0;
		


		if (isFaxEmailProof)
			proofPrice = faxEmailProofRate;

		if (isStandardProof)
			proofPrice = standardProofRate;

		shippingPrice = 0;

		// universal calcs
		subtotalPrice = coverPrice + insidePrice;
		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 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 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();
	}