<!-- Begin
var Num800Machines;
var DaysToEmpty;

function HowMany(form) {
var DailyTotal;
var WeeklyTotal;
var MonthlyTotal;
var YearlyTotal;
var NumEmpties;
var Begin;
var End;

NumEmpties = 365 / DaysToEmpty;

DailyTotal = (Num800Machines * NumEmpties * 200 / 365);
DailyTotal = "" + ((Math.round(DailyTotal * 100)) / 100);
dec1 = DailyTotal.substring(DailyTotal.length-3, DailyTotal.length-2);
dec2 = DailyTotal.substring(DailyTotal.length-2, DailyTotal.length-1);

if (dec1 != '.') { // adds trailing zeroes if necessary
if (dec2 == '.') DailyTotal += "0";
else DailyTotal += ".00";
}


WeeklyTotal = (Num800Machines * NumEmpties * 200 / 52);
WeeklyTotal = "" + ((Math.round(WeeklyTotal * 100)) / 100);
dec1 = WeeklyTotal.substring(WeeklyTotal.length-3, WeeklyTotal.length-2);
dec2 = WeeklyTotal.substring(WeeklyTotal.length-2, WeeklyTotal.length-1);

if (dec1 != '.') { // adds trailing zeroes if necessary
if (dec2 == '.') WeeklyTotal += "0";
else WeeklyTotal += ".00";
}


MonthlyTotal = (Num800Machines * NumEmpties * 200 / 12);
MonthlyTotal = "" + ((Math.round(MonthlyTotal * 100)) / 100);
dec1 = MonthlyTotal.substring(MonthlyTotal.length-3, MonthlyTotal.length-2);
dec2 = MonthlyTotal.substring(MonthlyTotal.length-2, MonthlyTotal.length-1);

if (dec1 != '.') { // adds trailing zeroes if necessary
if (dec2 == '.') MonthlyTotal += "0";
else MonthlyTotal += ".00";
}


YearlyTotal = (Num800Machines * NumEmpties * 200);
YearlyTotal = "" + ((Math.round(YearlyTotal * 100)) / 100);
dec1 = YearlyTotal.substring(YearlyTotal.length-3, YearlyTotal.length-2);
dec2 = YearlyTotal.substring(YearlyTotal.length-2, YearlyTotal.length-1);

if (dec1 != '.') { // adds trailing zeroes if necessary
if (dec2 == '.') YearlyTotal += "0";
else YearlyTotal += ".00";
}

/* Insert comma */
if (DailyTotal.length > 6) {
Begin = DailyTotal.substring(0,DailyTotal.length-6);
End = DailyTotal.substring(DailyTotal.length-6,DailyTotal);
DailyTotal = Begin + "," + End;
}

if (WeeklyTotal.length > 6) {
Begin = WeeklyTotal.substring(0,WeeklyTotal.length-6);
End = WeeklyTotal.substring(WeeklyTotal.length-6,WeeklyTotal);
WeeklyTotal = Begin + "," + End;
}

if (MonthlyTotal.length > 6) {
Begin = MonthlyTotal.substring(0,MonthlyTotal.length-6);
End = MonthlyTotal.substring(MonthlyTotal.length-6,MonthlyTotal);
MonthlyTotal = Begin + "," + End;
}

if (YearlyTotal.length > 6) {
Begin = YearlyTotal.substring(0,YearlyTotal.length-6);
End = YearlyTotal.substring(YearlyTotal.length-6,YearlyTotal);
YearlyTotal = Begin + "," + End;
}

form.DailyTotal.value = '$ ' + DailyTotal;
form.WeeklyTotal.value = '$ ' + WeeklyTotal;
form.MonthlyTotal.value = '$ ' + MonthlyTotal;
form.YearlyTotal.value = "$ " + YearlyTotal; // display total amount

}
function SetNum800Machines(units) {
Num800Machines = ignoreCommas (units.value);
}

function SetDaysToEmpty(units) {
DaysToEmpty = ignoreCommas (units.value);
}

function ignoreCommas(string) {
	var temp = "";
	string = '' + string;
	splitstring = string.split(",");
	for(i = 0; i < splitstring.length; i++)
		temp += splitstring[i];
	return temp;
}

function ClearForm(form){
form.Num800Machines.value = "";
form.DaysToEmpty.value = "";
form.DailyTotal.value = "";
form.WeeklyTotal.value = "";
form.MonthlyTotal.value = "";
form.YearlyTotal.value = "";
}
// End -->
