function updatePrices(f, userAction) {
	switch (f.name) {

		case "n_s_topper_form":
			// Must have dynamically generated prices.
			if (!(nst instanceof Array) || !(cov instanceof Array)) return false;

			// Mattress topper.
			var sz = f.size.value;
			var th = f.thickness.value;
			var fm = f.firmness.value;
			var pr = nst[ sz - 1 ][ th - 1 ][ fm - 1 ];
			// Valid value.
			if (pr > 0) {
				divReplace("nSTopperPrice", monify(pr));
			} else {
				var newValue = "";
				if (userAction) {
					// Get adjusted thickness.
					var adjTh = f.thickness.options[f.thickness.selectedIndex].text;
					var c = adjTh.indexOf('"');
					if (c > -1) {
						adjTh = adjTh.substring(0, c);
					} else {
						adjTh = "";
					}
					if ((th != 3) && (fm != 1) && (adjTh.length > 0)) {
						alert("The " + adjTh + "\" toppers are only available in Soft." + "\n(Visit our clearance section to order a " + adjTh + "\" " + f.firmness.options[f.firmness.selectedIndex].text + " topper.)");
						f.firmness.selectedIndex = 0;
						fm = f.firmness.value;
						pr = nst[ sz - 1 ][ th - 1 ][ fm - 1 ];
						if (pr > 0) newValue = monify(pr);
					} else {
						alert("This combination of size, thickness, and firmness is not available.\nPlease choose another combination.");
					}
				}
				divReplace("nSTopperPrice", newValue);
			}

			// Cover.
			var cv = f.cover_type.value;
			pr = 0;
			if (cv > 0) {
				pr = cov[ cv - 1 ][ sz - 1 ];
			}
			// Valid value.
			if (pr > 0) {
				divReplace("nSCoverPrice", monify(pr));
			} else {
				divReplace("nSCoverPrice", "");
				f.cover_type.selectedIndex = 0;
			}
			break;

		case "memory_topper_form":
			// Must have dynamically generated prices.
			if (!(mft instanceof Array) || !(cov instanceof Array)) return false;

			// Mattress topper.
			var sz = f.size.value;
			var th = f.thickness.value;
			var dn = f.firmness.value;
			var pr = mft[ sz - 1 ][ th - 1 ][ dn - 1 ];
			// Valid value.
			if (pr > 0) {
				divReplace("mFTopperPrice", monify(pr));
			} else {
				var newValue = "";
				if (userAction) {
					if ((dn == 1) && ((th < 2) || (th > 3))) {
						alert("The 3-lb density topper is only available in 2\" and 3\".");
						f.thickness.selectedIndex = (th < 2 ? 1 : 2);
						th = f.thickness.value;
						pr = mft[ sz - 1 ][ th - 1 ][ dn - 1 ];
						if (pr > 0) newValue = monify(pr);
					} else {
						alert("This combination of size, thickness, and density is not available.\nPlease choose another combination.");
					}
				}
				divReplace("mFTopperPrice", newValue);
			}

			// Cover.
			var cv = f.cover_type.value;
			pr = 0;
			if (cv > 0) {
				pr = cov[ cv - 1 ][ sz - 1 ];
			}
			// Valid value.
			if (pr > 0) {
				divReplace("mFCoverPrice", monify(pr));
			} else {
				divReplace("mFCoverPrice", "");
				f.cover_type.selectedIndex = 0;
			}
			break;

		case "wool_puddle_form":
			// Must have dynamically generated prices.
			if (!(wpp instanceof Array)) return false;

			// Mattress topper.
			var sz = f.size.value;
			var th = f.thickness.value;
			var pr = wpp[ sz - 1 ][ th - 1 ];
			// Valid value.
			if (pr > 0) {
				divReplace("wpPadPrice", monify(pr));
			} else {
				divReplace("wpPadPrice", "");
				if (userAction) {
					alert("This combination of size and thickness is not available.\nPlease choose another combination.");
				}
			}
			break;

		case "wool_topper_form":
			// Must have dynamically generated prices.
			if (!(wtp instanceof Array)) return false;

			// Mattress topper.
			var sz = f.size.value;
			var th = f.thickness.value;
			var pr = wtp[ sz - 1 ][ th - 1 ];
			// Valid value.
			if (pr > 0) {
				divReplace("wTopperPrice", monify(pr));
			} else {
				divReplace("wTopperPrice", "");
				if (userAction) {
					alert("This combination of size and thickness is not available.\nPlease choose another combination.");
				}
			}
			break;

	}
	return true;
}
