function calculate() {
	    // Get the user's input from the form. Assume it is all valid.
	    var wattage = document.ecalc.wattage.value;
	    var hours = document.ecalc.hours.value;
	    
	    //Set the rate.
	    //changed APR 7/10 - previously .10
	    var rate = .1157;

	    // Compute the kWh.
	    var dailykWh = (wattage * hours / 1000);

	    // Check that the result is a finite number. If so, display the results
	    if (!isNaN(dailykWh) && 
	        (dailykWh != Number.POSITIVE_INFINITY) &&
	        (dailykWh != Number.NEGATIVE_INFINITY)) {

	        document.ecalc.kWh.value = numberFormat(round(dailykWh));
	        document.ecalc.daily.value = numberFormat(round(dailykWh * rate));
	        document.ecalc.monthly.value = numberFormat(round(dailykWh * rate * 30.4));
	        document.ecalc.annual.value = numberFormat(round(dailykWh * rate * 365));
	    }
	    // Otherwise, the user's input was probably invalid, so don't
	    // display anything.
	    else {
	        document.ecalc.kWh.value = "";
	        document.ecalc.daily.value = "";
	        document.ecalc.monthly.value = "";
	        document.ecalc.annual.value = "";
	    }
	}

	// Ensure that each number printed as a string 
	// is in 0.00 format
	function numberFormat(amount) {
		var rawNumStr = round(amount) + '';
		rawNumStr = (rawNumStr.charAt(0) == '.' ? '0' + rawNumStr : rawNumStr);
		if (rawNumStr.charAt(rawNumStr.length - 3) == '.') {
			return rawNumStr
			}
		else if (rawNumStr.charAt(rawNumStr.length - 2) == '.') {
			return rawNumStr + '0';
			}
		else { return rawNumStr + '.00'; }
		}

	// Round all passed numbers to two 
	// decimal places (hundredths place)
	function round(number,decPlace) {
		decPlace = (!decPlace ? 2 : decPlace);
		return Math.round(number * Math.pow(10,decPlace)) / Math.pow(10,decPlace);
	}
