<!--
function stripNonNumerics(formField)
{

	for(var n=0; n<document.networth.elements.length; n++){
		if(document.networth.elements[n].name==formField){
			//move form field value to a working variable
			var workValue=parseFloat(document.forms[0].elements[n].value);

			//loop through the working variable removing any non-numeric characters
		    for (var i=1; i<=workValue.length ; i++)
			{
				if ((workValue.charAt(i-1) != "0") &&
					(workValue.charAt(i-1) != "1") &&
					(workValue.charAt(i-1) != "2") &&
					(workValue.charAt(i-1) != "3") &&
					(workValue.charAt(i-1) != "4") &&
					(workValue.charAt(i-1) != "5") &&
					(workValue.charAt(i-1) != "6") &&
					(workValue.charAt(i-1) != "7") &&
					(workValue.charAt(i-1) != "8") &&
					(workValue.charAt(i-1) != "9")){
					workValue=workValue.substring(0,i-1) + workValue.substring(i,workValue.length)
					i=0
				}
			}
			
			//if what's left of the working variable is not a number (NaN)
			//then clear the form field, 
			//otherwise set the form field to the value of the working variable    
			if (isNaN(workValue)){
				document.networth.elements[n].value = "";
			}else{	
		        document.networth.elements[n].value = workValue;	
			}
		
		    //now call the function to recalculate the entire form
			calcFields();
		}
	}
}

function calcFields() 
{ 
   // Cash
   var checking = parseFloat(document.networth.checking.value);
   if (isNaN(checking)) checking = 0;
   
   var saving = parseFloat(document.networth.saving.value);
   if (isNaN(saving)) saving = 0;
      
   var cdeposit = parseFloat(document.networth.cdeposit.value);
   if (isNaN(cdeposit)) cdeposit = 0;
   
   var mmarket = parseFloat(document.networth.mmarket.value);
   if (isNaN(mmarket)) mmarket = 0;
   
    var othercash = parseFloat(document.networth.othercash.value);
   if (isNaN(othercash)) othercash = 0;

   var totalCash = checking + saving + mmarket + cdeposit + othercash;
   document.networth.totalCash.value = Math.round(100*totalCash)/100;
   
   // Long term dept
   var hmortgage = parseFloat(document.networth.hmortgage.value);
   if (isNaN(hmortgage)) hmortgage = 0;
   
   var omortgage = parseFloat(document.networth.omortgage.value);
   if (isNaN(omortgage)) omortgage = 0;
      
   var lloan = parseFloat(document.networth.lloan.value);
   if (isNaN(lloan)) lloan = 0;
   
   var rloan = parseFloat(document.networth.rloan.value);
   if (isNaN(rloan)) rloan = 0;
   
   var eloan = parseFloat(document.networth.eloan.value);
   if (isNaN(eloan)) eloan = 0;
   
    var otherlloan = parseFloat(document.networth.otherlloan.value);
   if (isNaN(otherlloan)) otherlloan = 0;

   var totalLongTermDebt = hmortgage + omortgage + lloan + rloan + eloan + otherlloan;
   document.networth.totalLongTermDebt.value = Math.round(100*totalLongTermDebt)/100;
   
   // NRA
   var stocks = parseFloat(document.networth.stocks.value);
   if (isNaN(stocks)) stocks = 0;
   
   var bonds = parseFloat(document.networth.bonds.value);
   if (isNaN(bonds)) bonds = 0;
      
   var mfunds = parseFloat(document.networth.mfunds.value);
   if (isNaN(mfunds)) mfunds = 0;
   
   var ussbonds = parseFloat(document.networth.ussbonds.value);
   if (isNaN(ussbonds)) ussbonds = 0;
   
    var othernra = parseFloat(document.networth.othernra.value);
   if (isNaN(othernra)) othernra = 0;

   var totalNRA = stocks + bonds + mfunds + ussbonds + othernra;
   document.networth.totalNRA.value = Math.round(100*totalNRA)/100;

   // Short term dept
   var ccdebt = parseFloat(document.networth.ccdebt.value);
   if (isNaN(ccdebt)) ccdebt = 0;
   
   var stockdebt = parseFloat(document.networth.stockdebt.value);
   if (isNaN(stockdebt)) stockdebt = 0;
      
   var carloan = parseFloat(document.networth.carloan.value);
   if (isNaN(carloan)) carloan = 0;
   
   var installloan = parseFloat(document.networth.installloan.value);
   if (isNaN(installloan)) installloan = 0;
   
   var taxdue = parseFloat(document.networth.taxdue.value);
   if (isNaN(taxdue)) taxdue = 0;
   
   var otherbills = parseFloat(document.networth.otherbills.value);
   if (isNaN(otherbills)) otherbills = 0;
   
   var othersloan = parseFloat(document.networth.othersloan.value);
   if (isNaN(othersloan)) othersloan = 0;

   var totalshortTermDebt = ccdebt + stockdebt + carloan + installloan + taxdue + otherbills + othersloan;
   document.networth.totalshortTermDebt.value = Math.round(100*totalshortTermDebt)/100;
   
   // Retirement Accounts
   var lifeins = parseFloat(document.networth.lifeins.value);
   if (isNaN(lifeins)) lifeins = 0;
   
   var keough = parseFloat(document.networth.keough.value);
   if (isNaN(keough)) keough = 0;
      
   var annuities = parseFloat(document.networth.annuities.value);
   if (isNaN(annuities)) annuities = 0;
   
   var rothira = parseFloat(document.networth.rothira.value);
   if (isNaN(rothira)) rothira = 0;
   
   var ira = parseFloat(document.networth.ira.value);
   if (isNaN(ira)) ira = 0;
   
   var pensionplan = parseFloat(document.networth.pensionplan.value);
   if (isNaN(pensionplan)) pensionplan = 0;

   var s401k = parseFloat(document.networth.s401k.value);
   if (isNaN(s401k)) s401k = 0;

   var totalRA = lifeins + keough + annuities + rothira + ira + pensionplan + s401k;
   document.networth.totalRA.value = Math.round(100*totalRA)/100;
  
   // Property
    var home = parseFloat(document.networth.home.value);
   if (isNaN(home)) home = 0;
   
   var vehicle = parseFloat(document.networth.vehicle.value);
   if (isNaN(vehicle)) vehicle = 0;
      
   var otherre = parseFloat(document.networth.otherre.value);
   if (isNaN(otherre)) otherre = 0;
   
   var furniture = parseFloat(document.networth.furniture.value);
   if (isNaN(furniture)) furniture = 0;
   
   var jewelry = parseFloat(document.networth.jewelry.value);
   if (isNaN(jewelry)) jewelry = 0;
   
   var totalproperty = home + vehicle + otherre + furniture + jewelry;
   document.networth.totalproperty.value = Math.round(100*totalproperty)/100;
  
  // College
   var flprepaid = parseFloat(document.networth.flprepaid.value);
   if (isNaN(flprepaid)) flprepaid = 0;
   
   var collsav = parseFloat(document.networth.collsav.value);
   if (isNaN(collsav)) collsav = 0;
   
   var totalcollege = flprepaid + collsav;
   document.networth.totalcollege.value = Math.round(100*totalcollege)/100;
   
   // Bussiness assets
   var busownint = parseFloat(document.networth.busownint.value);
   if (isNaN(busownint)) busownint = 0;
   
   var buspart = parseFloat(document.networth.buspart.value);
   if (isNaN(buspart)) buspart = 0;
   
   var busother = parseFloat(document.networth.busother.value);
   if (isNaN(busother)) busother = 0;
   
   var totalbusiness = busownint + buspart + busother ;
   document.networth.totalbusiness.value = Math.round(100*totalbusiness)/100;
   
   // totals
   var total_assets = totalCash + totalNRA + totalRA + totalproperty + totalcollege + totalbusiness;
   document.networth.total_assets.value = Math.round(100*total_assets)/100;
   
   var total_liablities = totalLongTermDebt + totalshortTermDebt;
   document.networth.total_liablities.value = Math.round(100*total_liablities)/100;
 
   var net_worth = total_assets - total_liablities;
   document.networth.net_worth.value = Math.round(100*net_worth)/100;
  
}
-->