//<SCRIPT LANGUAGE="JavaScript">
<!--Begin Hide
//To add another material to be calculated, follow the following steps
//	1)Increment the ttlMaterial variable below
//	2)Add another table row to the baseline and variable tables
//		2.1)Name the input fields of the tables in the convention shown (base of 0 not 1)
//	3)Add hidden fields below the table to hold the name to be used in the summary
//		3.1)Name the hidden fields in the convention shown (base of 0 not 1)
//	4)Add any constants to constant.js as needed
//	5)Add a new case in the switch statement contained in the calculateData() function
// 	 6) create a new function for in the build list ( function buildSteelCans() )
// 	 7) call the newly created function (from #6 above) in the list of functions for createEmissionsPage(): strHTML += buildSteelCans();
//Determine how many materials are being calculated (base of 1 not 0)
ttlMaterial=34;
//the number of total inputs to be evaluated-used in the array of inputs (base of 1 not 0)
numInputs = 11; 
/* numInputs correspond to:
1=field name ;2=generated ;3=recycled ; 4=landfilled ; 5=combusted ;6=composted ;
7=alt_reduced ; 8=alt_recycled ;9=alt_landfilled ; 10=alt_combusted ; 11=alt_composted ;
*/
//Determine the browser.  This is important in writing to the opened window (see createSummary())
//Opening an empty string and writing to it crashes IE4
//Opening an existing page and overwriting its contents crashes Netscape
var browserName = navigator.appName
//instantiate variables used to pass the data throughout the following functions
var curItemName = ""
var curTonGenerated=0;
var curTonRecycled=0;
var curTonFill=0;
var curTonBurn=0;
var curTonCompost=0;
var modTonGenerated = 0;
var modTonRecycled = 0;
var modTonFill = 0;
var modTonBurn = 0;
var ttlMtce = 0;
var modTtlMtce = 0;
var deltaMtce = 0;
//the numeric values passed as an array
var strValues;
//the following is used to hold the text string which will be written to the summary document
strBody = "";
strModified = "";
//the window to which the summary is written
sumWindow = "";
// errorSummary= the string holding the errors generated during validation;
var errorSummary = "";
//Determine if a non-zero and non blank value is in a cell and which cells they are
//Validate the data making sure that the total output equals the total input
//Perform calculations
//Open the summary window
//Display a neatly formatted summary
function tester(vals)
{
//alert('entered function vals = ' + vals[7])
 for(z=0; z<vals.length; z++)
	{
		//alert(vals[i]);
	}
}
/*****************************************************************
Function verifyValues: This function ensures that the user will be
notified if no data is input for TonsGenerated.  All error checking 
in the calculateData function is based on an entry for TonsGenerated 
- and would not generate an error or do anything if there was not a 
value for tonsGenerated entered by the user, even if other inputs 
were entered.  verifyValues (this function) will generate an error 
if the user does not enter a value for TonsGenerated if there are 
any other values entered for that substance.  
******************************************************************/
function verifyValues(){	
//reset any previous error messages 
var stringAlert = "";

// Stripping commas here, since this is the first point before any further validation
for ( var index = 0; index < document.warmcalc.elements.length; index++ ) {
	if ( document.warmcalc.elements[index].type == "text" ) {
		document.warmcalc.elements[index].value = document.warmcalc.elements[index].value.replace(/,/g, "");
	}
}

// for loop - Step through each of the substances one at a time
for(i=0; i < ttlMaterial; i++){
var curItemName = 0;
//baseline variables
var curTonsGenerated = 0;
var curTonsRecycled = 0;
var curTonsLandFilled = 0;
var curTonsCombusted = 0;
var curTonsComposted = 0;
//alternate scenario variables
var curModTonsReduced = 0;
var curModTonsRecycled = 0;
var curModTonsLandFilled = 0;
var curModTonsCombusted = 0;
var curModTonsComposted = 0;
//get item name
curItemName = eval("document.warmcalc.itemName" + i + ".value");
	
// Check the values within the Baseline input boxes, [if N/A, make = 0], [if not entered make = 0], otherwise record the value
	if(eval("document.warmcalc.baseTonsGenerated" + i)){
		curTonsGenerated = eval("document.warmcalc.baseTonsGenerated" + i + ".value")
			if (curTonsGenerated == ""){
			curTonsGenerated = 0;
			};
		}
		else{
			curTonsGenerated = 0;
			};
			
	if(eval("document.warmcalc.baseTonsRecycled" + i)){
		curTonsRecycled = eval("document.warmcalc.baseTonsRecycled" + i + ".value")
			if (curTonsRecycled == ""){
			curTonsRecycled = 0;
			};
		}
		else{
			curTonsRecycled = 0;
			};
	if(eval("document.warmcalc.baseTonsLandFilled" + i)){
		curTonsLandFilled = eval("document.warmcalc.baseTonsLandFilled" + i + ".value")
			if (curTonsLandFilled == ""){
			curTonsLandFilled = 0;
			};
		}
		else{
			curTonsLandFilled = 0;
			};		
	if(eval("document.warmcalc.baseTonsCombusted" + i)){
		curTonsCombusted = eval("document.warmcalc.baseTonsCombusted" + i + ".value")
			if (curTonsCombusted == ""){
			curTonsCombusted = 0;
			};
		}
		else{
			curTonsCombusted = 0;
			};		
	if(eval("document.warmcalc.baseTonsComposted" + i)){
		curTonsComposted = eval("document.warmcalc.baseTonsComposted" + i + ".value")
			if (curTonsComposted == ""){
			curTonsComposted = 0;
			};
		}
		else{
			curTonsComposted = 0;
			};
			
// Check the values within the Alternative input boxes, [if N/A, make = 0], [if not entered make = 0], otherwise record the value
	if(eval("document.warmcalc.modTonsReduced" + i)){
		curModTonsReduced = eval("document.warmcalc.modTonsReduced" + i + ".value")
			if (curModTonsReduced == ""){
			curModTonsReduced = 0;
			};
		}
		else{
			curModTonsReduced = 0;
			};
			
	if(eval("document.warmcalc.modTonsRecycled" + i)){
		curModTonsRecycled = eval("document.warmcalc.modTonsRecycled" + i + ".value")
			if (curModTonsRecycled == ""){
			curModTonsRecycled = 0;
			};
		}
		else{
			curModTonsRecycled = 0;
			};
	if(eval("document.warmcalc.modTonsLandFilled" + i)){
		curModTonsLandFilled = eval("document.warmcalc.modTonsLandFilled" + i + ".value")
			if (curModTonsLandFilled == ""){
			curModTonsLandFilled = 0;
			};
		}
		else{
			curModTonsLandFilled = 0;
			};		
	if(eval("document.warmcalc.modTonsCombusted" + i)){
		curModTonsCombusted = eval("document.warmcalc.modTonsCombusted" + i + ".value")
			if (curModTonsCombusted == ""){
			curModTonsCombusted = 0;
			};
		}
		else{
			curModTonsCombusted = 0;
			};		
	if(eval("document.warmcalc.modTonsComposted" + i)){
		curModTonsComposted = eval("document.warmcalc.modTonsComposted" + i + ".value")
			if (curModTonsComposted == ""){
			curModTonsComposted = 0;
			};
		}
		else{
			curModTonsComposted = 0;
			};
						
// Summ values of all factors (except curTonsGenerated), if it is greater than 0 there has been an entry, next
// if curTonsGenerated is equal to zero,  add an error message, when done with for loop display all messages
// if no error, continue on to calculateData
var curFactorsAdded;
	curFactorsAdded = (parseFloat(curTonsRecycled) + parseFloat(curTonsLandFilled) + parseFloat(curTonsCombusted) + parseFloat(curTonsComposted) + parseFloat(curModTonsReduced) + parseFloat(curModTonsRecycled) + parseFloat(curModTonsLandFilled) + parseFloat(curModTonsCombusted) + parseFloat(curModTonsComposted));
	 if(curFactorsAdded > 0){
			if (curTonsGenerated == 0){
			stringAlert += "Total Tons Generated must be entered for " + curItemName + ".\n";
			}//end if
		}//End if
	}// End Forloop
	
// If there was an error generated above (no entry in TonsGenerated, but an entry in any other box), display an alert box with message
// Otherwise, process form normally
       if(! (stringAlert == "")){
		alert(stringAlert);
		}
	else{
		calculateData();
	}
}//end function
/******************************************************************************
validateInput insures that the waste generated equals the sum of the waste removed.
******************************************************************************/
function validateInput(vals, previousInput){
var baseVal = Math.round(eval(vals[3] + vals[4] + vals[5] + vals[6])*1000000000)/1000000000;
var altVal = Math.round(eval(vals[7] + vals[8] + vals[9] + vals[10] + vals[11])*1000000000)/1000000000;
//alert('baseVal = ' + baseVal + '\naltVal = ' + altVal);
tester(vals);
var localError = ""; // no inital error
	//first test for equality in the baseline measures
	if(parseFloat(vals[2]) != baseVal){
		//alert("Error validating data for " + vals[1] + ".  \nBase waste reduced does not equal waste generated.")
		//alert(vals[1] + ", " + vals[2] + ", " + vals[3] + ", " + vals[4] + ", " + vals[5] + ", " + vals[6] + ", " + vals[7] + ", " + vals[8] + ", " + vals[9] + ", " + vals[10] + ", " + vals[11] + ". ");
		//alert(baseVal)
		//localError += "\tBase waste reduced does not equal waste generated.\n"
		localError += "\tTotal tons managed in the Baseline Scenario must equal total tons generated.\n"
		//valFlag = false;
		//return false
	}
	//next test for equality in the modified measures
	//else 
	if (parseFloat(vals[2]) != altVal){
		//alert("Error validating data for " + vals[1] + ".  \nAlternate waste reduced does not equal waste generated.")
		//localError += "\tAlternate waste reduced does not equal waste generated.\n"
		localError += "\tTotal tons in the Alternative Management Scenario must equal total tons generated in the baseline.\n";
		//valFlag = false;
		//return false
	}
	
	
	if (localError != "") {
		//errorSummary += "Error validating data for " + vals[1] + ".  \n"  + localError + "\n"
		errorSummary += "Error in "+ vals[1] + " inputs:  \n"  + localError + "\n"
		return false;
	}
	else{
		if ( previousInput == false) {
  			 return false
		}
		else {
   			return true
		}
	};
	
/*	
	if(valFlag == true){	
		return true;
	}
	else{
		return false
	};
*/
}//end validateInput
/******************************************************************************
isaNumber insures that numeric data has been entered for the first entry.  
Further validation is performed in validateInputs() where the sum of all of the
inputs must equal the total waste being managed.
******************************************************************************/
function isaNumber(string) {
 //checks to make sure field isn't blank or contains non-numeric characters
 if (string.length == 0)
	 return false;
 for (var i=0;i < string.length;i++)
	 if ((string.substring(i,i+1) < '0') || (string.substring(i,i+1) > '9'))
 		if(string.substring(i,i+1) != '.')
 			return false;
 return true;
}//end isaNumber()
/******************************************************************************
makeNumber returns the floating decimal point value of a string passed to it.
If the string is empty ("") it returns a zero
******************************************************************************/
function makeNumber(val){
for(z=2; z <= numInputs; z++){
	if( val[z] != ""){
		val[z] = parseFloat(val[z])
	}
	else{
		val[z]=0
	};
};
return val;	
}//end makeNumber
/******************************************************************************
buildSummary takes the values passed from the different rows of the input table
and builds an HTML summary table around them.
******************************************************************************/
function buildSummary(vals){
	if(strBody.indexOf("<TABLE") == -1){
		strBody += "<TABLE CELLPADDING=2 CELLSPACING=0 BORDER=1 bordercolor='black' bordercolordark='white' bordercolorlight='black'>";
		strBody += "<TR VALIGN=BOTTOM>";
		strBody += "<TD ALIGN=LEFT class='tblHeader'><B>Material</TD>";
		strBody += "<TD ALIGN=CENTER class='tblHeader'><B>Tons Recycled</B></TD>";
		strBody += "<TD ALIGN=CENTER class='tblHeader'><B>Tons Landfilled</B></TD>";
		strBody += "<TD ALIGN=CENTER class='tblHeader'><B>Tons Combusted</B></TD>";
		strBody += "<TD ALIGN=CENTER class='tblHeader'><B>Tons Composted</B></TD>";
	if (x == 1) //x is a global variable set by the MTCE MTCO2 radio buttons and is set in the constants.js file
		strBody += "<TD ALIGN=CENTER class='tblHeader'><B>Total MTCE</B></TD>";
	else if (x == 0) strBody += "<TD ALIGN=CENTER class='tblHeader'><B>Million BTU</B></TD>";
	else strBody += "<TD ALIGN=CENTER class='tblHeader'><B>Total MTCO2E</B></TD>";
		strBody += "</TR>"
	};//end if
	
	strBody += "<TR><TD>" + vals[1] + "</TD><TD ALIGN=CENTER nowrap>" + addCommas(vals[3]) + "</TD>";
	strBody += "<TD ALIGN=CENTER nowrap>" + addCommas(vals[4]) + "</TD><TD ALIGN=CENTER nowrap>" + addCommas(vals[5]) + "</TD>";
	strBody += "<TD ALIGN=CENTER nowrap>" + addCommas(vals[6]) + "</TD>";
	strBody += "<TD ALIGN=RIGHT nowrap>" + addCommas(Math.round(ttlMtce)) + "</td></TR>";
	//alert(strBody);
	if(strModified.indexOf("<TABLE") == -1){
		strModified += "<TABLE CELLPADDING=2 CELLSPACING=0 BORDER=1 bordercolor='black' bordercolordark='white' bordercolorlight='black'>";
		strModified += "<TR VALIGN=BOTTOM>";
		strModified += "<TD ALIGN=LEFT class='tblHeader'><B>Material</TD>";
		strModified += "<TD ALIGN=CENTER class='tblHeader'><B>Tons Reduced</B></TD>";
		strModified += "<TD ALIGN=CENTER class='tblHeader'><B>Tons Recycled</B></TD>";
		strModified += "<TD ALIGN=CENTER class='tblHeader'><B>Tons Landfilled</B></TD>";
		strModified += "<TD ALIGN=CENTER class='tblHeader'><B>Tons Combusted</B></TD>";
		strModified += "<TD ALIGN=CENTER class='tblHeader'><B>Tons Composted</B></TD>";
		
	if (x == 1) //x is a global variable set by the MTCE MTCO2E radio buttons and is set in the constants.js file
		strModified += "<TD ALIGN=CENTER class='tblHeader'><B>Total MTCE</B></TD>";
	else if (x == 0) strModified += "<TD ALIGN=CENTER class='tblHeader'><B>Million BTU</B></TD>";
	else strModified += "<TD ALIGN=CENTER class='tblHeader'><B>Total MTCO2E</B></TD>";
		
		strModified += "</TR>"
	};//end if
	
	strModified += "<TR><TD>" + vals[1] + "</TD><TD ALIGN=CENTER nowrap>" + addCommas(vals[7]) + "</TD>";
	strModified += "<TD ALIGN=CENTER nowrap>" + addCommas(vals[8]) + "</TD><TD ALIGN=CENTER nowrap>" + addCommas(vals[9]) + "</TD>";
	strModified += "<TD ALIGN=CENTER nowrap>" + addCommas(vals[10]) + "</TD><TD ALIGN=CENTER nowrap>" + addCommas(vals[11]) + "</TD>";
	strModified += "<TD ALIGN=RIGHT nowrap>" + addCommas(Math.round(modTtlMtce)) + "</td></TR>";
	return true;
}
/******************************************************************************
createSummary determines if a summary window has already been opened, and if so
makes sure that it has been closed.  After this it opens the window and 
writes an HTML document around the HTML table which was created in buildSummary()
******************************************************************************/
function createSummary(){
frmMnth = document.warmcalc.FROM_MONTH.value
frmDay = document.warmcalc.FROM_DAY.value
frmYear = document.warmcalc.FROM_YEAR.value
toMnth = document.warmcalc.TO_MONTH.value
toDay = document.warmcalc.TO_DAY.value
toYear = document.warmcalc.TO_YEAR.value
var companyName = document.warmcalc.COMPANYNAME.value
var personName = document.warmcalc.USERNAME.value
var periodBegin = frmMnth + "/" + frmDay + "/" + frmYear
var periodEnd = toMnth + "/" + toDay + "/" + toYear
var strWindowOptions = "location=no";
strWindowOptions += ",toolbar=no";
strWindowOptions += ",menubar=yes";
strWindowOptions += ",status=no";
strWindowOptions += ",scrollbars=yes";
strWindowOptions += ",resizable=yes";
strWindowOptions += ",width=650";
strWindowOptions += ",height=400";
strWindowOptions += ",screenX=10";
strWindowOptions += ",screenY=10";
strWindowOptions += ",top=10";
strWindowOptions += ",left=10";
if(browserName == "Netscape"){
	sumWindow = window.open("", "Summary", strWindowOptions);
}
else if(browserName == "Microsoft Internet Explorer"){
	sumWindow = window.open("", "Summary", strWindowOptions);
}
else if(browserName != "Microsoft Internet Explorer" && browserName != "Netscape"){
	sumWindow = window.open("", "Summary", strWindowOptions);
};
	sumWindow.document.open();
	sumWindow.document.writeln("<HTML><TITLE>WARM Summary</TITLE>");
	sumWindow.document.writeln('<'+'link rel=stylesheet TYPE="text/css" HREF="../../../styles/epafiles_epastyles.css"'+'>');
	//sumWindow.document.writeln("<script language='JavaScript' src='functions.js'><\/script>");
	/*sumWindow.document.writeln("input {color:#000066; border:1 groove silver}");
	sumWindow.document.writeln(".inputDefault {color:#000066; border:0 groove silver}");
	sumWindow.document.writeln(".buttonDefault {color:#000066; border:2 outset silver}<\/style>");*/
	sumWindow.document.writeln("<\/HEAD>");
	sumWindow.document.writeln("<BODY>");
	sumWindow.document.writeln("<FORM NAME=SUMFORM>");
	if (x == 0) {
		sumWindow.document.writeln("<P><H3>Energy Analysis - Summary Report</H3></P>");
		sumWindow.document.write("<p class='epaLtSans'>(Version 9.01, 3/09)</p>");
		sumWindow.document.write("<P>Analysis of Energy Use from Waste Management");	
	}
	else {
		sumWindow.document.writeln("<P><H3>GHG Emissions Analysis -- Summary Report</H3></P>");
		sumWindow.document.write("<p class='epaLtSans'>(Version 9.01, 3/09)</p>");
		sumWindow.document.write("<P>Analysis of GHG Emissions from Waste Management");
	}
	
	if (companyName == "" || companyName==null) sumWindow.document.writeln("<br>");
	else sumWindow.document.writeln(" for  " + companyName + "<BR>");
	
	if (!(personName == "" || personName == null)) sumWindow.document.writeln("Prepared by  " + personName + "<BR>");
	
	if (!(frmMnth == "" || frmDay == "" || frmYear == "" || toMnth == "" || toDay == "" || toYear == "")) {
		sumWindow.document.writeln("Reporting Period for this Analysis is from  " + periodBegin);
		sumWindow.document.writeln(" to " + periodEnd);
	}
	sumWindow.document.writeln("</P><BR>");
	if (x == 1)//x is a global variable set by the MTCE MTCO2E radio buttons and is set in the constants.js file
		sumWindow.document.writeln("<table cellpadding=0 cellspacing=0 border=0><tr><td nowrap><B>GHG Emissions from Baseline Waste Management (MTCE):  ");
	else if (x == 0) sumWindow.document.writeln("<table cellpadding=0 cellspacing=0 border=0><tr><td nowrap><B>Energy Use from Baseline Waste Management (million BTU): ");
	else sumWindow.document.writeln("<table cellpadding=0 cellspacing=0 border=0><tr><td nowrap><B>GHG Emissions from Baseline Waste Management (MTCO2E):  ");
	
	sumWindow.document.writeln(addCommas(Math.round(grandTotalMTCE)) + "</B></td></tr></table><br>");
	sumWindow.document.writeln(strBody + "</TABLE><BR>");
	sumWindow.document.writeln("");
	
	if (x == 1)//x is a global variable set by the MTCE MTCO2E radio buttons and is set in the constants.js file
		sumWindow.document.writeln("<table cellpadding=0 cellspacing=0 border=0><tr><td nowrap><B>GHG Emissions from Alternative Waste Management Scenario (MTCE): " + addCommas(Math.round(grandModTotalMTCE)) + "</B></td></tr></table><br>");
	else if (x == 0) sumWindow.document.writeln("<table cellpadding=0 cellspacing=0 border=0><tr><td nowrap><B>Energy Use from Alternative Waste Management Scenario (million BTU): " + addCommas(Math.round(grandModTotalMTCE)) + "</B></td></tr></table><br>");
	else sumWindow.document.writeln("<table cellpadding=0 cellspacing=0 border=0><tr><td nowrap><B>GHG Emissions from Alternative Waste Management Scenario (MTCO2E): " + addCommas(Math.round(grandModTotalMTCE)) + "</B></td></tr></table><br>");
	sumWindow.document.writeln(strModified + "</TABLE><BR>");
	
	totalChange = grandModTotalMTCE -  grandTotalMTCE;
	if (x == 1)//x is a global variable set by the MTCE MTCO2E radio buttons and is set in the constants.js file
			sumWindow.document.writeln("<table cellpadding=0 cellspacing=0 border=0><tr><td nowrap><b>Total Change in GHG Emissions:  " + addCommas(Math.round(totalChange)) + " MTCE</b></td></tr></table><br>");
	else if (x == 0) sumWindow.document.writeln("<table cellpadding=0 cellspacing=0 border=0><tr><td nowrap><b>Total Change in Energy Use:  " + addCommas(Math.round(totalChange)) + " million BTU</b></td></tr></table><br>");
	else sumWindow.document.writeln("<table cellpadding=0 cellspacing=0 border=0><tr><td nowrap><b>Total Change in GHG Emissions: " + addCommas(Math.round(totalChange)) + " MTCO2E</b></td></tr></table><br>");
	if (x == 0) {
	sumWindow.document.writeln("<TABLE CELLPADDING=2 CELLSPACING=0 BORDER=1 bordercolor='black' bordercolordark='white' bordercolorlight='black'><tr><td><b>This is equivalent to...</b><br><table>");
	sumWindow.document.writeln("<tr><td width=100 align=right>"+addCommas((-1)*Math.round(totalChange/107.2591216
))+"</td><td> Households' Annual Energy Consumption</td></tr>");	
	sumWindow.document.writeln("<tr><td align=right>"+addCommas((-1)*Math.round(totalChange/5.8))+"</td><td> Barrels of Oil</td></tr>");
	sumWindow.document.writeln("<tr><td align=right>"+addCommas((-1)*Math.round(totalChange/0.124285714))+"</td><td> Gallons of Gasoline</td></tr>");
	sumWindow.document.writeln("</td></tr></table></td></tr></table><br><br>");
	}
	else sumWindow.document.writeln("<br>");
	
	
	if (x == 0) {
		sumWindow.document.writeln("<table CELLPADDING=0 CELLSPACING=4 BORDER=0><tr><td colspan=2>");
		sumWindow.document.writeln("Note: A negative value indicates an emission ");
		sumWindow.document.writeln("reduction; a positive value indicates an emission increase.</td></tr>");					
		sumWindow.document.writeln("<tr><td valign=top>a) </td><td>Emissions estimates provided by this model are intended to support voluntary GHG measurement and reporting initiatives.</td></tr>");
		sumWindow.document.writeln("<tr><td valign=top>b) </td><td>Total emissions estimates provided by this model may not sum due to independent rounding.");
		sumWindow.document.writeln("</td></tr></table><BR><br>");
	}
	else {
		sumWindow.document.writeln("<table CELLPADDING=0 CELLSPACING=4 BORDER=0><tr><td colspan=2>");
		sumWindow.document.writeln("Note: A negative value indicates an emission ");
		sumWindow.document.writeln("reduction; a positive value indicates an emission increase.</td></tr>");					
		sumWindow.document.writeln("<tr><td valign=top>a) </td><td>For an explanation of the methodology used to develop emission ");
		sumWindow.document.writeln("factors, see EPA report: Greenhouse Gas Emissions from ");						
		sumWindow.document.writeln("Management of Selected Materials in Municipal Solid Waste ");
		sumWindow.document.writeln("(EPA530-R-98-013) -- available on the Internet at ");	
	
	 	sumWindow.document.writeln("<A HREF='http://www.epa.gov/climatechange/wycd/waste/reports.html'>");
	 	sumWindow.document.writeln("http://www.epa.gov/climatechange/wycd/waste/reports.html</A>");
		sumWindow.document.writeln("Please note that some of the emission factors used ");						
		sumWindow.document.writeln("to generate these results do not match those presented ");
		sumWindow.document.writeln("in the report due to recent additions ");						
		sumWindow.document.writeln("and/or revisions.  ");
		sumWindow.document.writeln("<tr><td valign=top>b) </td><td>Emissions estimates provided by this model are intended ");
		sumWindow.document.writeln("to support voluntary GHG measurement and reporting initiatives.</td></tr>");
		sumWindow.document.writeln("<tr><td valign=top>c) </td><td>Total emissions estimates provided by this model may not sum ");
		sumWindow.document.writeln("due to independent rounding.");
		sumWindow.document.writeln("</td></tr></table><BR><br>");
	}
	
							
	sumWindow.document.writeln("<CENTER><INPUT TYPE='BUTTON' VALUE='Back to WARM' class='buttonDefault' onClick='window.close();'>");
	sumWindow.document.writeln("<INPUT TYPE='BUTTON' VALUE='View Emission Factors' class='buttonDefault' ");
	sumWindow.document.writeln("onClick='window.opener.createEmissionsPage(\"s\");'></CENTER><BR>");
	sumWindow.document.writeln("</FORM></BODY></HTML>");
	sumWindow.document.close();
	sumWindow.focus();
}
/******************************************************************************
EmptyArray() returns an empty array of the length of the passed argument
******************************************************************************/
function EmptyArray(length) {
	for (z=1;z<=length;z++)
		this[z]=""
	return(this)
}
/******************************************************************************
 StringToArray()  function returns is defined from 1 To numOfParm, not 0 To Parm
******************************************************************************/
function StringToArray( InString, Separator, numOfParm){
     
     var Head=0
     var Tail=0
     var RetArray=new EmptyArray(numOfParm)
     var Elements=0
     var StrLen
            
     while (Head < InString.length && numOfParm >= Elements){
          if (Head >= 0) {
               Elements = Elements + 1
               //Redim Preserve RetArray( 1 To Elements ) As String
               Tail = InString.indexOf(Separator,Head)
               if (Tail == -1){
                    // Special case for last item with not trailing separator
                    Tail = InString.length
					}
					//RetArray[Elements] = new String
               RetArray[Elements] = InString.substring( Head,Tail)
               Head = Tail + 1
          }
     }
 return RetArray
}
/******************************************************************************
getInputValues() obtains all of the information for the iteration of the arrays
of input values.  Doing this allows the values to be passed around as a type of
structure versus passing individual elements.
******************************************************************************/
function getInputValues(){		
//alert(i + " in getInputValues")
	curItemName = eval("document.warmcalc.itemName" + i + ".value");
	curTonGenerated = eval("document.warmcalc.baseTonsGenerated" + i + ".value");
	if(eval("document.warmcalc.baseTonsRecycled" + i)){
		curTonRecycled = eval("document.warmcalc.baseTonsRecycled" + i + ".value");
	}
	else{
		curTonRecycled = "0";
	};
	if(eval("document.warmcalc.baseTonsCombusted" + i)){
		curTonBurn = eval("document.warmcalc.baseTonsCombusted" + i + ".value");
	}
	else{
		curTonBurn = "0";
	};
	curTonFill = eval("document.warmcalc.baseTonsLandFilled" + i + ".value");
	//curTonBurn = eval("document.warmcalc.baseTonsCombusted" + i + ".value");
	//the following is the only variable which may not have a value
	if(eval("document.warmcalc.baseTonsComposted" + i)){
		curTonCompost = eval("document.warmcalc.baseTonsComposted" + i + ".value");
	}
	else{
		curTonCompost = "0";
	};
	//the following may not have a value
//alert("Field name = document.warmcalc.modTonsReduced" + i + "\nObject = " + eval("document.warmcalc.modTonsReduced" + i))
	if(eval("document.warmcalc.modTonsReduced" + i)){
		modTonReduced = eval("document.warmcalc.modTonsReduced" + i + ".value");
	}
	else{
		modTonReduced = "0"
	};
	//the following may not have a value
	if(eval("document.warmcalc.modTonsRecycled" + i)){
		modTonRecycled = eval("document.warmcalc.modTonsRecycled" + i + ".value");
	}
	else{
		modTonRecycled = "0"
	};
	
	if(eval("document.warmcalc.modTonsCombusted" + i)){
		modTonBurn = eval("document.warmcalc.modTonsCombusted" + i + ".value");
	}
	else{
		modTonBurn = "0";
	};
	modTonFill = eval("document.warmcalc.modTonsLandFilled" + i + ".value");
	//modTonBurn = eval("document.warmcalc.modTonsCombusted" + i + ".value");
	//the following may not have a value
	if(eval("document.warmcalc.modTonsComposted" + i)){
		modTonCompost = eval("document.warmcalc.modTonsComposted" + i + ".value");
	}
	else{
		modTonCompost = "0"
	};
	strValues = curItemName + "~" + curTonGenerated + "~" + curTonRecycled + "~"
	strValues += curTonFill + "~" + curTonBurn + "~" + curTonCompost + "~"
	strValues += modTonReduced + "~" + modTonRecycled + "~" + modTonFill + "~"
	strValues += modTonBurn + "~" + modTonCompost
return strValues;
}//end getInputValues
/******************************************************************************
landfillTransport(adjFact)  converts the Landfill baseline MTCE conversion factor 
if the user has entered their own value for distance traveled.  If the user has
selected to enter their own values but leaves the distance field empty, the
default value of 20 miles is used.
******************************************************************************/
function landfillTransport(adjFact){ //??
  	var userMiles = document.warmcalc.LANDFILL_DIST.value
  	
	if(userMiles == "" || isNaN(userMiles))
		userMiles = 20;
	
	//if(userMiles > 20)
	 	adjFact = adjFact + ((userMiles - 20)  * cnstTransportationFactor) 
  
  
	return adjFact;
}//landfillTransport(adjFact)
/******************************************************************************
combustionTransport(adjFact)  converts the Combustion baseline MTCE conversion 
factor if the user has entered their own value for distance traveled.  If the user 
has selected to enter their own values but leaves the distance field empty, the
default value of 20 miles is used.
******************************************************************************/
function combustionTransport(adjFact){
	var userMiles = document.warmcalc.COMBUSTION_DIST.value
	if(userMiles == "" || isNaN(userMiles))
		userMiles = 20;
	
	//if(userMiles > 20)
	 	adjFact = adjFact + ((userMiles - 20)  * cnstTransportationFactor) 
  
  
	return adjFact;
}//combustionTransport(adjFact)
/******************************************************************************
recyclingTransport(adjFact)  converts the Recycling baseline MTCE conversion 
factor if the user has entered their own value for distance traveled.  If the user 
has selected to enter their own values but leaves the distance field empty, the
default value of 20 miles is used.  This is used for all materials except 
Office Paper and Corrugated Boxes.
******************************************************************************/
function recyclingTransport(adjFact){
	var userMiles = parseFloat(document.warmcalc.RECYCLE_DIST.value);
  
	if(userMiles == "" || isNaN(userMiles))
		userMiles = 20;
	
	//if(userMiles > 20)
	adjFact = adjFact + ((userMiles - 20)  * cnstTransportationFactor) 
  return adjFact;
}//recyclingTransport(adjFact)
/******************************************************************************
compostTransport(adjFact)
******************************************************************************/
function compostTransport(adjFact){
	var userMiles = parseFloat(document.warmcalc.Composting_DIST.value);
  
	if(userMiles == "" || isNaN(userMiles))
		userMiles = 20;
	
	//if(userMiles > 20)
	 	adjFact = adjFact + ((userMiles - 20)  * cnstTransportationFactor) 
  
  
  return adjFact;
}//compostTransport(adjFact)
/******************************************************************************
function checkLandfill() checks the user's landfill selection and recomputes
the landfill constant accordingly
******************************************************************************/
function checkLandfill() {
var valLandfill = 0;
for(j=0; j < document.warmcalc.LFGRecovery.length; j++){
	if(document.warmcalc.LFGRecovery[j].checked == true){
		var lfgRecovery = document.warmcalc.LFGRecovery[j].value
		switch(lfgRecovery){
			case "0":
				valLandfill = cnstLandfillNatAve;
				break;
			case "1":
				valLandfill = cnstLandfillNoRec
				break;
			case "2":
				if(document.warmcalc.LFGMethod[0].checked){
					valLandfill = cnstLandfillEnergyRec
				}
				else{
					valLandfill = cnstLandfillFlare	
				};
				break;
		};
	};
};
return valLandfill;
}//end function checkLandfill()
/******************************************************************************
checkTransportation(s) evaluates the distance input.  If the user defined 
distance radio button is selected, this function calls the appropriate functions
which recompute the constants.
******************************************************************************/
function checkTransportation(s) {
if(document.warmcalc.DISTANCE[1].checked == true){
	valLandfill = landfillTransport(valLandfill)
	cnstCombustion = combustionTransport(cnstCombustion)
	cnstCompost = compostTransport(cnstCompost)
	cnstRecycling = recyclingTransport(cnstRecycling)
	
	
};
return true;
}// end function checkTransportation()
function calcTotalMTCE() {
   	grandTotalMTCE = grandTotalMTCE + ttlMtce
		grandModTotalMTCE = grandModTotalMTCE + modTtlMtce
}
/******************************************************************************
calcNewspaper(vals)  performs all conversions for baseline factors for Newspaper.
******************************************************************************/
function calcNewspaper(vals){
getNewspaperConstants();
valLandfill = checkLandfill();
//vals[1] is the name of the material
checkTransportation(vals[1]);
//alert(cnstRecycling);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill) + (vals[5] * cnstCombustion)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[7] * cnstSrcReduction) + (vals[8] * cnstRecycling) + (vals[9] * valLandfill) + (vals[10] * cnstCombustion)
	//modTtlMtce = Math.round(modTtlMtce);
	deltaMtce = ttlMtce - modTtlMtce;
	vals[6] = "N/A"
	vals[11] = "N/A"
	return true;
}//end calcNewspaper
/******************************************************************************
calcOfficePaper(vals)  performs all conversions for baseline factors for Newspaper.
******************************************************************************/
function calcOfficePaper(vals){
			
getOfficePaperConstants();
valLandfill = checkLandfill();
checkTransportation(vals[1]);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill) + (vals[5] * cnstCombustion)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[7] * cnstSrcReduction) + (vals[8] * cnstRecycling) + (vals[9] * valLandfill) + (vals[10] * cnstCombustion)
	//modTtlMtce = Math.round(modTtlMtce);
	deltaMtce = ttlMtce - modTtlMtce;
	vals[6] = "N/A"
	vals[11] = "N/A"
	return true;
}//end calcOfficePaper
/******************************************************************************
calcCorrugateBox(vals)  performs all conversions for baseline factors for Newspaper.
******************************************************************************/
function calcCorrugatedBox(vals){
			
getCorrugatedBoxConstants();
valLandfill = checkLandfill();
checkTransportation(vals[1]);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill) + (vals[5] * cnstCombustion)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[7] * cnstSrcReduction) + (vals[8] * cnstRecycling) + (vals[9] * valLandfill) + (vals[10] * cnstCombustion)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[6] = "N/A"
	vals[11] = "N/A"
	return true;
}//end calcCorrugatedBox
/******************************************************************************
calcMixedPaperBroad(vals)  performs all conversions for baseline factors for Newspaper.
******************************************************************************/
function calcMixedPaperBroad(vals){
	getMixedPaperBroadConstants();
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill) + (vals[5] * cnstCombustion)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[8] * cnstRecycling) + (vals[9] * valLandfill) + (vals[10] * cnstCombustion)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[6] = "N/A"
	vals[7] = "N/A"
	vals[11] = "N/A"
	return true;
}//end calcMixedPaperBroad(vals)
/******************************************************************************
calcMixedPaperResid(vals) 
******************************************************************************/
function calcMixedPaperResid(vals){
	getMixedPaperResidConstants();
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill) + (vals[5] * cnstCombustion)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[8] * cnstRecycling) + (vals[9] * valLandfill) + (vals[10] * cnstCombustion)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	////modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	vals[6] = "N/A"
	vals[7] = "N/A"
	vals[11] = "N/A"
	return true;
}//end calcMixedPaperResid(vals){
/******************************************************************************
calcMixedPaperOffice(vals) 
******************************************************************************/
function calcMixedPaperOffice(vals){
	getMixedPaperOfficeConstants();
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill) + (vals[5] * cnstCombustion)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[8] * cnstRecycling) + (vals[9] * valLandfill) + (vals[10] * cnstCombustion)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[6] = "N/A"
	vals[7] = "N/A"
	vals[11] = "N/A"
	return true;
}//end calcMixedPaperOffice(vals)
/******************************************************************************
calcAluminumCans(vals) 
******************************************************************************/
function calcAluminumCans(vals){
	getAluminumCanConstants();
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill) + (vals[5] * cnstCombustion)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[7] * cnstSrcReduction) + (vals[8] * cnstRecycling) + (vals[9] * valLandfill) + (vals[10] * cnstCombustion)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[6] = "N/A"
	vals[11] = "N/A"
	return true;
}//end calcAluminumCans(vals)
/******************************************************************************
calcSteelCans(vals) 
******************************************************************************/
function calcSteelCans(vals){
	getSteelCanConstants();
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill) + (vals[5] * cnstCombustion)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[7] * cnstSrcReduction) + (vals[8] * cnstRecycling) + (vals[9] * valLandfill) + (vals[10] * cnstCombustion)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[6] = "N/A"
	vals[11] = "N/A"
	return true;
}//end calcSteelCans(vals)
/******************************************************************************
calcCopperWire(vals) 
******************************************************************************/
function calcCopperWire(vals){
	getCopperWireConstants();
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill) + (vals[5] * cnstCombustion)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[7] * cnstSrcReduction) + (vals[8] * cnstRecycling) + (vals[9] * valLandfill) + (vals[10] * cnstCombustion)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[6] = "N/A"
	vals[11] = "N/A"
	return true;
}//end calcCopperWire(vals)
/******************************************************************************
calcGlass(vals) 
******************************************************************************/
function calcGlass(vals){
	getGlassConstants();
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill) + (vals[5] * cnstCombustion)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[7] * cnstSrcReduction) + (vals[8] * cnstRecycling) + (vals[9] * valLandfill) + (vals[10] * cnstCombustion)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[6] = "N/A"
	vals[11] = "N/A"
	return true;
}//end calcGlass(vals)
/******************************************************************************
calcHDPE(vals) 
******************************************************************************/
function calcHDPE(vals){
	getHDPEConstants();
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill) + (vals[5] * cnstCombustion)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[7] * cnstSrcReduction) + (vals[8] * cnstRecycling) + (vals[9] * valLandfill) + (vals[10] * cnstCombustion)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[6] = "N/A"
	vals[11] = "N/A"
	return true;
}//end calcHDPE(vals)
/******************************************************************************
calcLDPE(vals) 
******************************************************************************/
function calcLDPE(vals){
	getLDPEConstants();
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill) + (vals[5] * cnstCombustion)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[7] * cnstSrcReduction) + (vals[8] * cnstRecycling) + (vals[9] * valLandfill) + (vals[10] * cnstCombustion)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[6] = "N/A"
	vals[11] = "N/A"
	return true;
}//end calcLDPE(vals)
/******************************************************************************
calcPET(vals) 
******************************************************************************/
function calcPET(vals){
	getPETConstants();
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill) + (vals[5] * cnstCombustion)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[7] * cnstSrcReduction) + (vals[8] * cnstRecycling) + (vals[9] * valLandfill) + (vals[10] * cnstCombustion)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[6] = "N/A"
	vals[11] = "N/A"
	return true;
}//end calcPET(vals)
/******************************************************************************
calcDimLumber(vals) 
******************************************************************************/
function calcDimLumber(vals){
	getDimLumberConstants();
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill) + (vals[5] * cnstCombustion)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[7] * cnstSrcReduction) + (vals[8] * cnstRecycling) + (vals[9] * valLandfill) + (vals[10] * cnstCombustion)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[6] = "N/A"
	vals[11] = "N/A"
	return true;
}//end calcDimLumber(vals)
/******************************************************************************
calcFiberboard(vals) 
******************************************************************************/
function calcFiberboard(vals){
	getFiberboardConstants();
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill) + (vals[5] * cnstCombustion)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[7] * cnstSrcReduction) + (vals[8] * cnstRecycling) + (vals[9] * valLandfill) + (vals[10] * cnstCombustion)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[6] = "N/A"
	vals[11] = "N/A"
	return true;
}//end calcFiberboard(vals)
/******************************************************************************
calcFoodWaste(vals) 
******************************************************************************/
function calcFoodWaste(vals){
	getFoodWasteConstants();
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[4] * valLandfill) + (vals[5] * cnstCombustion) + (vals[6] * cnstCompost)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[9] * valLandfill) + (vals[10] * cnstCombustion) + (vals[11] * cnstCompost)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[3] = "N/A"
	vals[7] = "N/A"
	vals[8] = "N/A"
	return true;
}//end calcFoodWaste(vals)
/******************************************************************************
calcYardWaste(vals) 
******************************************************************************/
function calcYardWaste(vals){
	getYardWasteConstants();
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[4] * valLandfill) + (vals[5] * cnstCombustion) + (vals[6] * cnstCompost)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[9] * valLandfill) + (vals[10] * cnstCombustion) + (vals[11] * cnstCompost)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[3] = "N/A"
	vals[7] = "N/A"
	vals[8] = "N/A"
	return true;
}//end calcYardWaste(vals)
/******************************************************************************
calcMagazines(vals);
******************************************************************************/
function calcMagazines(vals){
	getMagazinesConstants();
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill) + (vals[5] * cnstCombustion)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[7] * cnstSrcReduction) + (vals[8] * cnstRecycling) + (vals[9] * valLandfill) + (vals[10] * cnstCombustion)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[6] = "N/A"
	vals[11] = "N/A"
	return true;
}//calcMagazines(Vals);
/******************************************************************************
calcPhonebooks(vals);
******************************************************************************/
function calcPhonebooks(vals){
	getPhonebookConstants();
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill) + (vals[5] * cnstCombustion)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[7] * cnstSrcReduction) + (vals[8] * cnstRecycling) + (vals[9] * valLandfill) + (vals[10] * cnstCombustion)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[6] = "N/A"
	vals[11] = "N/A"
	return true;
}//calcPhonebooks(vals);
/******************************************************************************
calcTextbooks(vals);
******************************************************************************/
function calcTextbooks(vals){
	getTextbookConstants();
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill) + (vals[5] * cnstCombustion)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[7] * cnstSrcReduction) + (vals[8] * cnstRecycling) + (vals[9] * valLandfill) + (vals[10] * cnstCombustion)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[6] = "N/A"
	vals[11] = "N/A"
	return true;
}//calcTextbooks(vals);
/******************************************************************************
calcGrass(vals);
******************************************************************************/
function calcGrass(vals){
	getGrassConstants();
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[4] * valLandfill) + (vals[5] * cnstCombustion) + (vals[6] * cnstCompost)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[9] * valLandfill) + (vals[10] * cnstCombustion) + (vals[11] * cnstCompost)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[3] = "N/A"
	vals[7] = "N/A"
	vals[8] = "N/A"
	return true;
}//end calcGrass(Vals)
/******************************************************************************
calcLeaves(vals);
******************************************************************************/
function calcLeaves(vals){
	getLeavesConstants();
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[4] * valLandfill) + (vals[5] * cnstCombustion) + (vals[6] * cnstCompost)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[9] * valLandfill) + (vals[10] * cnstCombustion) + (vals[11] * cnstCompost)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[3] = "N/A"
	vals[7] = "N/A"
	vals[8] = "N/A"
	return true;
}//end calcLeaves(vals);
/******************************************************************************
calcBranches(vals);	
******************************************************************************/
function calcBranches(vals){
	getBranchesConstants();
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[4] * valLandfill) + (vals[5] * cnstCombustion) + (vals[6] * cnstCompost)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[9] * valLandfill) + (vals[10] * cnstCombustion) + (vals[11] * cnstCompost)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[3] = "N/A"
	vals[7] = "N/A"
	vals[8] = "N/A"
	return true;
}//end calcBranches(vals);
/******************************************************************************
calcMixedPlastics(vals);
******************************************************************************/
function calcMixedPlastics(vals){
	getMixedPlasticsConstants();
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill) + (vals[5] * cnstCombustion)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[8] * cnstRecycling) + (vals[9] * valLandfill) + (vals[10] * cnstCombustion)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[6] = "N/A"
	vals[7] = "N/A"
	vals[11] = "N/A"
	return true;
}//calcMixedPlastics(vals);
/******************************************************************************
calcMixedOrganics(vals);
******************************************************************************/
function calcMixedOrganics(vals){
	getMixedOrganicsConstants();
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[4] * valLandfill) + (vals[5] * cnstCombustion) + (vals[6] * cnstCompost)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[9] * valLandfill) + (vals[10] * cnstCombustion) + (vals[11] * cnstCompost)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[3] = "N/A"
	vals[8] = "N/A"
	vals[7] = "N/A"
	
	return true;
}//calcMixedOrganics(vals);
/******************************************************************************
calcMixedMSW(vals);
******************************************************************************/
function calcMixedMSW(vals){
	getMixedMSWConstants();
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[4] * valLandfill) + (vals[5] * cnstCombustion)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[9] * valLandfill) + (vals[10] * cnstCombustion)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[3] = "N/A"
	vals[6] = "N/A"
	vals[7] = "N/A"
	vals[8] = "N/A"
	vals[11] = "N/A"
	return true;
}//calcMixedMSW(vals);	
/******************************************************************************
calcMixedRecyclables(vals) This function is going to be unique in that the 
distance calculations will be handled within the function.  Distance calculation
for Mixed Recyclables is a weighted average based upon several of the 
materials in this calculator.
******************************************************************************/
function calcMixedRecyclables(vals){
	getMixedRecyclableConstants();
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill) + (vals[5] * cnstCombustion)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[8] * cnstRecycling) + (vals[9] * valLandfill) + (vals[10] * cnstCombustion)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[6] = "N/A"
	vals[7] = "N/A"
	vals[11] = "N/A"
	return true;
}//end calcMixedRecyclables(vals)
/******************************************************************************
calcMixedMetals(vals);
******************************************************************************/
function calcMixedMetals(vals){
	getMixedMetalsConstants();
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill) + (vals[5] * cnstCombustion)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[8] * cnstRecycling) + (vals[9] * valLandfill) + (vals[10] * cnstCombustion)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[6] = "N/A"
	vals[7] = "N/A"
	vals[11] = "N/A"
	return true;
}//calcMixedMetals(vals);
/******************************************************************************
calcCarpets(vals);
******************************************************************************/
function calcCarpets(vals){
	getCarpetsConstants();
	
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill) + (vals[5] * cnstCombustion)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[7] * cnstSrcReduction) + (vals[8] * cnstRecycling) + (vals[9] * valLandfill) + (vals[10] * cnstCombustion)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[6] = "N/A"
	vals[11] = "N/A"
	return true;
}//calcCarpets(vals);
/******************************************************************************
calcPCs(vals);
******************************************************************************/
function calcPCs(vals){
	getPCsConstants();
	
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill) + (vals[5] * cnstCombustion)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[7] * cnstSrcReduction) + (vals[8] * cnstRecycling) + (vals[9] * valLandfill) + (vals[10] * cnstCombustion)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[6] = "N/A"
	vals[11] = "N/A"
	return true;
}//calcPCs(vals);
/******************************************************************************
calcClayBricks(vals);
******************************************************************************/
function calcClayBricks(vals){
	getClayBricksConstants();
	
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[4] * valLandfill)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[7] * cnstSrcReduction) + (vals[9] * valLandfill)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[3] = "N/A"
	vals[5] = "N/A"
	vals[6] = "N/A"
	vals[8] = "N/A"
	vals[10] = "N/A"
	vals[11] = "N/A"
	return true;
}//calcClayBricks(vals);
/******************************************************************************
calcAggregate(vals);
******************************************************************************/
function calcAggregate(vals){
	getAggregateConstants();
	
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[8] * cnstRecycling) + (vals[9] * valLandfill)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	vals[5] = "N/A"
	vals[6] = "N/A"
	vals[7] = "N/A"
	vals[10] = "N/A"
	vals[11] = "N/A"
	return true;
}//calcAggregate(vals);
/******************************************************************************
calcFlyAsh(vals);
******************************************************************************/
function calcFlyAsh(vals){
	getFlyAshConstants();
	
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[8] * cnstRecycling) + (vals[9] * valLandfill)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	
	vals[5] = "N/A"
	vals[6] = "N/A"
	vals[7] = "N/A"
	vals[10] = "N/A"
	vals[11] = "N/A"
	return true;
}//calcFlyAsh(vals);
/******************************************************************************
calcTires(vals);
******************************************************************************/
function calcTires(vals){
	getTiresConstants();
	
	valLandfill = checkLandfill();
	checkTransportation(vals[1]);
	ttlMtce = (vals[3] * cnstRecycling) + (vals[4] * valLandfill) + (vals[5] * cnstCombustion)
	//ttlMtce = Math.round(ttlMtce);
	modTtlMtce = (vals[7] * cnstSrcReduction) + (vals[8] * cnstRecycling) + (vals[9] * valLandfill) + (vals[10] * cnstCombustion)
	//modTtlMtce = Math.round(modTtlMtce);   // rounding is done now at the display level
	deltaMtce = ttlMtce - modTtlMtce;
	
	vals[6] = "N/A"
	vals[11] = "N/A"
	return true;
}//calcTires(vals);
/******************************************************************************
calculateData interates through the fields and determines of they have non-blank
and non-zero entries.  Base upon that, it calls a validation function which
insures that the waste generated equals the sum of the waste removed.
******************************************************************************/
function calculateData(){
errorSummary = "";
var goodInput = true
strBody = "";
strModified = "";
ttlMtce = 0;
modTtlMtce = 0;
deltaMtce = 0;
grandTotalMTCE = 0;
grandModTotalMTCE = 0;
i=0
   if (sumWindow && !sumWindow.closed){
	sumWindow.close();
   };
   for(i=0; i < ttlMaterial; i++){
//alert("Looping through " + eval(i + 1) + " times");
//alert("Current item = " + curItemName);
	//test for the base.  the mod's are calc'd from the baseline.
	numTest = eval("document.warmcalc.baseTonsGenerated" + i + ".value");
		//test to see if the first input is a non-zero number
		if(isaNumber(numTest) == true && numTest != "0"){
 			getInputValues();
//want to return the array here and parse into integers!!!!!!!!!!!!
			inputVals = StringToArray(strValues, "~", numInputs);
			inputVals = makeNumber(inputVals);
			//alert(inputVals[2]);
			//now test for valid inputs (waste generated == waste managed)
			goodInput = validateInput(inputVals, goodInput);
			if ( goodInput==true ) {
   				//if goodInput==true, then none have failed
				//if goodInput == false, then don't evaluate anything else
				switch (curItemName){
				case "Newspaper" :
					calcNewspaper(inputVals);
					buildSummary(inputVals);
					calcTotalMTCE();			
					break;
				case "Office Paper" :
					calcOfficePaper(inputVals);
					buildSummary(inputVals);
					calcTotalMTCE();
					break;
				case "Corrugated Boxes" :
					calcCorrugatedBox(inputVals);
					buildSummary(inputVals);
					calcTotalMTCE();
					break;
				case "Mixed Paper (general)" :
					calcMixedPaperBroad(inputVals);								
					buildSummary(inputVals);
					calcTotalMTCE();
					break;
				case "Mixed Paper (primarily residential)" :
					calcMixedPaperResid(inputVals);								
					buildSummary(inputVals);
					calcTotalMTCE();
					break;
				case "Mixed Paper (primarily from offices)" :
					calcMixedPaperOffice(inputVals);
					buildSummary(inputVals);
					calcTotalMTCE();
					break;
				case "Aluminum Cans" :
					calcAluminumCans(inputVals);								
					buildSummary(inputVals);
					calcTotalMTCE();
					break;
				case "Steel Cans" :
					calcSteelCans(inputVals);								
					buildSummary(inputVals);
					calcTotalMTCE();
					break;
				case "Copper Wire" :
					calcCopperWire(inputVals);								
					buildSummary(inputVals);
					calcTotalMTCE();
					break;
				case "Glass" :
					calcGlass(inputVals);								
					buildSummary(inputVals);
					calcTotalMTCE();
					break;
				case "HDPE" :
					calcHDPE(inputVals);								
					buildSummary(inputVals);
					calcTotalMTCE();
					break;
				case "LDPE" :
					calcLDPE(inputVals);								
					buildSummary(inputVals);
					calcTotalMTCE();
					break;
				case "PET" :
					calcPET(inputVals);								
					buildSummary(inputVals);
					calcTotalMTCE();
					break;
				case "Dimensional Lumber" :
					calcDimLumber(inputVals);								
					buildSummary(inputVals);
					calcTotalMTCE();
					break;
				case "Medium Density Fiberboard" :
					calcFiberboard(inputVals);								
					buildSummary(inputVals);
					calcTotalMTCE();
					break;			
				case "Food Scraps" :
					calcFoodWaste(inputVals);								
					buildSummary(inputVals);
					calcTotalMTCE();
					break;
				case "Yard Trimmings" :
					calcYardWaste(inputVals);								
					buildSummary(inputVals);
					calcTotalMTCE();
					break;	
				case "Mixed Recyclables" :
					calcMixedRecyclables(inputVals);
					buildSummary(inputVals);
					calcTotalMTCE();
					break;
				case "Magazines/third-class mail" :
					calcMagazines(inputVals);
					buildSummary(inputVals);
					calcTotalMTCE();
					break;
				case "Phonebooks" :
					calcPhonebooks(inputVals);
					buildSummary(inputVals);
					calcTotalMTCE();
					break;	
				case "Textbooks" :
					calcTextbooks(inputVals);	
					buildSummary(inputVals);
					calcTotalMTCE();
					break;	
				case "Grass" :
					calcGrass(inputVals);	
					buildSummary(inputVals);
					calcTotalMTCE();
					break;	
				case "Leaves" :
					calcLeaves(inputVals);	
					buildSummary(inputVals);
					calcTotalMTCE();
					break;
				case "Branches" :
					calcBranches(inputVals);
					buildSummary(inputVals);
					calcTotalMTCE();
					break;	
				case "Mixed Metals" :
					calcMixedMetals(inputVals);	
					buildSummary(inputVals);
					calcTotalMTCE();
					break;
				case "Mixed Plastics" :
					calcMixedPlastics(inputVals);	
					buildSummary(inputVals);
					calcTotalMTCE();
					break;	
				case "Mixed Organics" :
					calcMixedOrganics(inputVals);
					buildSummary(inputVals);
					calcTotalMTCE();
					break;
				case "Mixed MSW" :
					calcMixedMSW(inputVals);
					buildSummary(inputVals);
					calcTotalMTCE();
					break;		
				case "Carpet" :
					calcCarpets(inputVals);	
					buildSummary(inputVals);
					calcTotalMTCE();
					break;
				case "Personal Computers" :
					calcPCs(inputVals);	
					buildSummary(inputVals);
					calcTotalMTCE();
					break;
				case "Clay Bricks" :
					calcClayBricks(inputVals);	
					buildSummary(inputVals);
					calcTotalMTCE();
					break;
				case "Aggregate" :
					calcAggregate(inputVals);	
					buildSummary(inputVals);
					calcTotalMTCE();
					break;
				case "Fly Ash" :
					calcFlyAsh(inputVals);	
					buildSummary(inputVals);
					calcTotalMTCE();
					break;
				case "Tires" :
					calcTires(inputVals);	
					buildSummary(inputVals);
					calcTotalMTCE();
					break;
				}//end switch
			};//end if		
		}//end if
   }//end for
   
   if (errorSummary != "") alert(errorSummary);
		if (strBody.indexOf("<TABLE") == 0 && goodInput == true){
			createSummary();
		}
		else{
			//alert("No materials were selected.")
		};
}//end checkValues
function resetDistance(){
  document.warmcalc.RECYCLE_DIST.value = "20"
  document.warmcalc.LANDFILL_DIST.value = "20"
  document.warmcalc.COMBUSTION_DIST.value = "20"
  document.warmcalc.Composting_DIST.value = "20"
}
function checkDistance(){
	if(document.warmcalc.DISTANCE[0].checked == true){
		/*
		alert("You have not selected to use defined distances.  \nIf you want to specify the distance traveled, please indicate so in the selection above.");
		document.warmcalc.RECYCLE_DIST.value = "20"
		document.warmcalc.LANDFILL_DIST.value = "20"
		document.warmcalc.COMBUSTION_DIST.value = "20"
		*/
		document.warmcalc.DISTANCE[1].checked = true;
		
  }
}
function checkLFG(){
	if(document.warmcalc.LFGRecovery[2].checked == true){
		//alert('LFG checked = true');
		document.warmcalc.LFGMethod[0].checked = true
	}
	else{
		//alert('LFG checked = false');
		document.warmcalc.LFGMethod[0].checked = false
		document.warmcalc.LFGMethod[1].checked = false
	};
}
function checkLFGMethod(){
	if(document.warmcalc.LFGRecovery[2].checked == false){
		//alert('LFG checked = true');
		document.warmcalc.LFGMethod[0].checked = false
		document.warmcalc.LFGMethod[1].checked = false
	};
}
function showEmission(orig){
//orig is the origin of the request for the emission factor table
if (x == 0) var filename = "./emisfact_btu.htm";
	else if (x == 1) var filename = "./emisfact_mtce.htm";
	else var filename = "./emisfact_mtco2e.htm";
	if(sumWindow && !sumWindow.closed){
//		sumWindow.location=filename + "?" +orig;
		sumWindow.location=filename ;
		sumWindow.resizeTo(800, 550);
		sumWindow.focus();
	}
	else{
		var strWindowOptions = "location=no";
		strWindowOptions += ",toolbar=no";
		strWindowOptions += ",menubar=yes";
		strWindowOptions += ",status=no";
		strWindowOptions += ",scrollbars=yes";
		strWindowOptions += ",resizable=yes";
		strWindowOptions += ",width=800";
		strWindowOptions += ",height=550";
		strWindowOptions += ",screenX=10";
		strWindowOptions += ",screenY=10";
		strWindowOptions += ",top=10";
		strWindowOptions += ",left=10";
//		sumWindow = window.open(filename+"?m", "Summary", strWindowOptions);
		sumWindow = window.open(filename, "Summary", strWindowOptions);
	}
}
function clearEmission(){
	var strURL = window.sumWindow.location.href;
	var cameFrom = strURL.substring(strURL.indexOf("?") + 1, strURL.length);
	if(cameFrom == "s"){
		//alert("came from Summary Window");
		window.sumWindow.history.go(-1);
		window.sumWindow.resizeTo(650, 400);
		window.sumWindow.focus();
	}
	else if (cameFrom == "m"){
		//alert("came from Main Window");
		window.sumWindow.close();
		window.focus();
	}
	else{
		//alert("Don't know where it came from");
	}
}
function addCommas(myNumber) {
	var isNegative = "";
	myNumber += ""; // convert to String
	
	if (myNumber.charAt(0)=="-") {
		myNumber = myNumber.split("-")[1]
		isNegative = "-";
	}
	
	if (myNumber == "Infinity") return "N/A"
	else if (myNumber == "NaN") return "N/A"
	
	var decimals = "";
	
	if (myNumber.indexOf(".") == -1) decimals = "";
	else {
		myNumber = Math.round(myNumber*100)/100 + "";
		decimals = myNumber.split(".")[1] + "";
		if (!isNaN(decimals) && decimals!="") {
			decimals += ""; // convert to String
			if (decimals.length==1) decimals += "0";
			if (decimals == "0") decimals = "00";
			decimals = "." + decimals;
		}
		else decimals = ".00"
		myNumber = myNumber.split(".")[0];
	}
	
	var formattedNumber = "";
	var reverseFormattedNumber = "";
	var numberLength = myNumber.length;
	
	if (!isNaN(myNumber)) {
		for (ii=numberLength; ii>=0; ii--) {
			reverseFormattedNumber += myNumber.charAt(ii);
			if ((numberLength-ii)%3==0 && ii>0 && ii<numberLength) reverseFormattedNumber += ","
		}
		for (jj=reverseFormattedNumber.length; jj>=0; jj--) formattedNumber += reverseFormattedNumber.charAt(jj);
		return isNegative + formattedNumber + decimals;
	}
	else {
		return myNumber;
	}
	
	//return myNumber;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// Build the Emissions table body //
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Aluminum Cans  	 	 	 	 	
function buildAluminumCans(){
	getAluminumCanConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Aluminum Cans</td>";
	strEmissions += "<td valign=bottom>" + Math.round(cnstSrcReduction*100)/100 + "</td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//Steel Cans  	 	 	 	 	
function buildSteelCans(){
	getSteelCanConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Steel Cans</td>";
	strEmissions += "<td valign=bottom>" + Math.round(cnstSrcReduction*100)/100 + "</td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//Copper Wire 	 	 	 	 	
function buildCopperWire(){
	getCopperWireConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Copper Wire</td>";
	strEmissions += "<td valign=bottom>" + Math.round(cnstSrcReduction*100)/100 + "</td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//Glass	 	 	 	 	
function buildGlass(){
	getGlassConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Glass</td>";
	strEmissions += "<td valign=bottom>" + Math.round(cnstSrcReduction*100)/100 + "</td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//HDPE	 	 	 	 	
function buildHDPE(){
	getHDPEConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>HDPE</td>";
	strEmissions += "<td valign=bottom>" + Math.round(cnstSrcReduction*100)/100 + "</td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//LDPE	 	 	 	 	
function buildLDPE(){
	getLDPEConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>LDPE</td>";
	strEmissions += "<td valign=bottom>" + Math.round(cnstSrcReduction*100)/100 + "</td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//PET	 	 	 	 	
function buildPET(){
	getPETConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>PET</td>";
	strEmissions += "<td valign=bottom>" + Math.round(cnstSrcReduction*100)/100 + "</td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//CorrugatedBox	 	 	 	 	
function buildCorrugatedBox(){
	getCorrugatedBoxConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Corrugated Box</td>";
	strEmissions += "<td valign=bottom>" + Math.round(cnstSrcReduction*100)/100 + "</td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//Magazines	 	 	 	
function buildMagazines(){
	getMagazinesConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Magazines</td>";
	strEmissions += "<td valign=bottom>" + Math.round(cnstSrcReduction*100)/100 + "</td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//Newspaper	 	 	 	
function buildNewspaper(){
	getNewspaperConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Newspaper</td>";
	strEmissions += "<td valign=bottom>" + Math.round(cnstSrcReduction*100)/100 + "</td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//OfficePaper 	 	 	
function buildOfficePaper(){
	getOfficePaperConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Office Paper</td>";
	strEmissions += "<td valign=bottom>" + Math.round(cnstSrcReduction*100)/100 + "</td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//Phonebook 	 	 	
function buildPhonebook(){
	getPhonebookConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Phonebook</td>";
	strEmissions += "<td valign=bottom>" + Math.round(cnstSrcReduction*100)/100 + "</td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//Textbook	 	 	
function buildTextbook(){
	getTextbookConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Textbook</td>";
	strEmissions += "<td valign=bottom>" + Math.round(cnstSrcReduction*100)/100 + "</td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//DimLumber	 	 	
function buildDimLumber(){
	getDimLumberConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Dimensional Lumber</td>";
	strEmissions += "<td valign=bottom>" + Math.round(cnstSrcReduction*100)/100 + "</td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//Fiberboard	 	 	
function buildFiberboard(){
	getFiberboardConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Fiberboard</td>";
	strEmissions += "<td valign=bottom>" + Math.round(cnstSrcReduction*100)/100 + "</td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//FoodWaste	 	 	
function buildFoodWaste(){
	getFoodWasteConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Food Waste</td>";
	strEmissions += "<td valign=bottom> N/A </td><td valign=bottom> N/A </td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCompost*100)/100 + "</td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//YardWaste 	 	
function buildYardWaste(){
	getYardWasteConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Yard Waste</td>";
	strEmissions += "<td valign=bottom> N/A </td><td valign=bottom> N/A </td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCompost*100)/100 + "</td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//Grass	 	
function buildGrass(){
	getGrassConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Grass</td>";
	strEmissions += "<td valign=bottom> N/A </td><td valign=bottom> N/A </td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCompost*100)/100 + "</td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//Leaves	 	
function buildLeaves(){
	getLeavesConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Leaves</td>";
	strEmissions += "<td valign=bottom> N/A </td><td valign=bottom> N/A </td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCompost*100)/100 + "</td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//Branches	 	
function buildBranches(){
	getBranchesConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Branches</td>";
	strEmissions += "<td valign=bottom> N/A </td><td valign=bottom> N/A </td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCompost*100)/100 + "</td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//MixedPaperBroad	 	
function buildMixedPaperBroad(){
	getMixedPaperBroadConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Mixed Paper Board</td>";
	strEmissions += "<td valign=bottom> N/A </td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//MixedPaperResid	
function buildMixedPaperResid(){
	getMixedPaperResidConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Mixed Paper - Residential</td>";
	strEmissions += "<td valign=bottom> N/A </td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//MixedPaperOffice	
function buildMixedPaperOffice(){
	getMixedPaperOfficeConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Mixed Paper - Office</td>";
	strEmissions += "<td valign=bottom> N/A </td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//MixedMetals	
function buildMixedMetals(){
	getMixedMetalsConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Mixed Metals</td>";
	strEmissions += "<td valign=bottom> N/A </td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//MixedPlastics	
function buildMixedPlastics(){
	getMixedPlasticsConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Mixed Plastics</td>";
	strEmissions += "<td valign=bottom> N/A </td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//MixedRecyclable	
function buildMixedRecyclable(){
	getMixedRecyclableConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Mixed Recyclables</td>";
	strEmissions += "<td valign=bottom> N/A </td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//MixedOrganics	
function buildMixedOrganics(){
	getMixedOrganicsConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Mixed Organics</td>";
	strEmissions += "<td valign=bottom> N/A </td><td valign=bottom> N/A </td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCompost*100)/100 + "</td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//MixedMSW	
function buildMixedMSW(){
	getMixedMSWConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>MixedMSW</td>";
	strEmissions += "<td valign=bottom> N/A </td><td valign=bottom> N/A </td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//Carpets	
function buildCarpets(){
	getCarpetsConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Carpets</td>";
	strEmissions += "<td valign=bottom>" + Math.round(cnstSrcReduction*100)/100 + "</td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//PCs	
function buildPCs(){
	getPCsConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>PCs</td>";
	strEmissions += "<td valign=bottom>" + Math.round(cnstSrcReduction*100)/100 + "</td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//ClayBricks	
function buildClayBricks(){
	getClayBricksConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>ClayBricks</td>";
	strEmissions += "<td valign=bottom>" + Math.round(cnstSrcReduction*100)/100 + "</td><td valign=bottom> N/A </td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom> N/A </td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//Aggregate	
function buildAggregate(){
	getAggregateConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Aggregate</td>";
	strEmissions += "<td valign=bottom> N/A </td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom> N/A </td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//FlyAsh	
function buildFlyAsh(){
	getFlyAshConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>FlyAsh</td>";
	strEmissions += "<td valign=bottom> N/A </td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom> N/A </td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//Tires	
function buildTires(){
	getTiresConstants();
	var strEmissions = "";
	strEmissions += "<tr>";
	strEmissions += "<td valign=bottom>Tires</td>";
	strEmissions += "<td valign=bottom>" + Math.round(cnstSrcReduction*100)/100 + "</td><td valign=bottom>" + Math.round(cnstRecycling*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNatAve*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillNoRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillFlare*100)/100 + "</td><td valign=bottom>" + Math.round(cnstLandfillEnergyRec*100)/100 + "</td><td valign=bottom>" + Math.round(cnstCombustion*100)/100 + "</td><td valign=bottom> N/A </td>";
	strEmissions += "</tr>";
	emissionsWindow.document.writeln(strEmissions);
} //End........
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%//
// Build the Emissions Page                                                          //
// createEmissionsPage() dynamically generates a page containing all of the          //
//emissions factors that are generated in the functions                              //
//listed above (like 'function buildFlyAsh()' ).  The new page is called from       //
//either the Warm Online main page, or from the Create summary page through the     //
//window.opener function.                                                           //
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function createEmissionsPage(){
emissionsWindow = "";
setTimeout('emissionsWindow.resizeTo(800,600);',800);
setTimeout('emissionsWindow.scroll(0,0)',1000);
var strWindowOptions = "location=no";
strWindowOptions += ",toolbar=no";
strWindowOptions += ",menubar=yes";
strWindowOptions += ",status=no";
strWindowOptions += ",scrollbars=yes";
strWindowOptions += ",resizable=yes";
strWindowOptions += ",width=800";
strWindowOptions += ",height=600";
strWindowOptions += ",screenX=10";
strWindowOptions += ",screenY=10";
strWindowOptions += ",top=10";
strWindowOptions += ",left=10";
if(browserName == "Netscape"){
	emissionsWindow = window.open("", "Summary", strWindowOptions);
}
else if(browserName == "Microsoft Internet Explorer"){
	emissionsWindow = window.open("", "Summary", strWindowOptions);
}
else if(browserName != "Microsoft Internet Explorer" && browserName != "Netscape"){
	emissionsWindow = window.open("", "Summary", strWindowOptions);
};
	emissionsWindow.document.open();
	emissionsWindow.document.writeln("<HTML><TITLE>WARM Emmission Factors</TITLE>");
	emissionsWindow.document.writeln('<'+'link rel=stylesheet TYPE="text/css" HREF="../../../styles/epafiles_epastyles.css"'+'>');
	emissionsWindow.document.writeln("</HEAD>");
	//emissionsWindow.document.writeln("<BODY onBlur='javascript:window.close();'>");
	emissionsWindow.document.writeln("<FORM NAME=emisfact>");
	emissionsWindow.document.write("<table border='0' cellpadding='0' cellspacing='0' bordercolor='black' bordercolordark='white' bordercolorlight='black'><tr><td>");
	if (x == 0) {
		emissionsWindow.document.writeln("<p class='epaLtSans'>(Version 9.01, 3/09)</p><p>The energy factors presented in this table reflect national average landfill gas recovery practices and transportation distances.</p>");
		emissionsWindow.document.write("<P align='center'><FONT SIZE=+2>Energy Factors (million BTU per short ton)</FONT></p>");
		emissionsWindow.document.write("<table border='1' cellpadding='2' cellspacing='0' bordercolor='black' bordercolordark='white' bordercolorlight='black' summary='This table displays Greenhouse Gas Emission Factors (million BTU per short ton) based on the Waste Reduction Model (WARM). The model calculates emissions in metric tons of carbon equivalent (MTCE) and carbon dioxide equivalent (MTCO2E) across a wide range of material types that compose municipal solid waste (MSW).'>");	
	}
	else if (x == 1) {
		emissionsWindow.document.writeln("<p class='epaLtSans'>(Version 9.01, 3/09)</p><p>The emission factors presented in this table reflect national average landfill gas recovery practices and transportation distances.</p>");
		emissionsWindow.document.write("<P align='center'><FONT SIZE=+2>Greenhouse Gas Emission Factors (MTCE per short ton)</FONT></p>");
		emissionsWindow.document.write("<table border='1' cellpadding='2' cellspacing='0' bordercolor='black' bordercolordark='white' bordercolorlight='black' summary='This table displays Greenhouse Gas Emission Factors (MTCE per short ton) based on the Waste Reduction Model (WARM). The model calculates emissions in metric tons of carbon equivalent (MTCE) and carbon dioxide equivalent (MTCO2E) across a wide range of material types that compose municipal solid waste (MSW).'>");	
	}
	else {
		emissionsWindow.document.writeln("<p class='epaLtSans'>(Version 9.01, 3/09)</p><p>The emission factors presented in this table reflect national average landfill gas recovery practices and transportation distances.</p>");
		emissionsWindow.document.write("<P align='center'><FONT SIZE=+2>Greenhouse Gas Emission Factors (MTCO2E per short ton)</FONT></p>");
		emissionsWindow.document.write("<table border='1' cellpadding='2' cellspacing='0' bordercolor='black' bordercolordark='white' bordercolorlight='black' summary='This table displays Greenhouse Gas Emission Factors (MTCO2E per short ton) based on the Waste Reduction Model (WARM). The model calculates emissions in metric tons of carbon equivalent (MTCE) and carbon dioxide equivalent (MTCO2E) across a wide range of material types that compose municipal solid waste (MSW).'>");
	}
	
  emissionsWindow.document.writeln("<thead>");
    emissionsWindow.document.writeln("<tr>");
      emissionsWindow.document.writeln("<th valign=bottom scope=col class='tblHeader'><strong>Material </strong></th>");
      emissionsWindow.document.writeln("<th valign=bottom scope=col class='tblHeader'><strong>Source Reduction </strong></th>");
      emissionsWindow.document.writeln("<th valign=bottom scope=col class='tblHeader'><strong>Recycling </strong></th>");
      emissionsWindow.document.writeln("<th valign=bottom scope=col class='tblHeader'><strong>Landfilling, National Average </strong></th>");
      emissionsWindow.document.writeln("<th valign=bottom scope=col class='tblHeader'><strong>Landfilling, No Recovery </strong></th>");
      emissionsWindow.document.writeln("<th valign=bottom scope=col class='tblHeader'><strong>Landfilling, Flaring </strong></th>");
      emissionsWindow.document.writeln("<th valign=bottom scope=col class='tblHeader'><strong>Landfilling, Energy Recovery </strong></th>");
      emissionsWindow.document.writeln("<th valign=bottom scope=col class='tblHeader'><strong>Combustion </strong></th>");
     emissionsWindow.document.writeln("<th valign=bottom scope=col class='tblHeader'><strong>Composting </strong></th>");
    emissionsWindow.document.writeln("</tr>");
  emissionsWindow.document.writeln("</thead>");
  
var strHTML;
strHTML += buildAluminumCans();
strHTML += buildSteelCans();
strHTML += buildCopperWire();
strHTML += buildGlass();
strHTML += buildHDPE();
strHTML += buildLDPE();
strHTML += buildPET();
strHTML += buildCorrugatedBox();
strHTML += buildMagazines();
strHTML += buildNewspaper();
strHTML += buildOfficePaper();
strHTML += buildPhonebook();
strHTML += buildTextbook();
strHTML += buildDimLumber();
strHTML += buildFiberboard();
strHTML += buildFoodWaste();
strHTML += buildYardWaste();
strHTML += buildGrass();
strHTML += buildLeaves();
strHTML += buildBranches();
strHTML += buildMixedPaperBroad();
strHTML += buildMixedPaperResid();
strHTML += buildMixedPaperOffice();
strHTML += buildMixedMetals();
strHTML += buildMixedPlastics();
strHTML += buildMixedRecyclable();
strHTML += buildMixedOrganics();
strHTML += buildMixedMSW();
strHTML += buildCarpets();
strHTML += buildPCs();
strHTML += buildClayBricks();
strHTML += buildAggregate();
strHTML += buildFlyAsh();
strHTML += buildTires();
emissionsWindow.document.writeln("</table>");
emissionsWindow.document.writeln("</td></tr><tr><td colspan='9' align='center'>");
emissionsWindow.document.writeln("<input name=\"BUTTON\" type=\"BUTTON\"  class=\"buttonDefault\" onClick=\"window.close(); window.opener.focus()\" value=\" Back to WARM \">");
emissionsWindow.document.writeln("</td></tr></table>");
emissionsWindow.document.writeln("</form></body></html>");
emissionsWindow.focus();
setTimeout('emissionsWindow.document.close();',2000);
}
  
  //--End Hide-->
//</SCRIPT>
