systfuel = new Array (6)
sysunits = new Array (6)

whichsyst = 1
var systload = ""


function start(){
	systload = document.st.sl.value
	document.house.heatload.value = document.st.sl.value
	whichsyst = document.st.WS.value

	systfuel[1] = document.st.F1.value
	systfuel[2] = document.st.F2.value
	systfuel[3] = document.st.F3.value
	systfuel[4] = document.st.F4.value
	systfuel[5] = document.st.F5.value

	sysunits[1] =  document.st.U1.value
	sysunits[2] =  document.st.U2.value
	sysunits[3] =  document.st.U3.value
	sysunits[4] =  document.st.U4.value
	sysunits[5] =  document.st.U5.value
	whichsyst = 1 * whichsyst
	setsyst(whichsyst)
}

function justnum(){
var valcha = "0123456789."
var test
var tempprice, tempeff


test = "" + systload
  if (test == ""){
    alert( "The value of the heating load is not a number please check your inputs and press the \"CALCULATE HEATING LOAD\" button.")
return
	}

	for ( count = 0; count < test.length; count++){
	  cha = test.charAt(count)
		if (valcha.indexOf(cha) == -1){
			  alert( "The value of the heating load is not a number please check your inputs and press the  \"CALCULATE HEATING LOAD\" button.")
			 return
			}

       }


tempprice   = "" +  document.st.P1.value
tempeff = "" + document.st.E1.value
var ind

if ( (document.st.F1.value != 4) &&((tempprice == "") || (tempeff == ""))){
	alert("The first system entered lacks the unit price for energy and/or lacks the system's AFUE.")
	return
}



	if (systfuel[1] != 4){

		for (count = 0; count < tempprice.length; count++){

			cha = tempprice.charAt(count)
			if(valcha.indexOf(cha) == -1){
				alert("The first system entered has an invalid value for the energy unit cost.\nPlease check it.")
				return
			}
		}
			for (count = 0; count < tempeff.length; count++){
			cha = tempeff.charAt(count)
			if(valcha.indexOf(cha) == -1){
				alert("The first system entered has an invalid value for the system AFUE.\nPlease check it.")
				return
			}


		}
	}



	ind = (1* systfuel[1])
if (((ind == 0) || (ind ==1)||(ind ==3)) && (( 1* tempprice) > 2)  ) {
	alert("Unit costs for energy sources must be entered in dollars. For example, \"20 cents\" should be expressed as \"0.20\".")
	return
	}



if ((ind ==2) && (document.st.U1.value != 6) && (( 1* tempprice) > 2) ){
alert("For the first system entered, you have either forgotten to change the units to dollars per gigajoule, or entered the unit price in cents per cubic metre instead of dollars per cubic metre.")
return
 }











tempprice   = "" +  document.st.P2.value
tempeff = "" + document.st.E2.value
if ( (document.st.F2.value != 4) &&((tempprice == "") || (tempeff == ""))){
	alert("The second system entered lacks the unit price for energy and/or lacks the system's AFUE.")
	return
}



	if (systfuel[2] != 4){
		for (count = 0; count < tempprice.length; count++){
			cha = tempprice.charAt(count)
			if(valcha.indexOf(cha) == -1){
				alert("The second system entered has an invalid value for the energy unit cost.\nPlease check it.")
				return
			}
		}
			for (count = 0; count < tempeff.length; count++){
			cha = tempeff.charAt(count)
			if(valcha.indexOf(cha) == -1){
				alert("The second system entered has an invalid value for the system AFUE.\nPlease check it.")
				return
			}


		}
	}



	ind = (1* systfuel[2])
if (((ind == 0) || (ind ==1)||(ind ==3)) && (( 1* tempprice) > 2)  ) {
	alert("Unit costs for energy sources must be entered in dollars. For example, \"20 cents\" should be expressed as \"0.20\".")
	return
	}



if ((ind ==2) && (document.st.U2.value != 6) && (( 1* tempprice) > 2) ){
alert("For the second system entered, you have either forgotten to change the units to dollars per gigajoule, or entered the unit price in cents per cubic metre instead of dollars per cubic metre.")
return
 }




tempprice   = "" +  document.st.P3.value
tempeff = "" + document.st.E3.value

if ( (document.st.F3.value != 4) &&((tempprice == "") || (tempeff == ""))){
	alert("The third system entered lacks the unit price for energy and/or lacks the system's AFUE.")
	return
}


	if (systfuel[3] != 4){
		for (count = 0; count < tempprice.length; count++){
			cha = tempprice.charAt(count)
			if(valcha.indexOf(cha) == -1){
				alert("The third system entered has an invalid value for the energy unit cost.\nPlease check it.")
				return
			}
		}
			for (count = 0; count < tempeff.length; count++){
			cha = tempeff.charAt(count)
			if(valcha.indexOf(cha) == -1){
				alert("The third system entered has an invalid value for the system AFUE.\nPlease check it.")
				return
			}


		}
	}



	ind = (1* systfuel[3])
if (((ind == 0) || (ind ==1)||(ind ==3)) && (( 1* tempprice) > 2)  ) {
	alert("Unit costs for energy sources must be entered in dollars. For example, \"20 cents\" should be expressed as \"0.20\".")
	return
	}



if ((ind ==2) && (document.st.U3.value != 6) && (( 1* tempprice) > 2) ){
alert("For the third system entered, you have either forgotten to change the units to dollars per gigajoule, or entered the unit price in cents per cubic metre instead of dollars per cubic metre.")
return
 }




tempprice   = "" +  document.st.P4.value
tempeff = "" + document.st.E4.value

if ( (document.st.F4.value != 4) &&((tempprice == "") || (tempeff == ""))){
	alert("The fourth system entered lacks the unit price for energy and/or lacks the system's AFUE.")
	return
}


	if (systfuel[4] != 4){
		for (count = 0; count < tempprice.length; count++){
			cha = tempprice.charAt(count)
			if(valcha.indexOf(cha) == -1){
				alert("The fourth system entered has an invalid value for the energy unit cost.\nPlease check it.")
				return
			}
		}
			for (count = 0; count < tempeff.length; count++){
			cha = tempeff.charAt(count)
			if(valcha.indexOf(cha) == -1){
				alert("The fourth system entered has an invalid value for the system AFUE.\nPlease check it.")
				return
			}


		}
	}


	ind = (1* systfuel[4])
if (((ind == 0) || (ind ==1)||(ind ==3)) && (( 1* tempprice) > 2)  ) {
	alert("Unit costs for energy sources must be entered in dollars. For example, \"20 cents\" should be expressed as \"0.20\".")
	return
	}



if ((ind ==2) && (document.st.U4.value != 6) && (( 1* tempprice) > 2) ){
alert("For the fourth system entered, you have either forgotten to change the units to dollars per gigajoule, or entered the unit price in cents per cubic metre instead of dollars per cubic metre.")
return
 }




tempprice   = "" +  document.st.P5.value
tempeff = "" + document.st.E5.value

if ( (document.st.F5.value != 4) &&((tempprice == "") || (tempeff == ""))){
	alert("The fifth system entered lacks the unit price for energy and/or lacks the system's AFUE.")
	return
}



	if (systfuel[5] != 4){
		for (count = 0; count < tempprice.length; count++){
			cha = tempprice.charAt(count)
			if(valcha.indexOf(cha) == -1){
				alert("The fifth system entered has an invalid value for the energy unit cost.\nPlease check it.")
				return
			}
		}
			for (count = 0; count < tempeff.length; count++){
			cha = tempeff.charAt(count)
			if(valcha.indexOf(cha) == -1){
				alert("The fifth system entered has an invalid value for the system AFUE.\nPlease check it.")
				return
			}


		}
	}



	ind = (1* systfuel[5])
if (((ind == 0) || (ind ==1)||(ind ==3)) && (( 1* tempprice) > 2)  ) {
	alert("Unit costs for energy sources must be entered in dollars. For example, \"20 cents\" should be expressed as \"0.20\".")
	return
	}



if ((ind ==2) && (document.st.U5.value != 6) && (( 1* tempprice) > 2) ){
alert("For the fifth system entered, you have either forgotten to change the units to dollars per gigajoule, or entered the unit price in cents per cubic metre instead of dollars per cubic metre.")
return
 }




calculate()

}






function back(){
	whichsyst = 1
	systload = ""
	document.st.WS.value ="1"
	document.st.N1.value = "Enter a name to help you identify the first system."
	document.st.N2.value = "Enter a name to help you identify the second system."
	document.st.N3.value = "Enter a name to help you identify the third system."
	document.st.N4.value = "Enter a name to help you identify the fourth system."
	document.st.N5.value = "Enter a name to help you identify the fifth system."

	document.st.P1.value = ""
	document.st.P2.value = ""
	document.st.P3.value = ""
	document.st.P4.value = ""
	document.st.P5.value = ""

	document.st.E1.value = ""
	document.st.E2.value = ""
	document.st.E3.value = ""
	document.st.E4.value = ""
	document.st.E5.value = ""

	document.st.F1.value = "4"
	document.st.F2.value = "4"
	document.st.F3.value = "4"
	document.st.F4.value = "4"
	document.st.F5.value = "4"

	document.st.U1.value = "3"
	document.st.U2.value = "3"
	document.st.U3.value = "3"
	document.st.U4.value = "3"
	document.st.U5.value = "3"

	document.house.heatload.value  = ""
	document.st.sl.value = "3"
	for (var i=0 ;i<=5;i++){

		systfuel[i] = 4
		sysunits[i] = 3
	}
	setsyst(1)

}

function calcload(){
var ancost, uncost, encont, seaseff, heatload, temp,temp2
ancost = document.house.oldcost.value
uncost = document.house.oldunitcst.value
seaseff = document.house.oldsyseff.value
systload = ""
document.house.heatload.value = systload
if (document.house.ynwater[0].checked){
withwater()
}else if (document.house.oldfuel.selectedIndex == 3){
uncost = document.st.gascost.value
heatload = (ancost * 37.5 * seaseff) / (uncost * 100000)
temp =  heatload / 10
	temp2 = Math.floor(temp)
	temp = temp - temp2
	if (temp >= 0.75){
		heatload = ((temp2 +1) * 10 )
		}else if ((temp >=  0.25) && (temp  < 0.75)) {
		heatload = ((temp2 * 10) + 5)
		 }else {
		heatload  = (temp2 * 10)
		}

systload = heatload
document.st.sl.value = systload
document.house.heatload.value = systload
}else if (document.house.oldfuel.selectedIndex == 0){
	heatload = (ancost * 38.2 * seaseff) / (uncost * 100000)
temp =  heatload / 10
	temp2 = Math.floor(temp)
	temp = temp - temp2
	if (temp >= 0.75){
		heatload = ((temp2 +1) * 10 )
		}else if ((temp >=  0.25) && (temp  < 0.75)) {
		heatload = ((temp2 * 10) + 5)
		 }else {
		heatload  = (temp2 * 10)
		}

	systload = heatload
	document.st.sl.value = systload
	document.house.heatload.value = systload
}else if (document.house.oldfuel.selectedIndex == 1){
	ancost = ancost - (uncost * 8760)
	heatload = (ancost * 3.6 * seaseff) / (uncost * 100000)
	temp =  heatload / 10
	temp2 = Math.floor(temp)
	temp = temp - temp2
	if (temp >= 0.75){
		heatload = ((temp2 +1) * 10 )
		}else if ((temp >=  0.25) && (temp  < 0.75)) {
		heatload = ((temp2 * 10) + 5)
		 }else {
		heatload  = (temp2 * 10)
		}

	systload =  heatload
	document.st.sl.value = systload
	document.house.heatload.value = systload
	}else if (document.house.oldfuel.selectedIndex == 4){
	heatload = (ancost * 25.3 * seaseff) / (uncost * 100000)
temp =  heatload / 10
	temp2 = Math.floor(temp)
	temp = temp - temp2
	if (temp >= 0.75){
		heatload = ((temp2 +1) * 10 )
		}else if ((temp >=  0.25) && (temp  < 0.75)) {
		heatload = ((temp2 * 10) + 5)
		 }else {
		heatload  = (temp2 * 10)
		}
	systload = heatload
	document.st.sl.value = systload
	document.house.heatload.value = systload
	}

}

function withwater() {
var ancost, uncost, encont, seaseff, heatload, watercost,temp,temp2
ancost = document.house.oldcost.value
uncost = document.house.oldunitcst.value
seaseff = document.house.oldsyseff.value
var q = 0
var lit = 0
var  oc = 0
var c = 4190
var delt = 52
var w = 0

if (document.house.people.selectedIndex  < 4){
oc = (document.house.people.selectedIndex + 1)
   }else{
oc = (document.house.people.selectedIndex )
}

lit = (( 85 + (oc * 35)) * 365)


q = (c * lit * delt)/1000000

 if (document.house.oldfuel.selectedIndex == 0) {
		w = q/0.53
		w = w /38.2
			temp = w*10
	temp2 = Math.floor(temp)
	w = temp2 / 10

		water = (uncost * w)
		ancost = (ancost - water)

	heatload = (ancost * 38.2 * seaseff) / (uncost * 100000)
	temp =  heatload / 10
	temp2 = Math.floor(temp)
	temp = temp - temp2
	if (temp >= 0.75){
		heatload = ((temp2 +1) * 10 )
		}else if ((temp >=  0.25) && (temp  < 0.75)) {
		heatload = ((temp2 * 10) + 5)
		 }else {
		heatload  = (temp2 * 10)
		}
	systload = heatload
	document.st.sl.value = systload
	document.house.heatload.value = systload
  }



  if (document.house.oldfuel.selectedIndex == 3) {
uncost = document.st.gascost.value

	w = q/0.57
		w = w /37.5
			temp = w*10
	temp2 = Math.floor(temp)
	w = temp2 / 10


		water = (uncost * w)
		ancost = (ancost - water)

	heatload = (ancost * 37.5 * seaseff) / (uncost * 100000)
	temp =  heatload / 10
	temp2 = Math.floor(temp)
	temp = temp - temp2
	if (temp >= 0.75){
		heatload = ((temp2 +1) * 10 )
		}else if ((temp >=  0.25) && (temp  < 0.75)) {
		heatload = ((temp2 * 10) + 5)
		 }else {
		heatload  = (temp2 * 10)
		}

	systload = heatload
	document.st.sl.value = systload
	document.house.heatload.value = systload
  }

if (document.house.oldfuel.selectedIndex == 1){

			w = q/0.82
		w = w /3.6
			temp = w*10
	temp2 = Math.floor(temp)
	w = temp2 / 10




		ancost = ancost - ( (uncost * 8760) + (uncost *w) )
		heatload = (ancost * 3.6 * seaseff) / (uncost * 100000)
	temp =  heatload / 10
	temp2 = Math.floor(temp)
	temp = temp - temp2
	if (temp >= 0.75){
		heatload = ((temp2 +1) * 10 )
		}else if ((temp >=  0.25) && (temp  < 0.75)) {
		heatload = ((temp2 * 10) + 5)
		 }else {
		heatload  = (temp2 * 10)
		}
		systload =  heatload
		document.st.sl.value = systload
		document.house.heatload.value = systload


	}



  if (document.house.oldfuel.selectedIndex == 4) {

		w = q/0.57
		w = w /25.3
			temp = w*10
	temp2 = Math.floor(temp)
	w = temp2 / 10

		water = (uncost * w)
		ancost = (ancost - water)

	heatload = (ancost * 25.3 * seaseff) / (uncost * 100000)
	temp =  heatload / 10
	temp2 = Math.floor(temp)
	temp = temp - temp2
	if (temp >= 0.75){
		heatload = ((temp2 +1) * 10 )
		}else if ((temp >=  0.25) && (temp  < 0.75)) {
		heatload = ((temp2 * 10) + 5)
		 }else {
		heatload  = (temp2 * 10)
		}

	systload = heatload
	document.st.sl.value = systload
	document.house.heatload.value = systload
  }



}



function chnunprice() {
if ( document.house.oldunits.selectedIndex == 4    ){
 var t = document.house.oldunitcst.value
                 t = ((t * 37.5)/1000)
               document.st.gascost.value = t
}else{
document.st.gascost.value = document.house.oldunitcst.value
}

}


function directload(){
  	 systload = document.house.heatload.value
	document.st.sl.value = systload
      }


function chkoldun() {
var valcha = "0123456789."
if (document.house.oldfuel.selectedIndex == 3){
  if(document.house.oldunits.selectedIndex == 2 ) {
     chnunprice()
  }else if  (document.house.oldunits.selectedIndex == 4){
var tempuncst = "" +  document.house.oldunitcst.value
		for (count = 0; count <tempuncst.length; count++){
			cha = tempuncst.charAt(count)
			if(valcha.indexOf(cha) == -1){
				alert("The entry for your energy unit cost is not a number.\nPlease check it.")
				return
			}
	}
               var t = document.house.oldunitcst.value
                 t = ((t * 37.5)/1000)
               document.st.gascost.value = t
             }else {
                       alert("Natural gas  is sold in dollars per cubic metre or dollars per gigajoule.  If your costs are in dollars per gigajoule select the appropriate units.")
			document.house.oldunits.selectedIndex = 2
			return
                      }

} else if((document.house.oldfuel.selectedIndex == 0 ) && (document.house.oldunits.selectedIndex != 0)) {

     alert("Please enter the price for oil in dollars per litre.")
     document.house.oldunits.selectedIndex = 0
}else if ((document.house.oldfuel.selectedIndex == 1 ) && (document.house.oldunits.selectedIndex != 1)){
          alert("Please enter the price for electricity in dollars per kilowatt hour.")
          document.house.oldunits.selectedIndex = 1

}else if ((document.house.oldfuel.selectedIndex == 2 ) && (document.house.oldunits.selectedIndex != 3)){
          alert("Please select an energy source before selecting the units.")
         document.house.oldunits.selectedIndex = 3
       }else if ((document.house.oldfuel.selectedIndex == 4 ) && (document.house.oldunits.selectedIndex != 0)){
          alert("Please enter the price of propane in dollars per lit.")
         document.house.oldunits.selectedIndex = 0
       }



}

function gasunits(unprice,fuel){

var fprice  = unprice
var wfuel = systfuel[fuel]
 var wunits = sysunits[fuel]
if (wfuel == 2 ) {
      if(wunits == 2){
        return(fprice)
           }else if (wunits == 6){
             fprice =  (( fprice * 37.5)/1000)
             return (fprice)
         }else {
                 alert("This program cannot use these units for the selected energy source.\n Please check system number " + fuel +".")
                   return(fprice)
                  }
  }else {
         return(fprice)
         }
}




function checkimp() {
var testq, cont
cont = document.house.oldcost.value

var tempcst = ""  +  document.house.oldcost.value
var valcha = "0123456789."
var cha

	for (count = 0; count < tempcst.length; count++){
			cha = tempcst.charAt(count)
			if(valcha.indexOf(cha) == -1){
				alert("The entry for the total annual heating cost is not a number.\nPlease check it.")
				return
			}
	}

if(tempcst == "" )
{
alert(" Please check the annual  energy cost that has been entered.")
return
}else if( (cont > 9998 )){
alert(" Please check the annual  energy cost that has been entered.")
return
}

if ( document .house.oldfuel.selectedIndex == 2) {
alert ("Please select an energy source first.")
return
}


if ( document .house.oldunits.selectedIndex == 3 ){
alert ("Please select the appropriate units.")
return
}

cont = document.house.oldunitcst.value

var tempuncst = "" +  document.house.oldunitcst.value
for (count = 0; count <tempuncst.length; count++){
			cha = tempuncst.charAt(count)
			if(valcha.indexOf(cha) == -1){
				alert("The entry for your energy unit cost is not a number.\nPlease check it.")
				return
			}
	}


if((cont == "") )
{
alert(" Please check the energy unit cost that has been entered.")
return
}else if( (cont > 1000 ) || (cont == "")){
alert(" Please check the energy unit cost that has been entered.")
return
}
if((( document.house.oldfuel.selectedIndex == 0)||(document.house.oldfuel.selectedIndex == 1)||(document.house.oldfuel.selectedIndex == 3) ||(document.house.oldfuel.selectedIndex == 4))&&((1*cont) > 2)){

	if((!(document.house.oldunits.selectedIndex== 4))){
alert("Unit costs for energy sources must be entered in dollars. For example, \"20 cents\" should be expressed as \"0.20\".")
return
	}
}
cont = document.house.oldsyseff.value

var tempeff = "" +document.house.oldsyseff.value
for (count = 0; count <tempeff.length; count++){
			cha = tempeff.charAt(count)
			if(valcha.indexOf(cha) == -1){
				alert("The entry for your old system's AFUE is not a number.\nPlease check it.")
				return
			}
	}



if(cont == "" )
{
alert(" Please check the AFUE that has been entered.")
return
}else if( (cont < 1 ) ||(cont > 100)){
alert(" Please check the AFUE that has been entered.")
return
}

if ( document .house.people.selectedIndex ==4 ){
alert ("Please select the appropriate number of occupants.")
return
}

calcload()
}



function calculate(){

var  temp,temp2,temp3,cha,a,b,c,d,e
temp3 = document.house.heatload.value
cha = temp3.indexOf("?")
a = document.st.F1.value
b =  document.st.F2.value
c =  document.st.F3.value
d = document.st.F4.value
e = document.st.F5.value

if ((a==4)&&(b==4)&&(c==4)&&(d==4)&&(e==4)){
alert("Not enough information for all systems has been provided in order to make a calculation.")
return

}



if(!(cha ==  -1)||!((document.house.heatload.value > 0) && (document.house.heatload.value < 300) )){
       alert( "The heating load is not in the acceptable range.\nPlease check it.")
       return
     }




results = open("","RESULTS_WINDOW","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=620,height=420")
results.document.write("<html>")
results.document.write("<HEADER>")
results.document.write("<title>RESULTS</title>")
results.document.write("</HEADER>")
results.document.write("<body bgcolor='#EAF0F4'>")
results.document.write("<CENTER> <FONT COLOR='#006400'><H2>RESULTS PAGE</H2></FONT></CENTER>")
results.document.write("<table width='600' COLS =2 border= '2' cellspacing='2' cellpadding='2'>")
results.document.write("<tr><th VALIGN ='MIDDLE' > <H3>SYSTEM NAME</H3></th><th VALIGN ='MIDDLE' > <H3>ANNUAL SPACE HEATING COSTS ($)</H3></th></tr>")
results.document.write("<tr><td COLSPAN= '2' > </td></tr>")

      systef = document.st.E1.value
      systuncost = gasunits(document.st.P1.value, 1)



      if(systfuel[1]!= 4 &&  systef >0 && systuncost >0 ){
          fuell = systfuel[1]
          encon = document.house.fuel.options[fuell].value
          systancost = (systuncost/encon) *(systload/systef) *100000

	temp = systancost / 10
	temp2 = Math.floor(temp)
	temp = temp - temp2
	if (temp >= 0.5){
		systancost = ((temp2 +1) * 10 )
		}else {
		systancost  = (temp2 * 10)
		}


          results.document.write("<tr>")
          results.document.write("<td VALIGN = 'MIDDLE'>")
          results.document.write(document.st.N1.value +"</td>")
          results.document.write("<td VALIGN = 'MIDDLE' ALIGN = 'CENTER'>")
          results.document.write( systancost + "</td>")
          results.document.write("</tr>")

    }


      systef = document.st.E2.value

        systuncost = gasunits(document.st.P2.value, 2)
      if(systfuel[2]!= 4 &&  systef >0 && systuncost >0 ){

          fuell = systfuel[2]
          encon = document.house.fuel.options[fuell].value
          systancost = (systuncost/encon) *(systload/systef) *100000
	temp = systancost / 10
	temp2 = Math.floor(temp)
	temp = temp - temp2
	if (temp >= 0.5){
		systancost = ((temp2 +1) * 10 )
		}else {
		systancost  = (temp2 * 10)
		}

          results.document.write("<tr>")
          results.document.write("<td VALIGN = 'MIDDLE'>")
          results.document.write(document.st.N2.value +"</td>")
          results.document.write("<td VALIGN = 'MIDDLE' ALIGN = 'CENTER'>")
          results.document.write( systancost + "</td>")
          results.document.write("</tr>")

    }

      systef = document.st.E3.value
       systuncost = gasunits(document.st.P3.value,3)
      if(systfuel[3]!= 4 &&  systef >0 && systuncost >0 ){

          fuell = systfuel[3]
          encon = document.house.fuel.options[fuell].value
          systancost = (systuncost/encon) *(systload/systef) *100000
          temp = systancost / 10
	temp2 = Math.floor(temp)
	temp = temp - temp2
	if (temp >= 0.5){
		systancost = ((temp2 +1) * 10 )
		}else {
		systancost  = (temp2 * 10)
		}
          results.document.write("<tr>")
          results.document.write("<td VALIGN = 'MIDDLE'>")
          results.document.write(document.st.N3.value +"</td>")
          results.document.write("<td VALIGN = 'MIDDLE' ALIGN = 'CENTER'>")
          results.document.write( systancost + "</td>")
          results.document.write("</tr>")

    }

      systef = document.st.E4.value
      systuncost = gasunits(document.st.P4.value, 4)

      if(systfuel[4]!= 4 &&  systef >0 && systuncost >0 ){

          fuell = systfuel[4]
          encon = document.house.fuel.options[fuell].value
          systancost = (systuncost/encon) *(systload/systef) *100000
          temp = systancost / 10
	temp2 = Math.floor(temp)
	temp = temp - temp2
	if (temp >= 0.5){
		systancost = ((temp2 +1) * 10 )
		}else {
		systancost  = (temp2 * 10)
		}
          results.document.write("<tr>")
          results.document.write("<td VALIGN = 'MIDDLE'>")
          results.document.write(document.st.N4.value +"</td>")
          results.document.write("<td VALIGN = 'MIDDLE' ALIGN = 'CENTER'>")
          results.document.write( systancost + "</td>")
          results.document.write("</tr>")

    }

      systef = document.st.E5.value
      systuncost = gasunits(document.st.P5.value, 5)

      if(systfuel[5]!= 4 &&  systef >0 && systuncost >0 ){

          fuell = systfuel[5]
          encon = document.house.fuel.options[fuell].value
          systancost = (systuncost/encon) *(systload/systef) *100000
          temp = systancost / 10
	temp2 = Math.floor(temp)
	temp = temp - temp2
	if (temp >= 0.5){
		systancost = ((temp2 +1) * 10 )
		}else {
		systancost  = (temp2 * 10)
		}
          results.document.write("<tr>")
          results.document.write("<td VALIGN = 'MIDDLE'>")
          results.document.write(document.st.N5.value +"</td>")
          results.document.write("<td VALIGN = 'MIDDLE' ALIGN = 'CENTER'>")
          results.document.write( systancost + "</td>")
          results.document.write("</tr>")

    }

results.document.write("</table>")
results.document.write("<PRE>Other factors to consider are:");results.document.write("<ul>");results.document.write("                                 <li>the cost of purchasing and maintaining the system;");
results.document.write("                                 <li>the cost of installation;");
results.document.write("                                 <li>the availability of the energy source;");
results.document.write("                                 <li>the time needed for maintenance; and");
results.document.write("                                             <li>environmental factors, such as the quietness of the \nsystem and will it affect air quality.");
results.document.write("</ul></PRE>");


results.document.write("</body>" )
results.document.write("</html>")
results.document.close()


}

function cetunits(){
var f = document.house.oldfuel.selectedIndex
if (f == 0){
document.house.oldunits.selectedIndex = 0
}else if( f == 1) {
document.house.oldunits.selectedIndex = 1
}else if ( f == 2){
document.house.oldunits.selectedIndex = 3
}else if ( f == 3) {
document.house.oldunits.selectedIndex = 2
}else if( f == 4) {
document.house.oldunits.selectedIndex = 0

}

}




function cetef(){
var f = document.house.oldfuel.selectedIndex
if (f == 0){

 oilwino()
}else if( f == 1) {

elecwino()
}else if ( f == 2){
alert("Please select an energy source and try again.")
}else if ( f == 3) {

natwino()

}else if( f == 4) {

 assist5()
}

}




function setunits (){
	var t = document.house.fuel.selectedIndex
	if (t == 0){
		document.house.units.selectedIndex = 0
		if (whichsyst == 1) {
			document.st.U1.value = 0
			sysunits[1] = 0}
		if (whichsyst ==  2) {
			document.st.U2.value = 0
			sysunits[2] = 0}
		if (whichsyst == 3) {
			document.st.U3.value = 0
			sysunits[3] = 0}
		if (whichsyst == 4) {
			document.st.U4.value = 0
			sysunits[4] = 0}
		if (whichsyst == 5) {
			document.st.U5.value = 0
			sysunits[5] = 0}
		}


	if (t == 1){
		document.house.units.selectedIndex = 1
		if (whichsyst == 1) {
			document.st.U1.value = 1
			sysunits[1] = 1}
		if (whichsyst == 2) {
			document.st.U2.value = 1
			sysunits[2] = 1}
		if (whichsyst == 3) {
			document.st.U3.value = 1
			sysunits[3] = 1}
		if (whichsyst == 4) {
			document.st.U4.value = 1
			sysunits[4] = 1}
		if (whichsyst == 5) {
			document.st.U5.value = 1
			sysunits[5] = 1}
		}


	if (t == 2){
		document.house.units.selectedIndex = 2
		if (whichsyst == 1) {
			document.st.U1.value = 2
			sysunits[1] = 2}
		if (whichsyst == 2) {
			document.st.U2.value = 2
			sysunits[2] = 2}
		if (whichsyst == 3) {
			document.st.U3.value = 2
			sysunits[3] = 2}
		if (whichsyst == 4) {
			document.st.U4.value = 2
			sysunits[4] = 2}
		if (whichsyst == 5) {
			document.st.U5.value = 2
			sysunits[5] = 2}

		 alert ("Please enter price for natural gas in  dollars per cubic metre or dollars per gigajoule.")
		}

	if (t == 3){
		document.house.units.selectedIndex = 0
		if (whichsyst == 1) {
			document.st.U1.value = 0
			sysunits[1] = 0}
		if (whichsyst == 2) {
			document.st.U2.value = 0
			sysunits[2] = 0}
		if (whichsyst == 3) {
			document.st.U3.value = 0
			sysunits[3] = 0}
		if (whichsyst == 4) {
			document.st.U4.value = 0
			sysunits[4] = 0}
		if (whichsyst == 5) {
			document.st.U5.value = 0
			sysunits[5] = 0}
		}

	if (t == 4){
		document.house.units.selectedIndex = 3

		if (whichsyst ==1) {
			document.st.U1.value = 3
			sysunits[1] = 3}
		if (whichsyst == 2) {
			document.st.U2.value = 3
			sysunits[2] = 3}
		if (whichsyst == 3) {
			document.st.U3.value = 3
			sysunits[3] = 3}
		if (whichsyst == 4) {
			document.st.U4.value = 3
			sysunits[4] = 3}
		if (whichsyst == 5) {
			document.st.U5.value = 3
			sysunits[5] = 3}
		}

	if (t == 5){
		document.house.units.selectedIndex = 4
		if (whichsyst == 1) {
			document.st.U1.value = 4
			sysunits[1] = 4}
		if (whichsyst == 2) {
			document.st.U2.value = 4
			sysunits[2] = 4}
		if (whichsyst == 3) {
			document.st.U3.value = 4
			sysunits[3] = 4}
		if (whichsyst == 4) {
			document.st.U2.value = 4
			sysunits[4] = 4}
		if (whichsyst == 5) {
			document.st.U2.value = 4
			sysunits[5] = 4}
		}

	if (t == 6){
		document.house.units.selectedIndex = 4
		if (whichsyst == 1) {
			document.st.U1.value = 4
			sysunits[1] = 4}
		if (whichsyst == 2) {
			document.st.U2.value = 4
			sysunits[2] = 4}
		if (whichsyst == 3) {
			document.st.U3.value = 4
			sysunits[3] = 4}
		if (whichsyst == 4) {
			document.st.U4.value = 4
			sysunits[4] = 4}
		if (whichsyst == 5) {
			document.st.U5.value = 4
			sysunits[5] = 4}
		}

	if (t == 7){
		document.house.units.selectedIndex = 5

		if (whichsyst == 1) {
			document.st.U1.value = 5
			sysunits[1] = 5}
		if (whichsyst == 2) {
			document.st.U2.value = 5
			sysunits[2] = 5}
		if (whichsyst == 3) {
			document.st.U3.value = 5
			sysunits[3] = 5}
		if (whichsyst == 4) {
			document.st.U4.value = 5
			sysunits[4] = 5}
		if (whichsyst == 5) {
			document.st.U5.value = 5
			sysunits[5] = 5}
		}



}



function setencon(){
	var t = document.house.fuel.selectedIndex

	var w = whichsyst
	systfuel[w] = t
	 if ( w == 1) {
		document.st.F1.value  = t
	}else if (w == 2) {
		document.st.F2.value  = t
	}else if (w == 3) {
		document.st.F3.value  = t
	}else if (w == 4) {
		document.st.F4.value  = t
	}else if (w == 5) {
		document.st.F5.value  = t
	}
	setunits ()
}




function setsyst(num){
var sys = num

	if(sys == 1){
		document.house.sysname.value = document.st.N1.value
		document.house.fcost.value = document.st.P1.value
		 document.house.elements[14].value = document.st.E1.value
		document.house.units.selectedIndex = sysunits[1]
		document.house.fuel.selectedIndex = systfuel[1]
		}
	else if(sys == 2){
		document.house.sysname.value = document.st.N2.value
		document.house.fcost.value = document.st.P2.value
		 document.house.elements[14].value = document.st.E2.value
		document.house.units.selectedIndex = sysunits[2]
		document.house.fuel.selectedIndex = systfuel[2]
		}
	else if(sys == 3){
		document.house.sysname.value = document.st.N3.value
		document.house.fcost.value = document.st.P3.value
		 document.house.elements[14].value = document.st.E3.value
		document.house.units.selectedIndex = sysunits[3]
		document.house.fuel.selectedIndex = systfuel[3]
		}
	else if(sys == 4){
		document.house.sysname.value = document.st.N4.value
		document.house.fcost.value = document.st.P4.value
		 document.house.elements[14].value = document.st.E4.value
		document.house.units.selectedIndex = sysunits[4]
		document.house.fuel.selectedIndex = systfuel[4]
		}
	else if(sys == 5){
		document.house.sysname.value = document.st.N5.value
		document.house.fcost.value = document.st.P5.value
		 document.house.elements[14].value = document.st.E5.value
		document.house.units.selectedIndex = sysunits[5]
		document.house.fuel.selectedIndex = systfuel[5]
		}

	whichsyst = sys
	document.st.WS.value = whichsyst
}

function  verunits() {

if ((document.house.fuel.selectedIndex == 0) && (document.house.units.selectedIndex != 0)) {
 alert("Please enter the price of oil in dollars per lit.")
 document.house.units.selectedIndex = 0
}
if ((document.house.fuel.selectedIndex == 1) && (document.house.units.selectedIndex != 1)) {
  alert ("Please enter the price of electricity in  dollars per kilowatt hour.")
 document.house.units.selectedIndex = 1
}
if ((document.house.fuel.selectedIndex == 2) && (document.house.units.selectedIndex != 2)&&(document.house.units.selectedIndex != 6)) {
  alert ("Please enter the price for natural gas in  dollars per cubic metre or dollars per gigajoule.")
 document.house.units.selectedIndex = 2
}
if ((document.house.fuel.selectedIndex == 3) && (document.house.units.selectedIndex != 0)) {
  alert ("Please enter the price of propane in dollars per lit.")
 document.house.units.selectedIndex = 0
}
if ((document.house.fuel.selectedIndex == 4) && (document.house.units.selectedIndex != 3)) {
  alert ("Please select an energy source before selecting the units.")
 document.house.units.selectedIndex = 3
}
if ( ((document.house.fuel.selectedIndex == 5) || (document.house.fuel.selectedIndex == 6))  && ( document.house.units.selectedIndex != 4)) {
 alert("Please enter the prices for hardwood or softwood in dollars per full cord.")
document.house.units.selectedIndex = 4 }
if ((document.house.fuel.selectedIndex == 7) && (document.house.units.selectedIndex != 5)) {
  alert ("Please enter the price for wood pellets in  dollars per tonne.")
 document.house.units.selectedIndex = 5
}

}

function nedhelp(){
    if (document.house.oldfuel.selectedIndex  == 0){
      assist2()
    }else  if (document.house.oldfuel.selectedIndex  == 1){
      assist4()
    }else  if (document.house.oldfuel.selectedIndex  == 3){
     assist3()
    }else  if (document.house.oldfuel.selectedIndex  == 2){
     alert("Please select a fuel first.")
    }else  if (document.house.oldfuel.selectedIndex  == 4) {
     assist5()
   }

}
function adjust () {
    verunits( )
	if (whichsyst == 1){
		document.st.N1.value = document.house.sysname.value
		document.st.P1.value = document.house.fcost.value
		document.st.E1.value =  document.house.elements[14].value
                sysunits[1] = document.house.units.selectedIndex
		document.st.U1.value = sysunits[1]
		}
	else if (whichsyst == 2){
		document.st.N2.value = document.house.sysname.value
		document.st.P2.value = document.house.fcost.value
		document.st.E2.value =  document.house.elements[14].value
                sysunits[2] = document.house.units.selectedIndex
		document.st.U2.value = sysunits[2]
		}
	else  if (whichsyst == 3){
		document.st.N3.value = document.house.sysname.value
		document.st.P3.value = document.house.fcost.value
		document.st.E3.value =  document.house.elements[14].value
                sysunits[3] = document.house.units.selectedIndex
		document.st.U3.value = sysunits[3]
		}
	else if (whichsyst == 4){
		document.st.N4.value = document.house.sysname.value
		document.st.P4.value = document.house.fcost.value
		document.st.E4.value =  document.house.elements[14].value
                sysunits[4] = document.house.units.selectedIndex
		document.st.U4.value = sysunits[4]
		}
	else  if (whichsyst == 5){
		document.st.N5.value = document.house.sysname.value
		document.st.P5.value = document.house.fcost.value
		document.st.E5.value =  document.house.elements[14].value
                sysunits[5] = document.house.units.selectedIndex
		document.st.U5.value = sysunits[5]

		}


}



function gethelp(){
   if(document.house.fuel.selectedIndex == 0){
      assist2()
      return
   }
   if(document.house.fuel.selectedIndex == 1){
      assist4()
      return
   }
   if(document.house.fuel.selectedIndex == 2){
      assist3()
      return
   }
   if(document.house.fuel.selectedIndex == 3){
      assist5()
      return
   }

  if(document.house.fuel.selectedIndex == 4){
      general()
      return
   }
 if(document.house.fuel.selectedIndex > 4){
      assist6()
      return
   }

 }

function oilwino(){
oil= open("","Oil","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=410,height=235")
oil.document.write("<html>")
oil.document.write("<HEADER>")
oil.document.write("<title>OIL</title>")
oil.document.write("</HEADER>")
oil.document.write("<body bgcolor='#EAF0F4'>")
oil.document.write("<CENTER><H1>OIL</H1></CENTER>")
 oil.document.write("<p>Older natural oil furnaces (pre: 1979) typically have AFUEs of 60%. Those with flame-retention head replacement burners will have AFUEs of 75%.</p>")

oil.document.write("<br><br>")
oil.document.write("<CENTER><table border= '5' ROWS =  '3' width= '200'>")
oil.document.write("<tr><td><CENTER>")
oil.document.write(" <a href='javascript:window.close();creator.oilwinc(60)'> ENTER 60% AFUE</a></CENTER></td></tr>")
oil.document.write(" <tr><td><CENTER><a href='javascript:window.close();creator.oilwinc(75)'> ENTER 75% AFUE</a></CENTER></td></tr>")
oil.document.write(" <tr><td><CENTER><a href='javascript:window.close();creator.oilwinc(-1)'> MORE INFORMATION</a></CENTER></td></tr>")
oil.document.write("</table></CENTER>")

oil.document.write("</body>" )
oil.document.write("</html>")
oil.document.close()
oil.creator = self
}

function oilwinc(e){
var afue =e

	if (afue ==-1){

	assist2()
	return
	}
document.house.oldsyseff.value = afue
}


function natwino(){
nat = open("","Gas","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=400,height=245")
nat.document.write("<html>")
nat.document.write("<HEADER>")
nat.document.write("<title>NATURAL_GAS</title>")
nat.document.write("</HEADER>")
nat.document.write("<body bgcolor='#EAF0F4'>")
nat.document.write("<CENTER><H1> NATURAL GAS</H1></CENTER>")
nat.document.write("<p>Older natural gas furnaces with pilot lights typically have AFUEs of 60%. Furnaces without pilot lights generally have AFUEs of 78%.\n")
nat.document.write("<br><br><br><br>")
nat.document.write("<CENTER><table border= '5' ROWS =  '3' width= '200'>")
nat.document.write("<tr><td><CENTER>")
nat.document.write(" <a href='javascript:window.close();creator.natwinc(60)'> ENTER 60% AFUE</a></CENTER></td></tr>")
nat.document.write(" <tr><td><CENTER><a href='javascript:window.close();creator.natwinc(78)'> ENTER 78% AFUE</a></CENTER></td></tr>")
nat.document.write(" <tr><td><CENTER><a href='javascript:window.close();creator.natwinc(-1)'> MORE INFORMATION</a></CENTER></td></tr>")
nat.document.write("</table></CENTER>")

nat.document.write("</body>" )
nat.document.write("</html>")
nat.document.close()
nat.creator = self
}

function natwinc(e){
var afue =e
	if (afue ==-1){
	assist3()
	return
	}
document.house.oldsyseff.value = afue
}

function elecwino(){
fue = open("","Electricity","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=400,height=235")
fue.document.write("<html>")
fue.document.write("<HEADER>")
fue.document.write("<title>ELECTRICITY</title>")
fue.document.write("</HEADER>")
fue.document.write("<body bgcolor='#EAF0F4'>")

fue.document.write("<CENTER><H1> ELECTRICITY</H1></CENTER>")
fue.document.write("<p>Electric baseboard heating, electric furnaces and electric boilers all have AFUEs of 100%. ")
fue.document.write("The dynamics of heat  pump operation are too complex for evaluation by this calculator.</p>")
fue.document.write("<br><br><br>")
fue.document.write("<CENTER><table border= '5' ROWS =  '1' width= '200'>")
fue.document.write("<tr><td><CENTER>")
fue.document.write(" <a href='javascript:window.close();creator.elecwinc()'> ENTER 100% AFUE</a></CENTER></td></tr>")
fue.document.write("</table></CENTER>")

fue.document.write("</body>" )


fue.document.write("</html>")
fue.document.close()
fue.creator = self
}

function elecwinc(){
document.house.oldsyseff.value = 100

}

function assist2(){
hlp2 = open("","HEATING_HELP","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=640,height=335")
hlp2.document.write("<html>")
hlp2.document.write("<HEADER>")
hlp2.document.write("<title>HELP</title>")
hlp2.document.write("</HEADER>")
hlp2.document.write("<body bgcolor='#EAF0F4'>")
hlp2.document.write("<CENTER> <FONT COLOR='#006400'><H2>OIL FURNACES</H2></FONT></CENTER>")
hlp2.document.write("<table border= '0' COLS ='2' width= '100%'>")
hlp2.document.write("<tr><th  ><H3>TYPE OF SYSTEM</H3></th><th><H3>SEASONAL EFFICIENCY  (AFUE^)</H3></TH?</tr>")
hlp2.document.write("<tr><td width=400  >Cast-iron head burner (old furnace)</td><td><CENTER>60</CENTER></td></tr>")
hlp2.document.write("<tr><td>Flame-retention head replacement burner</td><td><CENTER>70-78</CENTER></td></tr>")
hlp2.document.write("<tr><td>High-static replacement burner</td><td><CENTER>74-82</CENTER></td></tr>")
hlp2.document.write("<tr><td>New standard furnace or boiler</td><td><CENTER>78-86</CENTER></td></tr>")
hlp2.document.write("<tr><td>Mid-efficiency</td><td><CENTER>83-89</CENTER></td></tr>")
hlp2.document.write("<tr><td>Condensing furnace</td><td><CENTER>85-95</CENTER></td></tr>")
hlp2.document.write("<tr><td>Integrated space heating and hot water (mid-efficiency)</td><td><CENTER>83-89</CENTER></td></tr>")
hlp2.document.write("</table>")
hlp2.document.write("<PRE>\n\n\n")
hlp2.document.write("^ AFUE = Annual Fuel Utilization Efficiency")
hlp2.document.write("</PRE>")
hlp2.document.write("</body>" )
hlp2.document.write("</html>")
hlp2.document.close()
}

function assist3(){
hlp2 = open("","HEATING_HELP","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=640,height=330")
hlp2.document.write("<html>")
hlp2.document.write("<HEADER>")
hlp2.document.write("<title>HELP</title>")
hlp2.document.write("</HEADER>")
hlp2.document.write("<body bgcolor='#EAF0F4'>")
hlp2.document.write("<CENTER> <FONT COLOR='#006400'><H2>NATURAL GAS FURNACES</H2></FONT></CENTER>")
hlp2.document.write("<table border= '0' COLS ='2' width= '100%'>")
hlp2.document.write("<tr><th><H3>TYPE OF SYSTEM</H3></th><th><H3>SEASONAL EFFICIENCY  (AFUE^)</H3></TH?</tr>")
hlp2.document.write("<tr><td width=400 >Conventional</td><td><CENTER>60</CENTER></td></tr>")
hlp2.document.write("<tr><td>Vent damper with non-continuous pilot light</td><td><CENTER>62-67</CENTER></td></tr>")
hlp2.document.write("<tr><td>Mid-efficiency</td><td><CENTER>78-84</CENTER></td></tr>")
hlp2.document.write("<tr><td>High-efficiency condensing furnace</td><td><CENTER>89-96</CENTER></td></tr>")
hlp2.document.write("<tr><td>Integrated space heating and hot water (condensing)</td><td><CENTER>89-96</CENTER></td></tr>")
hlp2.document.write("</table>")
hlp2.document.write("<PRE>\n\n\n\n\n\n")
hlp2.document.write("^ AFUE = Annual Fuel Utilization Efficiency")
hlp2.document.write("</PRE>")
hlp2.document.write("</PRE>")
hlp2.document.write("</body>" )
hlp2.document.write("</html>")
hlp2.document.close()
}


function assist4(){
hlp2 = open("","HEATING_HELP","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=620,height=300")
hlp2.document.write("<html>")
hlp2.document.write("<HEADER>")
hlp2.document.write("<title>HELP</title>")
hlp2.document.write("</HEADER>")
hlp2.document.write("<body bgcolor='#EAF0F4'>")
hlp2.document.write("<CENTER> <FONT COLOR='#006400'><H2>ELECTRIC HEATING SYSTEMS</H2></FONT></CENTER>")
hlp2.document.write("<table border= '0' COLS ='2' width= '95%'>")
hlp2.document.write("<tr><th><H3>TYPE OF SYSTEM</H3></th><th><H3>SEASONAL EFFICIENCY  (AFUE^)</H3></TH?</tr>")
hlp2.document.write("<tr><td>Electric baseboards</td><td><CENTER>100</CENTER></td></tr>")
hlp2.document.write("<tr><td>Electric furnace or boiler</td><td><CENTER>100 </CENTER></td></tr>")

hlp2.document.write("</table>")
hlp2.document.write("<PRE>\n\n\n\n\n\n\n")
hlp2.document.write("^ AFUE = Annual Fuel Utilization Efficiency")
hlp2.document.write("</PRE>")
hlp2.document.write("</body>" )
hlp2.document.write("</html>")
hlp2.document.close()
}


function assist5(){
hlp2 = open("","HEATING_HELP","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=620,height=300")
hlp2.document.write("<html>")
hlp2.document.write("<HEADER>")
hlp2.document.write("<title>HELP</title>")
hlp2.document.write("</HEADER>")
hlp2.document.write("<body bgcolor='#EAF0F4'>")
hlp2.document.write("<CENTER> <FONT COLOR='#006400'><H2>PROPANE FURNACES</H2></FONT></CENTER>")


hlp2.document.write("<table border= '0' COLS ='2' width= '95%'>")
hlp2.document.write("<tr><th><H3>TYPE OF SYSTEM</H3></th><th><H3>SEASONAL EFFICIENCY  (AFUE^)</H3></TH?</tr>")

hlp2.document.write("<tr><td>Conventional</td><td ALIGN = 'CENTER'>62</td></tr>")
hlp2.document.write("<tr><td>Vent damper with non-continuous pilot light</td><td ALIGN = 'CENTER'>64-69</td></tr>")
hlp2.document.write("<tr><td>Mid-efficiency</td><td ALIGN = 'CENTER'>79-85</td></tr>")
hlp2.document.write("<tr><td>Condensing</td><td ALIGN = 'CENTER'>89-96</td></tr>")



hlp2.document.write("</table>")
hlp2.document.write("<PRE>\n\n\n\n\n\n")
hlp2.document.write("^ AFUE = Annual Fuel Utilization Efficiency")
hlp2.document.write("</PRE>")



hlp2.document.write("</PRE>")
hlp2.document.write("</body>" )
hlp2.document.write("</html>")
hlp2.document.close()
}


function assist6(){
hlp2 = open("","HEATING_HELP","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=620,height=330")
hlp2.document.write("<html>")
hlp2.document.write("<HEADER>")
hlp2.document.write("<title>HELP</title>")
hlp2.document.write("</HEADER>")
hlp2.document.write("<body bgcolor='#EAF0F4'>")
hlp2.document.write("<CENTER> <FONT COLOR='#006400'><H2>WOOD-FIRED HEATING APPLIANCES</H2></FONT></CENTER>")
hlp2.document.write("<table border= '0' COLS ='2' width= '95%'>")
hlp2.document.write("<tr><th><H3>TYPE OF SYSTEM</H3></th><th><H3>SEASONAL EFFICIENCY  (AFUE^)</H3></TH?</tr>")
hlp2.document.write("<tr><td>Central furnace</td><td ALIGN = 'CENTER'>45-55</td></tr>")
hlp2.document.write("<tr><td>Conventional stove (properly located)</td><td ALIGN = 'CENTER'>55-70</td></tr>")
hlp2.document.write("<tr><td>High-tech stove (properly located)</td><td ALIGN = 'CENTER'>70-80</td></tr>")
hlp2.document.write("<tr><td>Advanced combustion fireplace</td><td ALIGN = 'CENTER'>50-70</td></tr>")
hlp2.document.write("<tr><td>Pellet stove</td><td ALIGN = 'CENTER'>55-80</td></tr>")
hlp2.document.write("</table>")
hlp2.document.write("<PRE><br><br><br><br>\n\n\n\n\n\n")
hlp2.document.write("^ AFUE = Annual Fuel Utilization Efficiency")
hlp2.document.write("</PRE>")
hlp2.document.write("</PRE>")
hlp2.document.write("</body>" )
hlp2.document.write("</html>")
hlp2.document.close()
}


function general(){
hlp2 = open("","HEATING_HELP","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=620,height=400")
hlp2.document.write("<html>")
hlp2.document.write("<HEADER>")
hlp2.document.write("<title>HELP</title>")
hlp2.document.write("</HEADER>")
hlp2.document.write("<body bgcolor='#EAF0F4'>")
hlp2.document.write("<CENTER> <FONT COLOR='#006400'><H2>HEATING SYSTEMS</H2></FONT></CENTER>")

hlp2.document.write("<p>")
hlp2.document.write("<H3>FUEL PRICES</H3>\n")
hlp2.document.write("In order to calculate your annual space heating costs, the price per unit of energy must be entered for each system.")
hlp2.document.write(" Prices can be obtained from local suppliers.\n\n ")
hlp2.document.write("The appropriate units for each energy source are:\n")
hlp2.document.write("</p>")
hlp2.document.write("<table border='0' COLS = 2 width='400' ALIGN = 'LEFT' ><tr><td>* Oil</td><td>$.0 per lit</td></tr>")
hlp2.document.write("<tr><td>* Electricity</td><td>$.0 per kWh</td></tr>")
hlp2.document.write("<tr><td>* Natural Gas</td><td>$.0 per cubic metre <strong>or</strong> </td></tr>")
hlp2.document.write("<tr><td> </td><td>$.0 per gigajoule</td></tr>")
hlp2.document.write("<tr><td>* Propane</td><td>$.0 per lit</td></tr>")
hlp2.document.write("<tr><td>* Wood (air-dried logs)</td><td>$    per cord</td></tr>")
hlp2.document.write("<tr><td>* Wood Pellets</td><td>$    per tonne</td></tr>")
hlp2.document.write("</table>")
hlp2.document.write("<PRE>\n\n\n\n\n\n\n\n\n\n</PRE>")


hlp2.document.write("<p><H3>SYSTEM EFFICIENCIES</H3>\n")
hlp2.document.write("The calculator uses the Annual Fuel Utilization Efficiency (AFUE) for each system. ")
hlp2.document.write("AFUEs can be obtained from dealers or from product literature. ")
hlp2.document.write("To view system efficiencies by energy source, click \nthe<strong> HELP</strong> button after selecting it from the pop-up menu.</p>")



hlp2.document.write("</body>" )
hlp2.document.write("</html>")
hlp2.document.close()
}

function incsyst(i){
var  s = i
var tran
whichsyst = 1 * whichsyst
	if ((s ==1)  && ( whichsyst  <= 4)) {
   		tran = whichsyst + 1
		setsyst(tran)
	}else if ((s == -1) && (whichsyst > 1)){
		tran = whichsyst - 1
		setsyst(tran)
	}else {
	return
	}

}

