<!--hide
//
//COEFFICIENTS
//***all tons are metric***
//useFactorElectric = useFactorBusinessElectric = useFactorSquareFootKWH = 0.00061 - number of CO2 tons per kWh [CarbonFund states 0.000606 tons/kWh]
//useFactorGas = useFactorBusinessGas = 0.00530 - number of CO2 tons per Therm [California Energy Efficiency states 0.005298 tons/therm]
//useFactorOil = useFactorBusinessOil = 0.01017 - number of CO2 tons per gallon of heating oil [CarbonFund states 22.384 lb/gallon]
//useFactorVehicle = 0.00882 - number of CO2 tons per gallon of gasoline [EPA states 19.4 lb per gallon]
//useFactorEventVehicle = 0.00035 - number of CO2 tons per mile in average vehicle - 25mi/gallon [EPA states 19.4 lb per gallon]
//useFactorAir = useFactorBusinessAir = useFactorEventAir = 0.00029 - number of CO2 tons per mile on commercial carrier [CarbonFund states 0.6393 lb/mi]
//Following are from CarbonFund's Online Business Footprint Calculator
//useFactorSquareFoot = useFactorEventSquareFoot = 0.00812 - number of CO2 tons per square foot per year for 0-1000
//useFactorSquareFoot = useFactorEventSquareFoot = 0.00900 - number of CO2 tons per square foot per year for 1000-5000
//useFactorSquareFoot = useFactorEventSquareFoot = 0.00600 - number of CO2 tons per square foot per year for 5000-10,000
//useFactorSquareFoot = useFactorEventSquareFoot = 0.00606 - number of CO2 tons per square foot per year for 10,000-25,000
//useFactorSquareFoot = useFactorEventSquareFoot = 0.00733 - number of CO2 tons per square foot per year for 25,000-50,000
//useFactorSquareFoot = useFactorEventSquareFoot = 0.00818 - number of CO2 tons per square foot per year for 50,000-100,000
//useFactorSquareFoot = useFactorEventSquareFoot = 0.00909 - number of CO2 tons per square foot per year for 100,000-200,000
//useFactorSquareFoot = useFactorEventSquareFoot = 0.00982 - number of CO2 tons per square foot per year for 200,000-500,000
//useFactorSquareFoot = useFactorEventSquareFoot = 0.00988 - number of CO2 tons per square foot per year for 500,000+
//
function validate(data){
for ( var i = 0; i < data.length; i++){
var digit = data.charAt(i)
if ((digit < "0" || digit > "9") && digit != "."){
return false
}
}
return true
}
function calcTotalPersonalCarbon(theForm){
var numTotalCarbon = parseFloat(theForm.strHouseCarbon.value);
numTotalCarbon += parseFloat(theForm.strVehicleCarbon.value);
numTotalCarbon += parseFloat(theForm.strAirCarbon.value);
theForm.strTotalPersonalCarbon.value = numTotalCarbon.toFixed(0)
return true
}
function calcHouseCarbon(theForm){
var useFactorElectric = 0.00061 //number of CO2 tons per kWh
var useFactorGas = 0.00530 //number of CO2 tons per Therm
var useFactorOil = 0.01017 //number of CO2 tons per gallon of heating oil
if (validate(theForm.strElectricKWH.value) == false) return false
if (validate(theForm.strElectricKWH.value) == "") theForm.strElectricKWH.value = 0
var numElectricCarbon = (theForm.strElectricKWH.value * useFactorElectric)
if (validate(theForm.strGasTherms.value) == false) return false
if (validate(theForm.strGasTherms.value) == "") theForm.strGasTherms.value = 0
var numGasCarbon = (theForm.strGasTherms.value * useFactorGas)
if (validate(theForm.strOilGals.value) == false) return false
if (validate(theForm.strOilGals.value) == "") theForm.strOilGals.value = 0
var numOilCarbon = (theForm.strOilGals.value * useFactorOil)
var numHouseCarbon = numElectricCarbon + numGasCarbon + numOilCarbon
theForm.strHouseCarbon.value = numHouseCarbon.toFixed(2)
calcTotalPersonalCarbon(theForm)
return true
}
function calcVehicleCarbon(theForm){
var useFactorVehicle = 0.00882 //number of CO2 tons per gallon of gasoline
if (validate(theForm.strVehicle1Miles.value) == false) return false
if (theForm.strVehicle1Miles.value == "") theForm.strVehicle1Miles.value = 0
if (validate(theForm.strVehicle1Mileage.value) == false) return false
if (theForm.strVehicle1Mileage.value == "") theForm.strVehicle1Mileage.value = 0
var numVehicle1Gallons = (theForm.strVehicle1Miles.value / theForm.strVehicle1Mileage.value)
var numVehicle1Carbon = (numVehicle1Gallons * useFactorVehicle)
if (validate(theForm.strVehicle2Miles.value) == false) return false
if (theForm.strVehicle2Miles.value == "") theForm.strVehicle2Miles.value = 0
if (validate(theForm.strVehicle2Mileage.value) == false) return false
if (theForm.strVehicle2Mileage.value == "") theForm.strVehicle2Mileage.value = 0
var numVehicle2Gallons = (theForm.strVehicle2Miles.value / theForm.strVehicle2Mileage.value)
var numVehicle2Carbon = (numVehicle2Gallons * useFactorVehicle)
var numVehicleCarbon = numVehicle1Carbon + numVehicle2Carbon
theForm.strVehicleCarbon.value = numVehicleCarbon.toFixed(2)
calcTotalPersonalCarbon(theForm)
return true
}
function calcAirCarbon(theForm){
var useFactorAir = 0.00029 //number of CO2 tons per mile on commercial carrier
if (validate(theForm.strAirMiles.value) == false)return false
if (theForm.strAirMiles.value == "") theForm.strAirMiles.value = 0
var numAirCarbon = (theForm.strAirMiles.value * useFactorAir)
theForm.strAirCarbon.value = numAirCarbon.toFixed(2)
calcTotalPersonalCarbon(theForm)
return true
}
function calcTotalBusinessCarbon(theForm){
if (theForm.strSquareFootCarbon.value != 0 && theForm.strBusinessCarbon.value != 0) {
var numTotalBusinessCarbon = parseFloat(theForm.strBusinessCarbon.value);
numTotalBusinessCarbon += parseFloat(theForm.strBusinessAirCarbon.value);
theForm.strTotalBusinessCarbon.value = numTotalBusinessCarbon.toFixed(0)
}
else {
var numTotalBusinessCarbon = parseFloat(theForm.strSquareFootCarbon.value);
numTotalBusinessCarbon += parseFloat(theForm.strBusinessCarbon.value);
numTotalBusinessCarbon += parseFloat(theForm.strBusinessAirCarbon.value);
theForm.strTotalBusinessCarbon.value = numTotalBusinessCarbon.toFixed(0)
}
return true
}
function calcBusinessSquareFootCarbon(theForm){
if (validate(theForm.strSquareFoot.value) == false)return false
if (theForm.strSquareFoot.value == "") theForm.strSquareFoot.value = 0
if (theForm.strSquareFoot.value >= 0 && theForm.strSquareFoot.value <= 1000) {
var useFactorSquareFoot = 0.00812 //number of CO2 tons per square foot
}
else if (theForm.strSquareFoot.value > 1000 && theForm.strSquareFoot.value <= 5000) {
var useFactorSquareFoot = 0.00900 //number of CO2 tons per square foot
}
else if (theForm.strSquareFoot.value > 5000 && theForm.strSquareFoot.value <= 10000) {
var useFactorSquareFoot = 0.00600 //number of CO2 tons per square foot
}
else if (theForm.strSquareFoot.value > 10000 && theForm.strSquareFoot.value <= 25000) {
var useFactorSquareFoot = 0.00606 //number of CO2 tons per square foot
}
else if (theForm.strSquareFoot.value > 25000 && theForm.strSquareFoot.value <= 50000) {
var useFactorSquareFoot = 0.00733 //number of CO2 tons per square foot
}
else if (theForm.strSquareFoot.value > 50000 && theForm.strSquareFoot.value <= 100000) {
var useFactorSquareFoot = 0.00818 //number of CO2 tons per square foot
}
else if (theForm.strSquareFoot.value > 100000 && theForm.strSquareFoot.value <= 200000) {
var useFactorSquareFoot = 0.00909 //number of CO2 tons per square foot
}
else if (theForm.strSquareFoot.value > 200000 && theForm.strSquareFoot.value <= 500000) {
var useFactorSquareFoot = 0.00982 //number of CO2 tons per square foot
}
else if (theForm.strSquareFoot.value > 500000) {
var useFactorSquareFoot = 0.00988 //number of CO2 tons per square foot per month
}
else {
var useFactorSquareFoot = 0
}
var useFactorSquareFootKWH = 0.00061 //number of CO2 tons per kWh
var numSquareFootCarbon = (theForm.strSquareFoot.value * useFactorSquareFoot)
theForm.strSquareFootCarbon.value = numSquareFootCarbon.toFixed(2)
var numSquareFootCarbonKWH = (numSquareFootCarbon / useFactorSquareFootKWH)
theForm.strSquareFootKWH.value = numSquareFootCarbonKWH.toFixed(2)
calcTotalBusinessCarbon(theForm)
return true
}
function calcBusinessCarbon(theForm){
var useFactorBusinessElectric = 0.00061 //number of CO2 tons per kWh
var useFactorBusinessGas = 0.00530 //number of CO2 tons per Therm
var useFactorBusinessOil = 0.01017 //number of CO2 tons per gallon of heating oil
if (validate(theForm.strBusinessElectricKWH.value) == false) return false
if (validate(theForm.strBusinessElectricKWH.value) == "") theForm.strBusinessElectricKWH.value = 0
var numBusinessElectricCarbon = (theForm.strBusinessElectricKWH.value * useFactorBusinessElectric)
if (validate(theForm.strBusinessGasTherms.value) == false) return false
if (validate(theForm.strBusinessGasTherms.value) == "") theForm.strBusinessGasTherms.value = 0
var numBusinessGasCarbon = (theForm.strBusinessGasTherms.value * useFactorBusinessGas)
if (validate(theForm.strBusinessOilGals.value) == false) return false
if (validate(theForm.strBusinessOilGals.value) == "") theForm.strBusinessOilGals.value = 0
var numBusinessOilCarbon = (theForm.strBusinessOilGals.value * useFactorBusinessOil)
var numBusinessCarbon = numBusinessElectricCarbon + numBusinessGasCarbon + numBusinessOilCarbon
theForm.strBusinessCarbon.value = numBusinessCarbon.toFixed(2)
calcTotalBusinessCarbon(theForm)
return true
}
function calcBusinessAirCarbon(theForm){
var useFactorBusinessAir = 0.00029 //number of CO2 tons per mile on commercial carrier
if (validate(theForm.strBusinessAirMiles.value) == false)return false
if (theForm.strBusinessAirMiles.value == "") theForm.strBusinessAirMiles.value = 0
var numBusinessAirCarbon = (theForm.strBusinessAirMiles.value * useFactorBusinessAir)
theForm.strBusinessAirCarbon.value = numBusinessAirCarbon.toFixed(2)
calcTotalBusinessCarbon(theForm)
return true
}
function calcTotalEventCarbon(theForm){
var numTotalEventCarbon = parseFloat(theForm.strEventSquareFootCarbon.value);
numTotalEventCarbon += parseFloat(theForm.strEventTravelCarbon.value);
theForm.strTotalEventCarbon.value = numTotalEventCarbon.toFixed(0)
return true
}
function calcEventSquareFootCarbon(theForm){
if (validate(theForm.strEventSquareFoot.value) == false)return false
if (theForm.strEventSquareFoot.value == "") theForm.strEventSquareFoot.value = 0
if (theForm.strEventSquareFoot.value >= 0 && theForm.strEventSquareFoot.value <= 1000) {
var useFactorEventSquareFoot = 0.00812 //number of CO2 tons per square foot
}
else if (theForm.strEventSquareFoot.value > 1000 && theForm.strEventSquareFoot.value <= 5000) {
var useFactorEventSquareFoot = 0.00900 //number of CO2 tons per square foot
}
else if (theForm.strEventSquareFoot.value > 5000 && theForm.strEventSquareFoot.value <= 10000) {
var useFactorEventSquareFoot = 0.00600 //number of CO2 tons per square foot
}
else if (theForm.strEventSquareFoot.value > 10000 && theForm.strEventSquareFoot.value <= 25000) {
var useFactorEventSquareFoot = 0.00606 //number of CO2 tons per square foot
}
else if (theForm.strEventSquareFoot.value > 25000 && theForm.strEventSquareFoot.value <= 50000) {
var useFactorEventSquareFoot = 0.00733 //number of CO2 tons per square foot
}
else if (theForm.strEventSquareFoot.value > 50000 && theForm.strEventSquareFoot.value <= 100000) {
var useFactorEventSquareFoot = 0.00818 //number of CO2 tons per square foot
}
else if (theForm.strEventSquareFoot.value > 100000 && theForm.strEventSquareFoot.value <= 200000) {
var useFactorEventSquareFoot = 0.00909 //number of CO2 tons per square foot
}
else if (theForm.strEventSquareFoot.value > 200000 && theForm.strEventSquareFoot.value <= 500000) {
var useFactorEventSquareFoot = 0.00982 //number of CO2 tons per square foot
}
else if (theForm.strEventSquareFoot.value > 500000) {
var useFactorEventSquareFoot = 0.00988 //number of CO2 tons per square foot per month
}
else {
var useFactorEventSquareFoot = 0
}
var numEventYearlySquareFootCarbon = (theForm.strEventSquareFoot.value * useFactorEventSquareFoot)
var numEventHourlySquareFootCarbon = (numEventYearlySquareFootCarbon / 2000)
if (validate(theForm.strEventDurationDays.value) == false)return false
if (theForm.strEventDurationDays.value == "") theForm.strEventDurationDays.value = 0
if (validate(theForm.strEventDurationHours.value) == false)return false
if (theForm.strEventDurationHours.value == "") theForm.strEventDurationHours.value = 0
var numEventDurationHours = ((theForm.strEventDurationDays.value * 8) + theForm.strEventDurationHours.value)
var numEventSquareFootCarbon = (numEventHourlySquareFootCarbon * numEventDurationHours)
theForm.strEventSquareFootCarbon.value = numEventSquareFootCarbon.toFixed(2)
calcTotalEventCarbon(theForm)
return true
}
function calcEventTravelCarbon(theForm){
var useFactorEventVehicle = 0.00035 //number of CO2 tons per mile in average vehicle - 25mi/gallon
var useFactorEventAir = 0.00029 //number of CO2 tons per mile on commercial carrier
if (validate(theForm.strEventVehicleTravelPeople.value) == false)return false
if (theForm.strEventVehicleTravelPeople.value == "") theForm.strEventVehicleTravelPeople.value = 0
if (validate(theForm.strEventVehicleTravelMiles.value) == false)return false
if (theForm.strEventVehicleTravelMiles.value == "") theForm.strEventVehicleTravelMiles.value = 0
if (validate(theForm.strEventAirTravelPeople.value) == false)return false
if (theForm.strEventAirTravelPeople.value == "") theForm.strEventAirTravelPeople.value = 0
if (validate(theForm.strEventAirTravelMiles.value) == false)return false
if (theForm.strEventAirTravelMiles.value == "") theForm.strEventAirTravelMiles.value = 0
var numEventVehicleTravelCarbon = (theForm.strEventVehicleTravelPeople.value * theForm.strEventVehicleTravelMiles.value * useFactorEventVehicle)
var numEventAirTravelCarbon = (theForm.strEventAirTravelPeople.value * theForm.strEventAirTravelMiles.value * useFactorEventAir)
var numEventTravelCarbon = (numEventVehicleTravelCarbon + numEventAirTravelCarbon)
theForm.strEventTravelCarbon.value = numEventTravelCarbon.toFixed(2)
calcTotalEventCarbon(theForm)
return true
}
//STOP HIDING-->