$taxrate = 8.375;
function checkCR(evt) {

    var evt  = (evt) ? evt : ((event) ? event : null);

    var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);

    if ( ( (evt.keyCode == 13) || (evt.keyCode == 3) ) && (node.type=="text")) {return false;}

  }

//document.onkeypress = checkCR;

// JavaScript Document



function checkLinen(whichbox) {

	with (whichbox.form) {

		hidden_linen_total.value = ( eval(linen_number.value)*3.5 );

		return(formatCurrency(hidden_linen_total.value));
		
	 };

};

function checkDish(whichbox) {

	with (whichbox.form) {

		hidden_dish_total.value = ( eval(dish_number.value)*5.5 );

		return(formatCurrency(hidden_dish_total.value));
		
	 };

};

function checkWardrobe(whichbox) {

	with (whichbox.form) {

		hidden_wardrobe_total.value = ( eval(wardrobe_number.value)*15 );

		return(formatCurrency(hidden_wardrobe_total.value));
		
	 };

};

function checkUnprinted(whichbox) {

	with (whichbox.form) {

		hidden_unprinted_total.value = ( eval(unprinted_number.value)*26 );

		return(formatCurrency(hidden_unprinted_total.value));
		
	 };

};

function checkTape(whichbox) {

	with (whichbox.form) {

		hidden_tape_total.value = ( eval(tape_number.value)*3.5 );

		return(formatCurrency(hidden_tape_total.value));
		
	 };

};

function checkDispenser(whichbox) {

	with (whichbox.form) {

		hidden_dispenser_total.value = ( eval(dispenser_number.value)*9 );

		return(formatCurrency(hidden_dispenser_total.value));
		
	 };

};

 

function checkLetter(whichbox) {

	with (whichbox.form) {

		hidden_letter_total.value = ( eval(letter_number.value)*4 );

		return(formatCurrency(hidden_letter_total.value));
		
	 };

};

function checkLegal(whichbox) {

	with (whichbox.form) {

		hidden_legal_total.value = ( eval(legal_number.value)*4.5 );

		return(formatCurrency(hidden_legal_total.value));
		
	 };

};

 

function checkHvyUtility(whichbox) {

	with (whichbox.form) {

		hidden_hvy_utility_total.value = ( eval(hvy_utility_number.value)*5.5 );

		return(formatCurrency(hidden_hvy_utility_total.value));
		
	 };

};

function checkSmlPic(whichbox) {

	with (whichbox.form) {

		hidden_sml_pic_total.value = ( eval(sml_pic_number.value)*11 );

		return(formatCurrency(hidden_sml_pic_total.value));
		
	 };

};

function checkLgePic(whichbox) {

	with (whichbox.form) {

		hidden_lge_pic_total.value = ( eval(lge_pic_number.value)*13 );

		return(formatCurrency(hidden_lge_pic_total.value));
		
	 };

};

function checkSmlBin(whichbox) {

	with (whichbox.form) {

		hidden_sml_bin_total.value = ( eval(sml_bin_number.value)*28 );

		return(formatCurrency(hidden_sml_bin_total.value));
		
	 };

};

function checkLgeBin(whichbox) {

	with (whichbox.form) {

		hidden_lge_bin_total.value = ( eval(lge_bin_number.value)*38 );

		return(formatCurrency(hidden_lge_bin_total.value));
		
	 };

};

function checkSmlBubble2(whichbox) {

	with (whichbox.form) {

		hidden_sml_bubble2_total.value = ( eval(sml_bubble2_number.value)*17 );

		return(formatCurrency(hidden_sml_bubble2_total.value));
		
	 };

};

function checkLgeBubble2(whichbox) {

	with (whichbox.form) {

		hidden_lge_bubble2_total.value = ( eval(lge_bubble2_number.value)*20 );

		return(formatCurrency(hidden_lge_bubble2_total.value));
		
	 };

};

function checkSmlBubble1(whichbox) {

	with (whichbox.form) {

		hidden_sml_bubble1_total.value = ( eval(sml_bubble1_number.value)*27 );

		return(formatCurrency(hidden_sml_bubble1_total.value));
		
	 };

};

function checkFurniture(whichbox) {

	with (whichbox.form) {

		hidden_furniture_total.value = ( eval(furniture_number.value)*17 );

		return(formatCurrency(hidden_furniture_total.value));
		
	 };

};

function checkPaper(whichbox) {

	with (whichbox.form) {

		hidden_paper_total.value = ( eval(paper_number.value)*4.5 );

		return(formatCurrency(hidden_paper_total.value));
		
	 };

};

function checkWebbing(whichbox) {

	with (whichbox.form) {

		hidden_webbing_total.value = ( eval(webbing_number.value)*30 );

		return(formatCurrency(hidden_webbing_total.value));
		
	 };

};

function checkSmlDolly(whichbox) {

	with (whichbox.form) {

		hidden_sml_dolly_total.value = ( eval(sml_dolly_number.value)*35 );

		return(formatCurrency(hidden_sml_dolly_total.value));
		
	 };

};

function checkLgeDolly(whichbox) {

	with (whichbox.form) {

		hidden_lge_dolly_total.value = ( eval(lge_dolly_number.value)*40 );

		return(formatCurrency(hidden_lge_dolly_total.value));
		
	 };

};

function checkKing(whichbox) {

	with (whichbox.form) {

		hidden_king_total.value = ( eval(king_number.value)*5.5 );

		return(formatCurrency(hidden_king_total.value));
		
	 };

};

function checkQueen(whichbox) {

	with (whichbox.form) {

		hidden_queen_total.value = ( eval(queen_number.value)*5 );

		return(formatCurrency(hidden_queen_total.value));
		
	 };

};

function checkTwin(whichbox) {

	with (whichbox.form) {

		hidden_twin_total.value = ( eval(twin_number.value)*4.5 );

		return(formatCurrency(hidden_twin_total.value));
		
	 };

};

function checkChair(whichbox) {

	with (whichbox.form) {

		hidden_chair_total.value = ( eval(chair_number.value)*4 );

		return(formatCurrency(hidden_chair_total.value));
		
	 };

};

function checkSofa(whichbox) {

	with (whichbox.form) {

		hidden_sofa_total.value = ( eval(sofa_number.value)*8 );

		return(formatCurrency(hidden_sofa_total.value));
		
	 };

};

function checkBook(whichbox) {

	with (whichbox.form) {

		hidden_book_total.value = ( eval(book_number.value)*2 );
		 
		 
		return(formatCurrency(hidden_book_total.value));
		
	 };

};


function checkNet(whichbox) {
    
	with (whichbox.form) {

		 hidden_net_total.value = ( eval(hidden_book_total.value) + eval(hidden_linen_total.value) + eval(hidden_dish_total.value) + eval(hidden_wardrobe_total.value) + eval(hidden_unprinted_total.value) + eval(hidden_tape_total.value) + eval(hidden_dispenser_total.value) + eval(hidden_letter_total.value) + eval(hidden_legal_total.value) +   eval(hidden_hvy_utility_total.value) + eval(hidden_sml_pic_total.value) + eval(hidden_lge_pic_total.value) + eval(hidden_sml_bin_total.value) + eval(hidden_lge_bin_total.value) + eval(hidden_sml_bubble2_total.value) + eval(hidden_lge_bubble2_total.value) + eval(hidden_sml_bubble1_total.value) + eval(hidden_furniture_total.value) + eval(hidden_paper_total.value) + eval(hidden_webbing_total.value) + eval(hidden_sml_dolly_total.value) + eval(hidden_lge_dolly_total.value) + eval(hidden_king_total.value) + eval(hidden_queen_total.value) + eval(hidden_twin_total.value) + eval(hidden_chair_total.value) + eval(hidden_sofa_total.value) );
		  
		return(formatCurrency(hidden_net_total.value));
		
	 };

};

function checkTax(whichbox) {

	with (whichbox.form) {

		if(document.getElementById("non-tax-entity").checked==true)
		{
			return(formatCurrency(0));

		}

		hidden_tax_total.value = (eval(hidden_net_total.value)*($taxrate/100));
			
		return(formatCurrency(hidden_tax_total.value));

   };

};

function checkGrand(whichbox) {
 
	with (whichbox.form) {


		if(document.getElementById("non-tax-entity").checked==true)
		{
		hidden_grand_total.value = ( eval(hidden_net_total.value) );
		}
		else
		{
		hidden_grand_total.value = ( eval(hidden_net_total.value) + eval(hidden_tax_total.value) );

		}
		return(formatCurrency(hidden_grand_total.value));
		
	 };

};

		


function formatCurrency(num) {
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num)) num = "0";
cents = Math.floor((num*100+0.5)%100);
num = Math.floor((num*100+0.5)/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 ("$" + num + "." + cents);
}


function updateTotalVal(){

	if(document.getElementById("non-tax-entity").checked==true)
	{

	with (document.forms[0]) {
	
net_total.value=formatCurrency(eval(hidden_net_total.value));
grand_total.value =formatCurrency(eval(hidden_net_total.value));
tax_total.value =formatCurrency(eval(0));

	}

	}
	else
	{


	with (document.forms[0]) {
	
net_total.value=formatCurrency(eval(hidden_net_total.value));

grand_total.value = formatCurrency( eval(hidden_net_total.value) + eval(hidden_tax_total.value) );

tax_total.value =formatCurrency((eval(hidden_net_total.value)*($taxrate/100)));

	}

	}

}
