// This function is called every time a key is pressed in the input field.
		function calcValue() 
		{
			var salaryStr = document.calculator.salary.value;
			var hoursStr = document.calculator.hours.value * 2;
			var outputTotal, outputDeduction;
			
			// Reset the result fields every time (in case next character entered makes the value no longer a number, we'd want the fields to display 0.00).
			document.calculator.result.value="0.00";
			document.calculator.deduction.value="0.00";
			
			//Remove only a single dollar sign from the hourly wage field, if it exists
			if (salaryStr.indexOf("$") != -1)
				salaryStr = salaryStr.replace(["$"], "");
			
			// Check to see if the comma-stripped version is still a number.
			if (!isNaN(salaryStr) && !isNaN(hoursStr)) {
				// Resets the background color if it previously indicated an error.
				document.calculator.salary.style.backgroundColor = '';
				document.calculator.hours.style.backgroundColor = '';
				
				//Make the calculations with the selected percent.		
				outputTotal = (salaryStr * hoursStr * 26) * document.calculator.Percent.value;
				outputDeduction = outputTotal / 26;
				
				//Output the results fixed to 2 decimal places.
				document.calculator.result.value=outputTotal.toFixed(2);
				document.calculator.deduction.value=outputDeduction.toFixed(2);
				
			// If there is an input error, highlight the appropriate field with a red background to indicate a problem.
			} else if (isNaN(salaryStr)) {
				document.calculator.salary.style.backgroundColor = '#c64b4b';
			} else if (isNaN(hoursStr)) {
				document.calculator.hours.style.backgroundColor = '#c64b4b';
			}

		}