//Needs functions
	var tmp = new Array();
	var inc = new Array();
	
	function add_needs() {
		var form = document.needs_calc;
			
		tmp[0] = form.m_1.value.replace(/,/g,'')-0;
		tmp[1] = form.m_2.value.replace(/,/g,'')-0;
		tmp[2] = form.m_3.value.replace(/,/g,'')-0;
		tmp[3] = form.m_4.value.replace(/,/g,'')-0;
		tmp[4] = form.m_5.value.replace(/,/g,'')-0;
		tmp[5] = form.m_6.value.replace(/,/g,'')-0;
		tmp[6] = form.m_7.value.replace(/,/g,'')-0;
		tmp[7] = form.m_8.value.replace(/,/g,'')-0;
		tmp[8] = form.m_9.value.replace(/,/g,'')-0;
				
		// add each item in tmp array to total
		expTotal = tmp[0]+tmp[1]+tmp[2]+tmp[3]+tmp[4]+tmp[5]+tmp[6]+tmp[7]+tmp[8];
		
		// display the total expenses
		form.total_m.value = formatAsCurrency(expTotal);
		form.total_me.value = formatAsCurrency(expTotal);
		if(isNaN(expTotal)) {form.total_m.value = "";}
		
	}
	
	function add_income() {
		var form = document.needs_calc;
		var incTotal=0;
		
		tmp[0] = form.i_1.value.replace(/,/g,'')-0;
		tmp[1] = form.i_2.value.replace(/,/g,'')-0;
		tmp[2] = form.i_3.value.replace(/,/g,'')-0;
		
		// add each item in tmp array to total
		incTotal = tmp[0]+tmp[1]+tmp[2];
        // leave out "take home pay" from total
        incPostDisability = tmp[1] + tmp[2];
		
		// display the total income
		form.total_i.value = formatAsCurrency(incTotal);
		form.total_mi.value = formatAsCurrency(incPostDisability);
		if(isNaN(incTotal)) {form.total_i.value = "";}
		find_diff();
	}
	
	function find_diff() {
		var form = document.needs_calc;
		
        if(form.total_i.value=="" || form.total_m.value=="") {
            alert("Please enter your expenses and income.");
        } 
		else {
            var difTotal = expTotal - incPostDisability;
            
			if(difTotal <= 0) {
				form.total_vol.value = 0;
			} 
			else {
				form.total_vol.value = formatAsCurrency(difTotal);
			}
		}
       
	}