	
	
	function disableField(field1, field2) {
		field1.disabled = true;
		field2.disabled = true;
	}
	function enableField(field1, field2) {
		field1.disabled = false;
		field2.disabled = false;
	}
	
	function addTotal() {
		var form = document.pricingTable;
		var fields = document.getElementsByTagName('input');
		for (i=0; i < fields.length; i++) {
			if (fields[i].value == "") {
				fields[i].value = 0;
			}
		}
		var total = parseInt(form.subTotal.value) + 
					parseInt(form.subTotal2.value) + 
					parseInt(form.subTotal3.value) + 
					parseInt(form.subTotal4.value) + 
					parseInt(form.subTotal5.value) + 
					parseInt(form.subTotal6.value) + 
					parseInt(form.subTotal7.value) + 
					parseInt(form.subTotal8.value) + 
					parseInt(form.subTotal9.value) + 
					parseInt(form.subTotal10.value) + 
					parseInt(form.subTotal11.value) + 
					parseInt(form.subTotal12.value) + 
					parseInt(form.subTotal13.value) + 
					parseInt(form.subTotal14.value) + 
					parseInt(form.subTotal15.value) + 
					parseInt(form.subTotal16.value) + 
					parseInt(form.subTotal17.value) + 
					parseInt(form.subTotal18.value) + 
					parseInt(form.subTotal19.value) + 
					parseInt(form.subTotal20.value) + 
					parseInt(form.subTotal21.value) + 
					// parseInt(form.subTotal22.value) + 
					// parseInt(form.subTotal23.value) + 
					// parseInt(form.subTotal24.value) + 
					// parseInt(form.subTotal25.value) + 
					parseInt(form.subTotal26.value) + 
					parseFloat(form.subTotal27.value) + 
					parseInt(form.subTotal28.value) + 
					//parseInt(form.subTotal29.value) + 
					parseFloat(form.subTotal30.value) + 
					parseFloat(form.subTotal31.value) + 
					parseInt(form.subTotal32.value) + 
					parseFloat(form.subTotal33.value) + 
					parseInt(form.subTotal34.value) + 
					parseInt(form.subTotal35.value) + 
					parseInt(form.subTotal36.value) + 
					parseInt(form.subTotal37.value) + 
					parseInt(form.subTotal38.value) + 
					parseInt(form.subTotal39.value) + 
					parseInt(form.subTotal40.value) + 
					parseInt(form.subTotal41.value) + 
					parseInt(form.subTotal42.value) + 
					parseInt(form.subTotal43.value) + 
			 		parseInt(form.subTotal44.value) + 
			 		parseInt(form.subTotal47.value) + 
			 		parseInt(form.subTotal48.value) + 
			 		parseInt(form.subTotal49.value) + 
					parseInt(form.subTotal50.value);
		document.getElementById('totalAmt').innerHTML = total.toFixed(2);
		document.getElementById('totalAmt1').innerHTML = total.toFixed(2);
		document.getElementById('totalAmt2').innerHTML = total.toFixed(2);
		document.getElementById('totalAmt3').innerHTML = total.toFixed(2);
		document.getElementById('totalAmt4').innerHTML = total.toFixed(2);
		document.getElementById('totalAmt5').innerHTML = total.toFixed(2);
		document.getElementById('totalAmt6').innerHTML = total.toFixed(2);
		document.getElementById('totalAmt7').innerHTML = total.toFixed(2);
		document.getElementById('totalAmt8').innerHTML = total.toFixed(2);
	}
	function addStateSubTotal(field, qty, price) {
		if (qty.value != 0 || "") {
			var subPrice = (parseFloat(qty.value) * price);
			field.value = subPrice.toFixed(2); 
		}
		if (qty.value == 0) {
			field.value = 0;
		}
		addTotal();
	}
	function enableAllPprBoxes() {
		var eleDiv = document.getElementById("pprSection");  
		var eleInputs = eleDiv.getElementsByTagName("input");
		for (i = 0; i < eleInputs.length; i++) {
			if (eleInputs[i].className == "pprInput") {
				eleInputs[i].disabled = false;
			}
			if (eleInputs[i].className == "pprAdd") {
				eleInputs[i].disabled = false;
			}
		}
		addTotal();
	}
	function disableAllPprBoxes() {
		var eleDiv = document.getElementById("pprSection");  
		var eleInputs = eleDiv.getElementsByTagName("input");
		for (i = 0; i < eleInputs.length; i++) {
			if (eleInputs[i].className == "pprInput") {
				eleInputs[i].disabled = true;
				eleInputs[i].value = 0;
			}
			if (eleInputs[i].className == "pprAdd") {
				eleInputs[i].disabled = true;
				eleInputs[i].value = "add";
			}
		}
		addTotal();
	}
	function addPPRProducts(chkBox, field, price) {
		var form = document.pricingTable;
		if (chkBox.checked) {
			enableAllPprBoxes();
			field.value = price.toFixed(2);
		}
		else if (chkBox.checked == false) {
			disableAllPprBoxes();
			field.value = 0;
			form.subTotal36.value = 0;
			form.subTotal37.value = 0;
			form.subTotal38.value = 0;
			form.subTotal39.value = 0;
			form.subTotal40.value = 0;
			form.subTotal41.value = 0;
			form.subTotal42.value = 0;
			form.subTotal43.value = 0;
			form.subTotal44.value = 0;
			form.subTotal47.value = 0;
		}
		addTotal();
	}
	function addSingleProduct(chkBox, field, price, additionalField, additionalFieldAmt) {
		if (chkBox.checked) {
			enableField(additionalField,"");
			field.value = price.toFixed(2);
		}
		else if (chkBox.checked == false) {
			disableField(additionalField,"");
			field.value = "";
			additionalField.checked = false;
			additionalFieldAmt.value = "";
		}
		addTotal();
	}
	
	function addMultipleProducts(chkBox, field, price, addField1, addFieldAmt1, addField2, addFieldAmt2, addField3, addFieldAmt3) {
		if (chkBox.checked) {
			enableField(addField1,"");
			enableField(addField2,"");
			enableField(addField3,"");
			field.value = price.toFixed(2);
		}
		else if (chkBox.checked == false) {
			disableField(addField1,"");
			disableField(addField2,"");
			disableField(addField3,"");
			field.value = "";
			addField1.checked = false;
			addFieldAmt1.value = "";
			addField2.checked = false;
			addFieldAmt2.value = "";
			addField3.checked = false;
			addFieldAmt3.value = "";
		}
		addTotal();
	}
	function addProductStates(chkBox, qty, addBtn, field, price, statePrice, num) {
		if (chkBox.checked) {
			enableField(qty, addBtn);
			field.value = price.toFixed(2);
		}
		else if (chkBox.checked == false) {
			disableField(qty, addBtn);
			field.value = "";
			statePrice.value = "";
			addBtn.value = "add";
			qty.value = "";
			hideError(num);
		}
		addTotal();
	}
	function changeBtnText(field, btn) {
		if (field.value > 0) {
			btn.value = "update";
		}
		else if (field.value == 0 || "") {
			btn.value = "add";
		}
	}
	
	function displayError(num) {
		var pId = "errorText" + num;
		document.getElementById(pId).style.display = "block";
	}
	function hideError(num) {
		var pId = "errorText" + num;
		document.getElementById(pId).style.display = "none";
	}
	function maximumStates(field, qty, num) {
		if (field.value > parseInt(qty)) {
			displayError(num);
			field.value = 0;
			field.select();
			return false;
		}
		if (field.value <= parseInt(qty)) {
			hideError(num);
		}
	}
	function numeralsOnly(evt) {
	    evt = (evt) ? evt : event;
	    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : 
	        ((evt.which) ? evt.which : 0));
	    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
	        return false;
	    }
	    return true;
	}	
	
	function callPrint(strid) {
		var prtContent = document.getElementById(strid);
		var WinPrint = window.open('','','left=0,top=0,width=720,height=700,toolbar=0,scrollbars=0,status=0');
		WinPrint.document.write('<link rel="stylesheet" type="text/css" href="/common/styles/lacerteStyle.css" />');
		WinPrint.document.write('<div style="padding-bottom: 5px; margin: 20px; border-bottom: 1px solid black; color: #666666;"><h2>Your Lacerte Software Pricing Estimate</h2></div>');
		WinPrint.document.write(prtContent.innerHTML);
		WinPrint.document.close();
		WinPrint.focus();
		WinPrint.print();
		WinPrint.close();
	//	prtContent.innerHTML=strid;
	}	