function Calculate()
{
	//---------------------------------------------------------------------
	// function Calculate()
	//---------------------------------------------------------------------

	//---------------------------------------------------------------------
	// Pricing Variables
	//---------------------------------------------------------------------
	var costPgBW6_9 = .013;
	var costPgClr6_9 = .08;
	var costCover6_9 = .9;
	var costLam6_9 = .9;

	var costPgBW8_5 = .013;
	var costPgClr8_5 = .08;
	var costCover8_5 = .9;
	var costLam8_5 = .9;

	var costPgBW8_11 = .024;
	var costPgClr8_11 = .15;
	var costCover8_11 = 1.6;
	var costLam8_11 = 1.6;

	var objStdQty_1 = 50;
	var objStdQty_2 = 100;
	var objStdQty_3 = 500;

	var objRushQty_1 = 50;
	var objRushQty_2 = 100;
	var objRushQty_3 = 500;

	var objRushPrem = .20;		// This is a percentage!!

	//---------------------------------------------------------------------
	// Notes Variables
	//---------------------------------------------------------------------
	var notes_blank = '';
	var notes_Rush = "Rush processing is assessed an additional handling charge of "+(objRushPrem*100)+"% per book.";
	var notes_UVCoating = "UV Coating of the cover is available on order of 100 books at a cost of $.60 per book";
	var notes_perfbind = "Prices based on Perfect Bound Books";
	var notes_PprColor= "As Creme paper is thicker than white, shipping costs may increase.  Creme paper is dependent upon availability"
	
	var bksID = 0;
	var lngQty = 0;
	var lngNumPages = 0;
	var lngNumPagesColor = 0;

	var objSelBksID;
	var objNumPages;
	var objNumPagesColor;
	var objPaperColor;

	if ( document.getElementById )
	{
		//---------------------------------------------------
		// get user data
		//---------------------------------------------------
		objBookQty = document.getElementById( 'BookQty' );
		objSelBksID = document.getElementById( 'BookSize' );
		objNumPages = document.getElementById( 'NumPages' );
		objNumPagesColor = document.getElementById( 'NumPagesColor' );
		objPaperColor = document.getElementById( 'PaperColor' );

		objOpt_Spiral = document.getElementById( 'SpiralBind' );
		opjOpt_UVCoat = document.getElementById( 'UVCoating' );;

		document.BookCalc.txtStdQty.value = 0;
		document.BookCalc.txtStdPricePer.value = 0;
		document.BookCalc.txtStdPrice.value = 0;

		document.BookCalc.txtRushQty.value = 0;
		document.BookCalc.txtRushPricePer.value = 0;
		document.BookCalc.txtRushPrice.value = 0;

		//---------------------------------------------------
		// Calculate the cost of One (1) book . . .
		//---------------------------------------------------
		if (objSelBksID.value==1)
		{
			// price = ( #BWpages X cost/BWpage) + ( #ColorPages X cost/ColorPage ) + Cost of cover
			BookPrice = 1.00+((objNumPages.value*costPgBW6_9)+(objNumPagesColor.value*costPgClr6_9)+costCover6_9);
		}
		if (objSelBksID.value==2)
		{
			BookPrice = 1.00+((objNumPages.value*costPgBW8_5)+(objNumPagesColor.value*costPgClr8_5)+costCover8_5);
		}
		if (objSelBksID.value==3)
		{
			BookPrice = 1.00+((objNumPages.value*costPgBW8_11)+(objNumPagesColor.value*costPgClr8_11)+costCover8_11);
		}
		
		//-------------------------------------------------------------
		// Add any special notes to the order.
		//-------------------------------------------------------------
		document.BookCalc.txtNotes.value = notes_blank;
		document.BookCalc.txtNotes.value = document.BookCalc.txtNotes.value + notes_perfbind + '\n\n'  + notes_Rush;
		document.BookCalc.txtNotes.value = document.BookCalc.txtNotes.value + '\n\n' + notes_UVCoating;

		if (objPaperColor.value=="creme")
		{
			document.BookCalc.txtNotes.value = document.BookCalc.txtNotes.value + '\n\n' + notes_PprColor;
		}



		//-------------------------------------------------------------
		// Display costs ONLY if they put have a page count . . .
		//-------------------------------------------------------------
		if (objNumPages.value>0 || objNumPagesColor.value>0)
		{
			document.BookCalc.txtStdQty.value = objBookQty.value;
			document.BookCalc.txtStdPricePer.value = BookPrice;
			document.BookCalc.txtStdPrice.value = Math.ceil(BookPrice*objBookQty.value);

			//---------------------------------------------------------
			// Calculate Book Price + Premium for RUSH
			//---------------------------------------------------------
			rushprem = BookPrice*objRushPrem;
			BookPrice= BookPrice+rushprem;
			
			document.BookCalc.txtRushQty.value = objBookQty.value;
			document.BookCalc.txtRushPricePer.value = BookPrice;
			document.BookCalc.txtRushPrice.value = Math.ceil(BookPrice*objBookQty.value);
		}
	}
}

