//Copyright Best Foot Forward Limited. YOU ARE NOT ALLOWED TO COPY PART OR ALL OF CODE

//Version: SW LIFE. Updated April 2005 using UK as Default and SW as the second country option (SGA Model 25E - SW May 2004.xls)

//ERROR FOUND: started with default (6.3). changed to waste high (7.9) went back to average //- got 7.2 not 6.3!
// This error was caused by incorrect default values for electricity and heating, 
//which had not been divided by the number of people in the house, so were too high.  Now corrected.

//The Scotland version of Lifestyle //Stepwise is on the web at http://www.bestfootforward.com/footprintlife_scotland.htm and //DOES NOT have this error.

//Generic factors - UK & SOUTH WEST (LPR02)
var numEarthshare = 1.9  // 1.77 land only CHANGED
var numEarthshareBio = 1.9 // CHANGED
var numPlanets = 0
var numTotalEF = 0.00
var numTotalAcreEF = 0.00
var numPeople = 1  //default number per household

myPix = new Array("pics/blank.gif", "pics/leftplanet.gif", "pics/rightplanet.gif")


//            Default = UK FACTORS - NEW

var numEconomy = 1.58 //correction to accord with EF of Nations - CHANGE OR DELETE - 1.397 - 1.84 - 1.4
// numEconomy is a factor which brings the total obtained from the average EFs up to the 
// known total: it factors in non-domestic waste and services spending.
// Therefore it applies equally regardless of other EFs: the person lives in a large or small
// economy of which they have a share regardless of how they live.
var numTravelEF = 0.57 // CHANGED TO UK Transport Energy EF minus Construction
var numHolsEF = 0.25 // CHANGED: 1000km air = 0.16 + hotel 14 nights = 0.093 (BASIC Air = 0.12 (731 pkm))
var numElectricityEF = 0.23 // CHANGED to UK elec EF
var numHeatingEF = 0.38 // CHANGED - All UK energy EF minus electricity EF
var numWasteEF = 0.91 // CHANGED to UK Goods Total: was '441 * 0.0027'
var numFoodEF = 1.55 // CHANGED to UK
//var numPeople = 1
//travel (ha): "I travel mostly by..."
var numCaraverageEF = 0.42 // CHANGED to UK
var numCarhighEF = 0.50 // CHANGED 20% higher than average - same method as previous
var numCarlowEF = 0.34 // CHANGED 20% lower than average - same method as previous
var numBustrainEF = 0.02 // CHANGED to UK
var numWalkcycleEF = 0.00 // CHANGED
var numMotorbikeEF = 0.003 // CHANGED to UK
//holiday (ha): "I usually holiday .... To home"
var numcloseEF = 0.12 // CHANGED: 500km * car EF/pass km = 0.022 + hotel 14 nights = 0.093
var numshortEF = 0.25 // CHANGED: 1000km air = 0.16 + hotel 14 nights = 0.093
var numlongEF = 1.77 // CHANGED: 10000km air = 1.60 + luxury hotel 14 nights = 0.165
//heating: EF = factor1 * factor2 * factor3 /p (number of people in house)
//heating (multiplier) factor1 - "I like my home to be..."
var numCoolEF = 0.15 // CHANGED used same method as original (/default by 5 and * 2)
var numWarmEF = 0.38 // CHANGED to match default heating
var numHotEF = 0.61 // CHANGED used same method as original (/default by 5 and * 8)
//heating (multiplier) factor2 - size of bills (relates to insulation)
var numBillhigh = 1.4 // UNCHANGED assumed to be % of heating EFS above
var numBillavg = 1 // UNCHANGED assumed to be % of heating EFS above
var numBilllow = 0.6 // UNCHANGED assumed to be % of heating EFS above
//heating factor3 (ha) - type of house
//adjusted average ECI figure for m2 gas by house sizes
var numlargeEF = 0.38 * 1.25 // CHANGED - variation (unchanged) on heating EF
var nummediumEF = 0.38 // CHANGED - variation (unchanged) on heating EF
var numsmallEF = 0.38 * 0.75 // CHANGED - variation (unchanged) on heating EF
var numflatEF = 0.38 * 0.5 // CHANGED - variation (unchanged) on heating EF
//electricity: EF = factor1 * factor2 divide by number of people
//electric (ha) factor1
var numRenewEF = 0.00
var numNonrenewEF = 0.23 // CHANGED to UK electricity EF 
//electric (multiplier) factor2
var numConserve = 0.6 // UNCHANGED energy saving factor
var numNoconserve = 1 // UNCHANGED energy saving factor
//food EF = factor1+factor2
//food factor1 (ha): food miles
var numLocalEF = 0.01 //locally grown - UNCHANGED cannot determine original calculation method
var numMixEF = 0.03 //average - UNCHANGED cannot determine original calculation method
var numConvEF = 0.15 //high processing and food miles - UNCHANGED cannot determine original calculation method
//food factor2 (ha): diet
var numVeganEF = 0.67 // CHANGED - used same proportions as previous (43% of normal)
var numVegetarianEF = 0.71 // CHANGED - used same proportions as previous (46% of normal)
var numMeatlightEF = 1.33 // CHANGED - used same proportions as previous (86% of normal)
var numMeatnormalEF = 1.55 // CHANGED to UK Food EF
var numMeatheavyEF = 1.92 // CHANGED - used same proportions as previous (124% of normal)
//waste EF = factor1 * factor2
//waste factor1 (ha): amount of waste
//DETR 97/98 kg then mulitpled by hi/lo weighting factors

// changed for SW calculator: new method now from Scotland
// instead of total waste, now using average waste footprint, increased or decreased for heavy or light.
// recycling factor is the improvement as a proportion of the average, based on scenario work
// non-recycling factor is just 1 to reflect current situation

var numWastehighEF = 0.91 * 1.4 // CHANGED kg waste per cap to UK (SGA DATA - ERROR?) but kept adjustment
var numWasteavgEF =  0.91 // CHANGED kg waste per cap to UK (SGA DATA - ERROR?) but kept adjustment
var numWastelowEF = 0.91 * 0.6 // CHANGED kg waste per cap to UK (SGA DATA - ERROR?) but kept adjustment
//  waste factor2 (multiplier): recycle or not
//  EF's per kg of recycled and non-recycled waste
//var numRecycle = 0.64  //=0.58/0.91
var numRecycle = 0.58/0.91
var numNorecycle = 1


//var numWastehighEF = 480 * 1.4 // CHANGED kg waste per cap to UK (SGA DATA - ERROR?) but kept adjustment
//var numWasteavgEF =  480 // CHANGED kg waste per cap to UK (SGA DATA - ERROR?) but kept adjustment
//var numWastelowEF = 480 * 0.6 // CHANGED kg waste per cap to UK (SGA DATA - ERROR?) but kept adjustment
//waste factor2 (multiplier): recycle or not
//EF's per kg of recycled and non-recycled waste
//var numRecycle = 0.45 // CHANGED to UK goods EF * 21% (% of goods EF recycled waste is for Scot (0.43/2.01) - see above)
//var numNorecycle = 0.67 // CHANGED to UK goods EF * 32% (% of goods EF base case waste is for Scot (0.64/2.01) - see above)


//UK FACTORS - NEW
//General
var numEUEconomy = 1.58 //correction to accord with EF of Nations - CHANGE OR DELETE - 1.397 - 1.84 - 1.4
var numEUTravelEF = 0.57 // CHANGED TO UK Transport Energy EF minus Construction
var numEUHolsEF = 0.25 // CHANGED: 1000km air = 0.16 + hotel 14 nights = 0.093 (BASIC Air = 0.12 (731 pkm))
var numEUElectricityEF = 0.23 // CHANGED to UK elec EF
var numEUHeatingEF = 0.38 // CHANGED - All UK energy EF minus electricity EF
var numEUWasteEF = 0.91 // CHANGED to UK Goods Total: was '441 * 0.0027'
var numEUFoodEF = 1.55 // CHANGED to UK
//var numEUPeople = 1
//travel (ha): "I travel mostly by..."
var numEUCaraverageEF = 0.42 // CHANGED to UK
var numEUCarhighEF = 0.50 // CHANGED 20% higher than average - same method as previous
var numEUCarlowEF = 0.34 // CHANGED 20% lower than average - same method as previous
var numEUBustrainEF = 0.02 // CHANGED to UK
var numEUWalkcycleEF = 0.00 // CHANGED
var numEUMotorbikeEF = 0.003 // CHANGED to UK
//holiday (ha): "I usually holiday .... To home"
var numEUcloseEF = 0.12 // CHANGED: 500km * car EF/pass km = 0.022 + hotel 14 nights = 0.093
var numEUshortEF = 0.25 // CHANGED: 1000km air = 0.16 + hotel 14 nights = 0.093
var numEUlongEF = 1.77 // CHANGED: 10000km air = 1.60 + luxury hotel 14 nights = 0.165
//heating: EF = factor1 * factor2 * factor3 /p (number of people in house)
//heating (multiplier) factor1 - "I like my home to be..."
var numEUCoolEF = 0.15 // CHANGED used same method as original (/default by 5 and * 2)
var numEUWarmEF = 0.38 // CHANGED to match default heating
var numEUHotEF = 0.61 // CHANGED used same method as original (/default by 5 and * 8)
//heating (multiplier) factor2 - size of bills (relates to insulation)
var numEUBillhigh = 1.4 // UNCHANGED assumed to be % of heating EFS above
var numEUBillavg = 1 // UNCHANGED assumed to be % of heating EFS above
var numEUBilllow = 0.6 // UNCHANGED assumed to be % of heating EFS above
//heating factor3 (ha) - type of house
//adjusted average ECI figure for m2 gas by house sizes
var numEUlargeEF = 0.38 * 1.25 // CHANGED - variation (unchanged) on heating EF
var numEUmediumEF = 0.38 // CHANGED - variation (unchanged) on heating EF
var numEUsmallEF = 0.38 * 0.75 // CHANGED - variation (unchanged) on heating EF
var numEUflatEF = 0.38 * 0.5 // CHANGED - variation (unchanged) on heating EF
//electricity: EF = factor1 * factor2 divide by number of people
//electric (ha) factor1
var numEURenewEF = 0.00
var numEUNonrenewEF = 0.23 // CHANGED to UK electricity EF 
//electric (multiplier) factor2
var numEUConserve = 0.6 // UNCHANGED energy saving factor
var numEUNoconserve = 1 // UNCHANGED energy saving factor
//food EF = factor1+factor2
//food factor1 (ha): food miles
var numEULocalEF = 0.01 //locally grown - UNCHANGED cannot determine original calculation method
var numEUMixEF = 0.03 //average - UNCHANGED cannot determine original calculation method
var numEUConvEF = 0.15 //high processing and food miles - UNCHANGED cannot determine original calculation method
//food factor2 (ha): diet
var numEUVeganEF = 0.67 // CHANGED - used same proportions as previous (43% of normal)
var numEUVegetarianEF = 0.71 // CHANGED - used same proportions as previous (46% of normal)
var numEUMeatlightEF = 1.33 // CHANGED - used same proportions as previous (86% of normal)
var numEUMeatnormalEF = 1.55 // CHANGED to UK Food EF
var numEUMeatheavyEF = 1.92 // CHANGED - used same proportions as previous (124% of normal)
//waste EF = factor1 * factor2
//waste factor1 (ha): amount of waste
//DETR 97/98 kg then mulitpled by hi/lo weighting factors
var numEUWastehighEF = 0.91 * 1.4 // CHANGED kg waste per cap to UK (SGA DATA - ERROR?) but kept adjustment
var numEUWasteavgEF =  0.91 // CHANGED kg waste per cap to UK (SGA DATA - ERROR?) but kept adjustment
var numEUWastelowEF = 0.91 * 0.6 // CHANGED kg waste per cap to UK (SGA DATA - ERROR?) but kept adjustment
//waste factor2 (multiplier): recycle or not
//EF's per kg of recycled and non-recycled waste
var numEURecycle = 0.64 //=0.58/0.91 CHANGED to UK goods EF * 21% (% of goods EF recycled waste is for Scot (0.43/2.01) - see above)
var numEUNorecycle = 1 // CHANGED to UK goods EF * 32% (% of goods EF base case waste is for Scot (0.64/2.01) - see above)


//            South West Factors
var numSWEconomy = 1.52 //correction to accord with EF of Nation - CHANGED = 1.58 - 1.41
var numSWTravelEF = 0.58 // CHANGED
var numSWHolsEF = 0.25 // UNCHANGED: 1000km air = 0.16 + hotel 14 nights = 0.093 (BASIC Air = 0.09 (539 pkm))
var numSWElectricityEF = 0.36 // CHANGED - Electricity EF
var numSWHeatingEF = 0.36 // CHANGED - All energy EF minus electricity EF
var numSWWasteEF = 0.76 // CHANGED - Goods Total
var numSWFoodEF = 1.63 // CHANGED

//REF: Spreadsheet for creating lifestyle stepwise factors from Regional Stepwise model.xls //in SGA/Lifestyle Stepwise

var numSWCaraverageEF = 0.45 // CHANGED
var numSWCarhighEF = 0.54 // CHANGED
var numSWCarlowEF = 0.36 // CHANGED
var numSWBustrainEF = 0.04 // CHANGED
var numSWWalkcycleEF = 0.00 // CHANGED
var numSWMotorbikeEF = 0.003 // CHANGED
var numSWcloseEF = 0.12 // UNCHANGED: 500km * car EF/pass km = 0.022 + hotel 14 nights = 0.093
var numSWshortEF = 0.25 // UNCHANGED: 1000km air = 0.16 + hotel 14 nights = 0.093
var numSWlongEF = 1.77 // UNCHANGED: 10000km air = 1.60 + luxury hotel 14 nights = 0.165
var numSWCoolEF = 0.28 // CHANGED 
var numSWWarmEF = 0.71 // CHANGED
var numSWHotEF = 1.14 // CHANGED
var numSWBillhigh = 1.4 // UNCHANGED assumed to be % of heating EFS above
var numSWBillavg = 1 // UNCHANGED assumed to be % of heating EFS above
var numSWBilllow = 0.6 // UNCHANGED assumed to be % of heating EFS above
var numSWlargeEF = 0.34 * 1.25 // CHANGED - variation (unchanged) on heating EF
var numSWmediumEF = 0.71 // CHANGED - variation (unchanged) on heating EF
var numSWsmallEF = 0.71 * 0.75 // CHANGED - variation (unchanged) on heating EF
var numSWflatEF = 0.71 * 0.5 // CHANGED - variation (unchanged) on heating EF
var numSWRenewEF = 0.00 // CHANGED
var numSWNonrenewEF = 0.36 // CHANGED - electricity EF 
var numSWConserve = 0.6 // UNCHANGED
var numSWNoconserve = 1 // UNCHANGED
var numSWLocalEF = 0.01 //locally grown - UNCHANGED
var numSWMixEF = 0.03 //average - UNCHANGED
var numSWConvEF = 0.15 //high processing and food miles - UNCHANGED
var numSWVeganEF = 0.70 // CHANGED - used same proportions as previous (43% of normal)
var numSWVegetarianEF = 0.75 // CHANGED - used same proportions as previous (46% of normal)
var numSWMeatlightEF = 1.40 // CHANGED - used same proportions as previous (86% of normal)
var numSWMeatnormalEF = 1.63 // CHANGED Food EF
var numSWMeatheavyEF = 2.02 // CHANGED - used same proportions as previous (124% of normal)
var numSWWastehighEF = 0.76 * 1.4 // CHANGED kg waste per cap to Scot but kept adjustment
var numSWWasteavgEF =  0.76 // CHANGED to average Scot kg per cap
var numSWWastelowEF = 0.76 * 0.6 // CHANGED kg waste per cap to Scot but kept adjustment
var numSWRecycle = 0.45/0.76 //CHANGED
//var numSWRecycle = 0.59  //=0.45/0.76 CHANGED
var numSWNorecycle = 1 // CHANGED




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 planetbar(ef) {
//displays planet bar
ef = ef++

document.planet1A.src = myPix[0]
document.planet1B.src = myPix[0]
document.planet2A.src = myPix[0]
document.planet2B.src = myPix[0]
document.planet3A.src = myPix[0]
document.planet3B.src = myPix[0]
document.planet4A.src = myPix[0]
document.planet4B.src = myPix[0]
document.planet5A.src = myPix[0]
document.planet5B.src = myPix[0]
document.planet6A.src = myPix[0]
document.planet6B.src = myPix[0]
document.planet7A.src = myPix[0]
document.planet7B.src = myPix[0]
document.planet8A.src = myPix[0]
document.planet8B.src = myPix[0]
document.planet9A.src = myPix[0]
document.planet9B.src = myPix[0]
document.planet10A.src = myPix[0]
document.planet10B.src = myPix[0]
document.planet11A.src = myPix[0]
document.planet11B.src = myPix[0]
document.planet12A.src = myPix[0]
document.planet12B.src = myPix[0]
document.planet13A.src = myPix[0]
document.planet13B.src = myPix[0]
document.planet14A.src = myPix[0]
//document.planet14B.src = myPix[0]


if (ef >= 0.25) { document.planet1A.src = myPix[1] }
if (ef >= 0.75) { document.planet1B.src = myPix[2] }
if (ef >= 1.25) { document.planet2A.src = myPix[1] }
if (ef >= 1.75) { document.planet2B.src = myPix[2] }
if (ef >= 2.25) { document.planet3A.src = myPix[1] }
if (ef >= 2.75) { document.planet3B.src = myPix[2] }
if (ef >= 3.25) { document.planet4A.src = myPix[1] }
if (ef >= 3.75) { document.planet4B.src = myPix[2] }
if (ef >= 4.25) { document.planet5A.src = myPix[1] }
if (ef >= 4.75) { document.planet5B.src = myPix[2] }
if (ef >= 5.25) { document.planet6A.src = myPix[1] }
if (ef >= 5.75) { document.planet6B.src = myPix[2] }
if (ef >= 6.25) { document.planet7A.src = myPix[1] }
if (ef >= 6.75) { document.planet7B.src = myPix[2] }
if (ef >= 7.25) { document.planet8A.src = myPix[1] }
if (ef >= 7.75) { document.planet8B.src = myPix[2] }
if (ef >= 8.25) { document.planet9A.src = myPix[1] }
if (ef >= 8.75) { document.planet9B.src = myPix[2] }
if (ef >= 9.25) { document.planet10A.src = myPix[1] }
if (ef >= 9.75) { document.planet10B.src = myPix[2] }
if (ef >= 10.25) { document.planet11A.src = myPix[1] }
if (ef >= 10.75) { document.planet11B.src = myPix[2] }
if (ef >= 11.25) { document.planet12A.src = myPix[1] }
if (ef >= 11.75) { document.planet12B.src = myPix[2] }
if (ef >= 12.25) { document.planet13A.src = myPix[1] }
if (ef >= 12.75) { document.planet13B.src = myPix[2] }
if (ef >= 13.25) { document.planet14A.src = myPix[1] }



	return true
}

function roundit(data) {
	if (data == 0) return 0
	n = Math.abs(data)
// determine data magnitude
	mag = 1
	if ( n >= 1) {
		while ( ( n / mag ) >= 10 ) mag = mag * 10
	}  else {
		while ( ( n / mag) <= 0.1 ) mag = mag / 10
		mag /= 10
	}
	mult = 1000 / mag
// round it and restore its magnitude
	return ( Math.round (data *mult ) / mult)
}


function calcTotalEF(theForm){
numTotalEF =  numTravelEF + numHolsEF + numHeatingEF + numFoodEF + numElectricityEF + numWasteEF

var i = theForm.strBio.selectedIndex
if (i == 0) {numEarthshareBio = numEarthshare}
if (i == 1) {numEarthshareBio = 1.87}
if (i == 2) {numEarthshareBio = 1.60}
if (i == 3) {numEarthshareBio = 1.28}


numTotalEF = numTotalEF * numEconomy
numPlanets = numTotalEF/numEarthshareBio
numPlanets = roundit(numPlanets)
numTotalAcreEF = numTotalEF * 2.47
numTotalAcreEF = roundit(numTotalAcreEF)
numTotalEF = roundit(numTotalEF)
numTotalEF = Math.round(numTotalEF * 10)/10
numTotalAcreEF = Math.round(numTotalAcreEF * 10)/10
numPlanets = Math.round(numPlanets * 10) / 10

theForm.strResponse.value = "Your ecological footprint is estimated to be " + numTotalEF + " hectares (" + numTotalAcreEF + " acres)."
theForm.strResponse.value += "\rIf everyone in the World lived lived like you we would need " + numPlanets 

if (numPlanets == 1) {
theForm.strResponse.value += " Planet to support global consumption."
} else {
theForm.strResponse.value += " Planets to support global consumption."
}

//debug code
//theForm.strResponse.value += "Travel: " + numTravelEF
//theForm.strResponse.value += "Hols: " + numHolsEF
//theForm.strResponse.value += "Heating: " + numHeatingEF
//theForm.strResponse.value += "Food: " + numFoodEF
//theForm.strResponse.value += "Electric: " + numElectricityEF
//theForm.strResponse.value += "Waste: " + numWasteEF

planetbar(numPlanets)
	return true

}

function calcCountryEF(theForm){
var i = theForm.strCountry.selectedIndex

//if (i == 0 || i==2) {   // removing country 3 because only SW & UK
if (i == 0) {
//Europe
numTravelEF = numEUTravelEF
numHolsEF = numEUHolsEF
numElectricityEF = numEUElectricityEF
numHeatingEF = numEUHeatingEF
numWasteEF = numEUWasteEF
numFoodEF = numEUFoodEF
//numPeople = numEUPeople

numEconomy = numEUEconomy

numCaraverageEF = numEUCaraverageEF
numCarhighEF = numEUCarhighEF
numCarlowEF = numEUCarlowEF
numBustrainEF = numEUBustrainEF
numWalkcycleEF = numEUWalkcycleEF
numMotorbikeEF = numEUMotorbikeEF
numcloseEF = numEUcloseEF
numshortEF = numEUshortEF
numlongEF = numEUlongEF

numCoolEF = numEUCoolEF
numWarmEF = numEUWarmEF
numHotEF = numEUHotEF
numBillhigh = numEUBillhigh
numBillavg = numEUBillavg
numBilllow = numEUBilllow

numlargeEF = numEUlargeEF
nummediumEF = numEUmediumEF
numsmallEF = numEUsmallEF
numflatEF = numEUflatEF

numRenewEF = numEURenewEF
numNonrenewEF = numEUNonrenewEF

numConserve = numEUConserve
numNoconserve = numEUNoconserve

numLocalEF = numEULocalEF
numMixEF = numEUMixEF
numConvEF = numEUConvEF

numVeganEF = numEUVeganEF
numVegetarianEF = numEUVegetarianEF
numMeatlightEF = numEUMeatlightEF
numMeatnormalEF = numEUMeatnormalEF
numMeatheavyEF = numEUMeatheavyEF

numWastehighEF = numEUWastehighEF
numWasteavgEF =  numEUWasteavgEF 
numWastelowEF = numEUWastelowEF
numRecycle = numEURecycle
numNorecycle = numEUNorecycle
	} 
/////////////////////////////////////////////

//  South West

if (i==1) {
numTravelEF = numSWTravelEF
numHolsEF = numSWHolsEF
numElectricityEF = numSWElectricityEF
numHeatingEF = numSWHeatingEF
numWasteEF = numSWWasteEF
numFoodEF = numSWFoodEF
//numPeople = numSWPeople

numEconomy = numSWEconomy

numCaraverageEF = numSWCaraverageEF
numCarhighEF = numSWCarhighEF
numCarlowEF = numSWCarlowEF
numBustrainEF = numSWBustrainEF
numWalkcycleEF = numSWWalkcycleEF
numMotorbikeEF = numSWMotorbikeEF
numcloseEF = numSWcloseEF
numshortEF = numSWshortEF
numlongEF = numSWlongEF
numCoolEF = numSWCoolEF
numWarmEF = numSWWarmEF
numHotEF = numSWHotEF
numBillhigh = numSWBillhigh
numBillavg = numSWBillavg
numBilllow = numSWBilllow

numlargeEF = numSWlargeEF
nummediumEF = numSWmediumEF
numsmallEF = numSWsmallEF
numflatEF = numSWflatEF

numRenewEF = numSWRenewEF
numNonrenewEF = numSWNonrenewEF
numConserve = numSWConserve
numNoconserve = numSWNoconserve

numLocalEF = numSWLocalEF
numMixEF = numSWMixEF
numConvEF = numSWConvEF
numVeganEF = numSWVeganEF
numVegetarianEF = numSWVegetarianEF
numMeatlightEF = numSWMeatlightEF
numMeatnormalEF = numSWMeatnormalEF
numMeatheavyEF = numSWMeatheavyEF

numWastehighEF = numSWWastehighEF
numWasteavgEF =  numSWWasteavgEF 
numWastelowEF = numSWWastelowEF
numRecycle = numSWRecycle
numNorecycle = numSWNorecycle
	}
	
//if (i==2) { //Australia fudge - based on limited data profile appears to be most like EU
//numEconomy = 1.88
//}

calcTravelEF(theForm)
calcWasteEF(theForm)
calcElectricEF(theForm)
calcHeatingEF(theForm)
calcHolsEF(theForm)
calcFoodEF(theForm)

//calcTotalEF(theForm)

	return true
}

function calcTravelEF(theForm){
	var factor

	var i = theForm.strTravel.selectedIndex
	if (i == 0) {
		factor = numCaraverageEF //car average
} else if (i == 1) {
		factor = numCarhighEF //bus train
} else if (i == 2) {
		factor = numCarlowEF //bus train
	} else if (i == 3) {
		factor = numBustrainEF //bus train
	} else if (i == 4) {
		factor = numWalkcycleEF //walking cycling
	} else {
		factor = numMotorbikeEF //motorbike
	}
	
	numTravelEF = factor
	
	calcTotalEF(theForm)
	return true
}

function calcFoodEF(theForm){
	var factor1
  	var factor2


	var i = theForm.strFood.selectedIndex
	if (i == 0) {
		factor1 = numMixEF //mix
	} else if (i == 1) {
		factor1 = numLocalEF //fresh
	} else  {
		factor1 = numConvEF //convenience
	} 
var i = theForm.strDiet.selectedIndex
	if (i == 0) {
		factor2 = numVeganEF //vegan
	} else if (i == 1) {
		factor2 = numVegetarianEF //veggy
} else if (i == 2) {
		factor2 = numMeatlightEF //some meat
} else if (i == 3) {
		factor2 = numMeatnormalEF //normal meat
	} else  {
		factor2 = numMeatheavyEF //heavy meat
	} 
	
	numFoodEF = factor1 + factor2
 
//numFoodEF = 0	

	calcTotalEF(theForm)
	return true
}


function calcHolsEF(theForm){
	var factor

	var i = theForm.strHols.selectedIndex
	if (i == 0) {
		factor = numcloseEF //close to home
	} else if (i == 1) {
		factor = numshortEF //short haul
	} else  {
		factor = numlongEF //long haul
	}
	
	numHolsEF = factor
//numHolsEF =0
	calcTotalEF(theForm)
	return true
}

function calcHeatingEF(theForm){
	var factor
	var factor2
var factor3
var i
var j
var numP
	i = 0
	//i = theForm.strTemp.selectedIndex
	if (i == 0) {
		factor = numCoolEF //same as
	} else if (i == 1) {
		factor = numWarmEF //hotter or cooler than
	} else  {
		factor = numHotEF //much hotter or cooler than
	}
	
factor = 1 //fudge to take out question
	
i = theForm.strBills.selectedIndex
	if (i == 0) {
		factor2 = numBillavg //normal
	} else if (i == 1) {
		factor2 = numBillhigh //high
	} else  {
		factor2 = numBilllow //low
	}

	i = theForm.strHouse.selectedIndex
	if (i == 0) {
		factor3 = numlargeEF //large house
	} else if (i == 1) {
		factor3 = nummediumEF //medium house
} else if (i == 2) {
		factor3 = numsmallEF //small house

	} else  {
		factor3 = numflatEF //flat
	}

	j = theForm.strPeople.selectedIndex 
if (j == 0) {
		numPeople = 1
} else if (j == 1) {
		numPeople = 2
} else if (j == 2) {
		numPeople = 3
} else if (j == 3) {
		numPeople = 4
} else if (j == 4) {
		numPeople = 5
} else if (j == 5) {
		numPeople = 6
	} else  {
		numPeople = 7 
	}

	numHeatingEF = factor * factor2 * factor3
	numHeatingEF = numHeatingEF / numPeople

//	numHeatingEF = numHeatingEF

        calcElectricEF(theForm)
//test line below     
//   numHeatingEF = 0

	calcTotalEF(theForm)
	return true
}

function calcElectricEF(theForm){
	var factor
	var factor2
	
	var i = theForm.strRenewable.selectedIndex
	if (i == 0) {
		factor = numNonrenewEF //non-renewable
	} else {
		factor = numRenewEF //renewable
	} 
	
	var i = theForm.strConserve.selectedIndex
	if (i == 0) {
		factor2 = numNoconserve //no conserve
	} else  {
		factor2 = numConserve //conserve
	}


	j = theForm.strPeople.selectedIndex 
if (j == 0) {
		numPeople = 1
} else if (j == 1) {
		numPeople = 2
} else if (j == 2) {
		numPeople = 3
} else if (j == 3) {
		numPeople = 4
} else if (j == 4) {
		numPeople = 5
} else if (j == 5) {
		numPeople = 6
	} else  {
		numPeople = 7 
	}

	numElectricityEF = factor * factor2 / numPeople

	calcTotalEF(theForm)
	return true
}

function calcWasteEF(theForm){
	var factor
	var factor2
	
	var i = theForm.strWaste.selectedIndex
	if (i == 0) {
		factor = numWasteavgEF //average
	} else if (i == 1) {
		factor = numWastelowEF //below
	} else  {
		factor = numWastehighEF //above
	}
	
	var i = theForm.strRecycle.selectedIndex
	if (i == 0) {
		factor2 = numNorecycle //no recycle
	} else {
		factor2 = numRecycle //recycle
	}

	numWasteEF = factor * factor2
//        numWasteEF = numWasteEF

//numWasteEF = 0

	calcTotalEF(theForm)
	return true
}

