//******************************
//	calcRoi() is called by the 'Calculate' of calculator_live.htm
//******************************

function calcROI()
	{
	if(!(navigator.appName == "Netscape") && (!(navigator.appName == "Microsoft Internet Explorer")))
		{
//********************
//	YIKES!  How did we get here???  We don't have code for this browser so tell them about it....
//********************
		alert("You are using an unknown (to this application) browser type.  Please access this application using either Netscape or Internet Explorer!");
		}
//alert ("you're in");

// INPUT STATS VARIABLES
	var totEmps = stripIt(document.forms[0].totEmps.value);
	var strippedTotMgrs = stripIt(document.forms[0].totMgrs.value);
	var totMgrs = formatNumber(strippedTotMgrs,"int");
	var totHrReps = stripIt(document.forms[0].totHrReps.value);
	var totPyrl = stripIt(document.forms[0].totPyrl.value);
	var topMgrSalry = stripIt(document.forms[0].topMgrSalry.value);
	var trnOvrYr = parseFloat(stripIt(document.forms[0].trnOvrYr.value))/parseFloat("100");
	var mrtIncrs = parseFloat(stripIt(document.forms[0].mrtIncrs.value))/parseFloat("100");

// FEE STRUCTURE VARIABLES
	var costMgr=stripIt(document.forms[0].costMgr.value);
	var instlFee=stripIt(document.forms[0].instlFee.value);
	var actvMgrs=parseFloat(stripIt(document.forms[0].actvMgrs.value))/parseFloat("100");

// DERIVED DATA VARIABLES
	var empsPerMgr = formatNumber(parseFloat(totEmps)/parseFloat(totMgrs),"int");
	var costPyrl= formatNumber(parseFloat(totPyrl)/parseFloat(totEmps)*1.4,"int");
	var costEmpHr = formatNumber(parseFloat(topMgrSalry)*1.6/2000,"int");

// COST/BENEFIT VARIABLES
// YEAR 1
	var strippedProdEfrtYr1=Math.round((parseFloat(strippedTotMgrs)*parseFloat(costEmpHr)*1.4*0.75)*parseFloat(actvMgrs));
	var prodEfrtYr1=formatNumber(strippedProdEfrtYr1,"int");

	var strippedAccTrnOvrYr1=Math.round(parseFloat(totPyrl)*parseFloat(trnOvrYr)*(parseFloat("1")/parseFloat("12"))*parseFloat(mrtIncrs));
	var accTrnOvrYr1=formatNumber(strippedAccTrnOvrYr1,"int");

	var strippedCycleSnkrntYr1=Math.round(parseFloat(topMgrSalry)/208*1.4*parseFloat(totHrReps));
	var cycleSnkrntYr1=formatNumber(strippedCycleSnkrntYr1,"int");

	var strippedQltyRewrkYr1=Math.round(parseFloat(strippedTotMgrs)*0.05*(parseFloat(topMgrSalry)*1.4)/2000+(parseFloat(topMgrSalry)*1.4)/2000*8*parseFloat(totHrReps));
	var qltyRewrkYr1=formatNumber(strippedQltyRewrkYr1,"int");

	var strippedFlxbltyTunObjYr1=Math.round(parseFloat(totPyrl)*parseFloat(mrtIncrs)*0.01*0.2*1.4);
	var flxbltyTunObjYr1=formatNumber(strippedFlxbltyTunObjYr1,"int");

	var strippedTotSaveYr1=strippedProdEfrtYr1+strippedAccTrnOvrYr1+strippedCycleSnkrntYr1+strippedQltyRewrkYr1+strippedFlxbltyTunObjYr1;
	var totSaveYr1=formatNumber(strippedTotSaveYr1,"int");

//	var strippedTotCostYr1=Math.round(strippedTotMgrs*parseFloat(costMgr)*parseFloat(actvMgrs)+parseFloat(instlFee));
	var strippedTotCostYr1=Math.round((strippedTotMgrs*parseFloat(costMgr)*parseFloat(actvMgrs))+((strippedTotMgrs*0.8*parseFloat(costMgr))*2)+(parseFloat(instlFee)));
	var totCostYr1=formatNumber(strippedTotCostYr1,"int");

	var strippedNetSaveYr1=strippedTotSaveYr1-strippedTotCostYr1;
	var netSaveYr1=formatNumber(strippedNetSaveYr1,"int");

// YEAR 2
	var strippedProdEfrtYr2=strippedProdEfrtYr1*(1+parseFloat(mrtIncrs));
	var prodEfrtYr2=formatNumber(strippedProdEfrtYr2,"int");

	var strippedAccTrnOvrYr2=strippedAccTrnOvrYr1*(1+parseFloat(mrtIncrs));
	var accTrnOvrYr2=formatNumber(strippedAccTrnOvrYr2,"int");

	var strippedCycleSnkrntYr2=strippedCycleSnkrntYr1*(1+parseFloat(mrtIncrs));
	var cycleSnkrntYr2=formatNumber(strippedCycleSnkrntYr2,"int");

	var strippedQltyRewrkYr2=strippedQltyRewrkYr1*(1+parseFloat(mrtIncrs));
	var qltyRewrkYr2=formatNumber(strippedQltyRewrkYr2,"int");

	var strippedFlxbltyTunObjYr2=strippedFlxbltyTunObjYr1*(1+parseFloat(mrtIncrs));
	var flxbltyTunObjYr2=formatNumber(strippedFlxbltyTunObjYr2,"int");

	var strippedSchdlAdminYr2=Math.round(parseFloat(totHrReps)*parseFloat(topMgrSalry)*(parseFloat("1.4")/parseFloat("250"))+(40*100));
	var schdlAdminYr2=formatNumber(strippedSchdlAdminYr2,"int");

	var strippedTotSaveYr2=strippedProdEfrtYr2+strippedAccTrnOvrYr2+strippedCycleSnkrntYr2+strippedQltyRewrkYr2+strippedFlxbltyTunObjYr2+strippedSchdlAdminYr2;
	var totSaveYr2=formatNumber(strippedTotSaveYr2,"int");

//	var strippedTotCostYr2=Math.round((strippedTotMgrs*parseFloat(costMgr)*parseFloat(actvMgrs))*0.1);
	var strippedTotCostYr2=Math.round((strippedTotMgrs*0.8*parseFloat(costMgr)*0.1)*2);
	var totCostYr2=formatNumber(strippedTotCostYr2,"int");

	var strippedNetSaveYr2=strippedTotSaveYr2-strippedTotCostYr2+strippedNetSaveYr1;
	var netSaveYr2=formatNumber(strippedNetSaveYr2,"int");
		
// YEAR 3
	var strippedProdEfrtYr3=strippedProdEfrtYr2*(1+parseFloat(mrtIncrs));
	var prodEfrtYr3=formatNumber(strippedProdEfrtYr3,"int");

	var strippedAccTrnOvrYr3=strippedAccTrnOvrYr2*(1+parseFloat(mrtIncrs));
	var accTrnOvrYr3=formatNumber(strippedAccTrnOvrYr3,"int");

	var strippedCycleSnkrntYr3=strippedCycleSnkrntYr2*(1+parseFloat(mrtIncrs));
	var cycleSnkrntYr3=formatNumber(strippedCycleSnkrntYr3,"int");

	var strippedQltyRewrkYr3=strippedQltyRewrkYr2*(1+parseFloat(mrtIncrs));
	var qltyRewrkYr3=formatNumber(strippedQltyRewrkYr3,"int");

	var strippedFlxbltyTunObjYr3=strippedFlxbltyTunObjYr2*(1+parseFloat(mrtIncrs));
	var flxbltyTunObjYr3=formatNumber(strippedFlxbltyTunObjYr3,"int");

	var strippedSchdlAdminYr3=strippedSchdlAdminYr2*(1+parseFloat(mrtIncrs));
	var schdlAdminYr3=formatNumber(strippedSchdlAdminYr3,"int");

	var strippedTotSaveYr3=strippedProdEfrtYr3+strippedAccTrnOvrYr3+strippedCycleSnkrntYr3+strippedQltyRewrkYr3+strippedFlxbltyTunObjYr3+strippedSchdlAdminYr3;
	var totSaveYr3=formatNumber(strippedTotSaveYr3,"int");

//	var strippedTotCostYr3=Math.round((strippedTotMgrs*parseFloat(costMgr)*parseFloat(actvMgrs))*0.1);
	var strippedTotCostYr3=Math.round((strippedTotMgrs*0.8*parseFloat(costMgr)*0.1)*2);
	var totCostYr3=formatNumber(strippedTotCostYr3,"int");

	var strippedNetSaveYr3=strippedTotSaveYr3-strippedTotCostYr3+strippedNetSaveYr2;
	var netSaveYr3=formatNumber(strippedNetSaveYr3,"int");

// YEAR 4
	var strippedProdEfrtYr4=strippedProdEfrtYr3*(1+parseFloat(mrtIncrs));
	var prodEfrtYr4=formatNumber(strippedProdEfrtYr4,"int");

	var strippedAccTrnOvrYr4=strippedAccTrnOvrYr3*(1+parseFloat(mrtIncrs));
	var accTrnOvrYr4=formatNumber(strippedAccTrnOvrYr4,"int");

	var strippedCycleSnkrntYr4=strippedCycleSnkrntYr3*(1+parseFloat(mrtIncrs));
	var cycleSnkrntYr4=formatNumber(strippedCycleSnkrntYr4,"int");

	var strippedQltyRewrkYr4=strippedQltyRewrkYr3*(1+parseFloat(mrtIncrs));
	var qltyRewrkYr4=formatNumber(strippedQltyRewrkYr4,"int");

	var strippedFlxbltyTunObjYr4=strippedFlxbltyTunObjYr3*(1+parseFloat(mrtIncrs));
	var flxbltyTunObjYr4=formatNumber(strippedFlxbltyTunObjYr4,"int");

	var strippedSchdlAdminYr4=strippedSchdlAdminYr3*(1+parseFloat(mrtIncrs));
	var schdlAdminYr4=formatNumber(strippedSchdlAdminYr4,"int");

	var strippedTotSaveYr4=strippedProdEfrtYr4+strippedAccTrnOvrYr4+strippedCycleSnkrntYr4+strippedQltyRewrkYr4+strippedFlxbltyTunObjYr4+strippedSchdlAdminYr4;
	var totSaveYr4=formatNumber(strippedTotSaveYr4,"int");

//	var strippedTotCostYr4=Math.round((strippedTotMgrs*parseFloat(costMgr)*parseFloat(actvMgrs))*0.1);
	var strippedTotCostYr4=Math.round((strippedTotMgrs*0.8*parseFloat(costMgr)*0.1)*2);
	var totCostYr4=formatNumber(strippedTotCostYr4,"int");

	var strippedNetSaveYr4=strippedTotSaveYr4-strippedTotCostYr4+strippedNetSaveYr3;
	var netSaveYr4=formatNumber(strippedNetSaveYr4,"int");
		

// PAYBACK VARIABLE
	var strippedPayback=(strippedTotCostYr1/strippedTotSaveYr1)*12;
	var payback=formatNumber(strippedPayback,"int");

// IRR VARIABLE
	var initialRate=parseFloat(0.1);
	var increment=parseFloat(0.1);
	var numLoops=0;
	var loopLimit=100;
//	var discount1=parseFloat(1);
	var discount0=parseFloat(1);
	var discount1=discount0/(parseFloat(1)+parseFloat(initialRate));
	var discount2=discount1/(parseFloat(1)+parseFloat(initialRate));
	var discount3=discount2/(parseFloat(1)+parseFloat(initialRate));
	var discount4=discount3/(parseFloat(1)+parseFloat(initialRate));
	var discountedCashFlow1=strippedTotSaveYr1*discount1;
	var discountedCashFlow2=strippedNetSaveYr2*discount2;
	var discountedCashFlow3=strippedNetSaveYr3*discount3;
	var discountedCashFlow4=strippedNetSaveYr4*discount4;
	var totDiscountedCashFlow=(strippedTotCostYr1*-1)+discountedCashFlow1+discountedCashFlow2+discountedCashFlow3+discountedCashFlow4;

	while (totDiscountedCashFlow > 0 && numLoops < loopLimit)
		{
		initialRate+= increment;
		discount0=parseFloat(1);
		discount1=discount0/(parseFloat(1)+parseFloat(initialRate));
		discount2=discount1/(parseFloat(1)+parseFloat(initialRate));
		discount3=discount2/(parseFloat(1)+parseFloat(initialRate));
		discount4=discount3/(parseFloat(1)+parseFloat(initialRate));
		discountedCashFlow1=strippedTotSaveYr1*discount1;
		discountedCashFlow2=strippedNetSaveYr2*discount2;
		discountedCashFlow3=strippedNetSaveYr3*discount3;
		discountedCashFlow4=strippedNetSaveYr4*discount4;
		totDiscountedCashFlow=(strippedTotCostYr1*-1)+discountedCashFlow1+discountedCashFlow2+discountedCashFlow3+discountedCashFlow4;
		numLoops++;
		}
	increment/= parseFloat(10);
// alert ("increment="+increment);
	while (totDiscountedCashFlow < 0 && numLoops < loopLimit)
		{
		initialRate-= increment;
		discount0=parseFloat(1);
		discount1=discount0/(parseFloat(1)+parseFloat(initialRate));
		discount2=discount1/(parseFloat(1)+parseFloat(initialRate));
		discount3=discount2/(parseFloat(1)+parseFloat(initialRate));
		discount4=discount3/(parseFloat(1)+parseFloat(initialRate));
		discountedCashFlow1=strippedTotSaveYr1*discount1;
		discountedCashFlow2=strippedNetSaveYr2*discount2;
		discountedCashFlow3=strippedNetSaveYr3*discount3;
		discountedCashFlow4=strippedNetSaveYr4*discount4;
		totDiscountedCashFlow=(strippedTotCostYr1*-1)+discountedCashFlow1+discountedCashFlow2+discountedCashFlow3+discountedCashFlow4;
		numLoops++;
		}
	var irr = Math.round(initialRate*100);
	var base = "<table border='0' cellpadding='0' cellspacing='0' width='100%'>";
	base += "<tr>";
	base += "<td colspan='3' class='noBG'>+ DERIVED DATA</td>";
	base += "</tr><tr>";
	base += "<td width='70%' class='ltaquaBG'>Employees/manager</td>";
	base += "<td width='30%' class='dkaquaBG'>&nbsp;&nbsp;&nbsp;"+empsPerMgr+"</td>";


/*			<tr>
			<td class="yellowBG">empl/mgr</td>
			<td class="peachBG">&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="empsPerMgr" value="10" align="absmiddle" size="10" style="text-align:right;padding-right:1px;background:#FFFFFF;" onBlur="this.value=formatNumber(stripIt(this.value));calcROI()"></td>
			</tr>
	base += "</tr><tr>";
	base += "<td class='text'>Total HR representatives</td>";
	base += "<td class='text'>&nbsp;&nbsp;&nbsp;"+totHrReps+"</td>";
*/			
	base += "</tr><tr>";
	base += "<td class='ltaquaBG'>Payroll cost/head (incl Fringes)</td>";
	base += "<td class='dkaquaBG' valign='top'>$ "+costPyrl+"</td>";
	base += "</tr><tr>";
	base += "<td class='ltaquaBG'>Cost/Employee/Hour</td>";
	base += "<td class='dkaquaBG'>$ "+costEmpHr+"</td>";
	base += "</tr></table>";

// Print the Summary table on the page (checking for IE vs. Netscape)...

	if (document.getElementById)
		{
		x = document.getElementById("Summary");
		x.innerHTML = base;
		}
	else if (document.all)
		{
		document.all["Summary"].innerHTML = base;
		}


	var newBase = "";
	newBase += "<table border='0' cellpadding='0' cellspacing='0' width='100%'>";
	newBase += "<tr>";
	newBase += "<td colspan='2' class='noBG'>= COST/BENEFIT</td>";
	newBase += "<td class='noBG' align='center'>year 1</td>";
	newBase += "<td class='noBG' align='center'>year 2</td>";
	newBase += "<td class='noBG' align='center'>year 3</td>";
	newBase += "<td class='noBG' align='center'>year 4</td>";
	newBase += "</tr>";
	newBase += "<tr>";
	newBase += "<td width='16%' class='textB'>Productivity</td>";
	newBase += "<td width='20%' class='textI'>Level of Effort&nbsp;<img src='../images/demo/help.gif' border='0' onMouseover=\"ddrivetip('Reduce non-productive work by all managers.','#CCCCCC', 300)\"  onMouseout='hideddrivetip()'></td>";
	newBase += "<td width='16%' class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+prodEfrtYr1+"</td></tr></table></td>";
	newBase += "<td width='16%' class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+prodEfrtYr2+"</td></tr></table></td>";
	newBase += "<td width='16%' class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+prodEfrtYr3+"</td></tr></table></td>";
	newBase += "<td width='16%' class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+prodEfrtYr4+"</td></tr></table></td>";
	newBase += "<tr>";
	newBase += "<td class='textB'>Accuracy</td>";
	newBase += "<td class='textI'>Annual Turnover&nbsp;<img src='../images/demo/help.gif' border='0' onMouseover=\"ddrivetip('Update actual heads / organization.  Modify budget allocation on the fly.','#CCCCCC', 300)\"  onMouseout='hideddrivetip()'></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+accTrnOvrYr1+"</td></tr></table></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+accTrnOvrYr2+"</td></tr></table></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+accTrnOvrYr3+"</td></tr></table></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+accTrnOvrYr4+"</td></tr></table></td>";
	newBase += "</tr>";
	newBase += "<tr>";
	newBase += "<td class='textB'>Cycle Time</td>";
	newBase += "<td class='textI'>Sneakernet&nbsp;<img src='../images/demo/help.gif' border='0' onMouseover=\"ddrivetip('HR time managing flow / consolidation of diskettes and/or files for Excel.','#CCCCCC', 300)\"  onMouseout='hideddrivetip()'></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+cycleSnkrntYr1+"</td></tr></table></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+cycleSnkrntYr2+"</td></tr></table></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+cycleSnkrntYr3+"</td></tr></table></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+cycleSnkrntYr4+"</td></tr></table></td>";
	newBase += "</tr>";
	newBase += "<tr>";
	newBase += "<td class='textB'>Quality</td>";
	newBase += "<td class='textI'>Rework&nbsp;<img src='../images/demo/help.gif' border='0' onMouseover=\"ddrivetip('Online iteration instead of complete re-do.','#CCCCCC', 300)\"  onMouseout='hideddrivetip()'></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+qltyRewrkYr1+"</td></tr></table></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+qltyRewrkYr2+"</td></tr></table></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+qltyRewrkYr3+"</td></tr></table></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+qltyRewrkYr4+"</td></tr></table></td>";
	newBase += "</tr>";
	newBase += "<tr>";
	newBase += "<td class='textB'>Flexibility</td>";
	newBase += "<td class='textI'>Tuning Objectives&nbsp;<img src='../images/demo/help.gif' border='0' onMouseover=\"ddrivetip('Ability to adjust targets during budget process.','#CCCCCC', 300)\"  onMouseout='hideddrivetip()'></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+flxbltyTunObjYr1+"</td></tr></table></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+flxbltyTunObjYr2+"</td></tr></table></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+flxbltyTunObjYr3+"</td></tr></table></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+flxbltyTunObjYr4+"</td></tr></table></td>";
	newBase += "</tr>";
	newBase += "<tr>";
	newBase += "<td class='textB'>Schedule</td>";
	newBase += "<td class='textI'>Admin/yr&nbsp;<img src='../images/demo/help.gif' border='0' onMouseover=\"ddrivetip('Remove need to re-start the whole process every year.','#CCCCCC', 300)\"  onMouseout='hideddrivetip()'></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+0+"</td></tr></table></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+schdlAdminYr2+"</td></tr></table></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+schdlAdminYr3+"</td></tr></table></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+schdlAdminYr4+"</td></tr></table></td>";
	newBase += "</tr>";
	newBase += "<tr>";
	newBase += "<td colspan='2' class='textB'>&nbsp;</td>";
	newBase += "<td colspan='4' class='text'>&nbsp;</td>";
	newBase += "</tr>";
	newBase += "<tr>";
	newBase += "<td class='textB'>&nbsp;</td>";
	newBase += "<td class='textB'>Total Saving</td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+totSaveYr1+"</td></tr></table></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+totSaveYr2+"</td></tr></table></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+totSaveYr3+"</td></tr></table></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+totSaveYr4+"</td></tr></table></td>";
	newBase += "</tr>";
	newBase += "<tr>";
	newBase += "<td class='textB'>&nbsp;</td>";
	newBase += "<td class='textB'>Total Cost</td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+totCostYr1+"</td></tr></table></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+totCostYr2+"</td></tr></table></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+totCostYr3+"</td></tr></table></td>";
	newBase += "<td class='text'><table width='75%' class='text'><tr><td align='left'>$&nbsp;</td><td align='right'>"+totCostYr4+"</td></tr></table></td>";
	newBase += "</tr>";
	newBase += "<tr>";
	newBase += "<td class='noBGcolor'>&nbsp;</td>";
	newBase += "<td class='noBGcolorB'>Net Savings</td>";
	newBase += "<td class='noBGcolor'><table width='75%' class='noBGcolor'><tr><td align='left'>$&nbsp;</td><td align='right' class='noBGcolor'>"+netSaveYr1+"</td></tr></table></td>";
	newBase += "<td class='noBGcolor'><table width='75%' class='noBGcolor'><tr><td align='left'>$&nbsp;</td><td align='right' class='noBGcolor'>"+netSaveYr2+"</td></tr></table></td>";
	newBase += "<td class='noBGcolor'><table width='75%' class='noBGcolor'><tr><td align='left'>$&nbsp;</td><td align='right' class='noBGcolor'>"+netSaveYr3+"</td></tr></table></td>";
	newBase += "<td class='noBGcolor'><table width='75%' class='noBGcolor'><tr><td align='left'>$&nbsp;</td><td align='right' class='noBGcolor'>"+netSaveYr4+"</td></tr></table></td>";
	newBase += "</tr>";
	newBase += "<tr>";
	newBase += "<td colspan='6' class='noBGcolor'>&nbsp;</td>";
	newBase += "</tr>";
	newBase += "<tr class='blueBG'>";
	newBase += "<td class='textHead'>Payback</td>";
	newBase += "<td class='textHead' colspan='2'>"+payback+" months</td>";
	newBase += "<td class='textHead' colspan='2'>IRR "+irr+" %</td>";
	newBase += "<td>&nbsp;</td>";	
	newBase += "</tr></table>";

	if (document.getElementById)
		{
		y = document.getElementById('CostBenefit');
		y.innerHTML = newBase;
		}
	else if (document.all)
		{
		document.all['CostBenefit'].innerHTML = newBase;
		}
	}
	

function stripIt(val)
	{
	temp = new String(val);
	temp = temp.substring(temp.indexOf("$")+1,temp.length);
	while(temp.indexOf(",")!=-1)
		{
		temp = temp.replace(",","");
		}
	return temp;  
	}
	
function formatNumber(val,type)
	{
	var temp = stripIt(val);
	var temp2 = "";
	var neg = "";
	if(type == "int")
		{
		temp = parseInt(temp);
		}
	else
		{
		temp = parseFloat(temp);
		}

	temp = Math.floor(100*temp)/100;
	temp = String(temp);
	if (temp.indexOf("-") != -1)
		{
		temp = temp.substr(1);
		neg = -1;
		}
//alert("temp1 == "+temp);    
	if (temp!="" && temp.length>3 && (temp.indexOf(".")>3) || temp.indexOf(".")==-1)
		{
		j=temp.length;
		j=j-3;
		temp2="";
		   
		while(j>0)
			{
			temp2=","+temp.substr(j,3)+temp2;	
			j=j-3;
			}
		j=j+3;
		temp2=temp.substring(0,j)+temp2;
//alert("temp2 == "+temp2);    
		} 
	else 
		{
		temp2=temp;
		}
	if(neg == -1)
		{
		temp2 = "-".concat(temp2);
		}
//alert("temp3 == "+temp2);    
	return temp2;
	}

function dressIt(str)
	{
    var dec = 0;
	var numLeft = str.toString();
	var formattedValue = "";
	var point =0;
    var minus ="";
    var minuspos =numLeft.indexOf("-"); 
// Check to see if the number has minus symbol
	if(!(minuspos == -1))
		{
		numLeft = numLeft.substring(minuspos+1);
        minus="-";
		}	

// Check to see if the number has a decimal point - reset 'numLeft' & 'dec' if it does...
     point = numLeft.indexOf("."); 
	if(!(point == -1))
		{
		numLeft = numLeft.substring(0, point);
		dec = numLeft.substring(point);
		}	
	
// Find out how big our working string is...
	var lenLeft = numLeft.length;
	
// While there are '> 3' characters left, insert a comma 3 from the end of what's left... 
	while(lenLeft > 3)
		{
		var part2 = numLeft.substring(lenLeft-3, lenLeft);
//alert("formattedValue == "+formattedValue+", part2 == "+part2+", lenLeft == "+lenLeft);
		if(formattedValue == "")
			{
			formattedValue = part2;
			}
		else
			{
			formattedValue = part2 + "," + formattedValue;
			}
// Decrement lenLeft...
		lenLeft = lenLeft - 3;
		}

// Now there are less than 3 characters left, so grab them and pre-pend them to the formattedValue...
	var part1 = numLeft.substring(0, lenLeft);

	if(numLeft.length > 3)
		{
		formattedValue = part1 + "," + formattedValue;
		}
	else
		{
		formattedValue = part1 + formattedValue;
		}

// If we started with a decimal, glue that back on the end of the formatted number
	if(!(dec == 0))
		{
		formattedValue = formattedValue.concat(dec);
		}
	
	return minus+formattedValue;
	}
	
