				
					var expensesSubTotal = 0;
					var incomeSubTotal = 0;
					var requestedFunding = 0;
					
					var valueBuffer = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
					
					// create an array - add each value to the array and if currValue isn't 
					// equal to 0.00, subtract the last element in the array (top of the stack)
				
					function calcExpensesSubTotal(id, val) { 
						
						expensesSubTotal -= valueBuffer[parseInt(id)];
						
						var userEntry = validateValues(val);
						
						if(userEntry != "Invalid Entry"){
						
							var dollarVal = trimDollar(userEntry);
							
							dollarVal = dollarVal.replace(/,/, "");
							
							expensesSubTotal += Number(dollarVal);
							expensesSubTotal = expensesSubTotal.toFixed(2);
							document.iFellowApp.expensesSubtotal.value =  expensesSubTotal;
							valueBuffer[parseInt(id)] = Number(dollarVal);
						}
						
						else{
							document.iFellowApp.expensesSubtotal.value =  userEntry;
						}
					} 
					
					function calcRequestedFunding(){
						requestedFunding = expensesSubTotal - incomeSubTotal;
						requestedFunding = requestedFunding.toFixed(2);

						if (requestedFunding >= 0){
							document.iFellowApp.requestedFunding.value =  requestedFunding;
						}
						
						else{
							document.iFellowApp.requestedFunding.value =  0;
						}
					}					
					
					function calcIncomeSubTotal(id, val) { 
					
						incomeSubTotal -= valueBuffer[parseInt(id)];
						
						var userEntry = validateValues(val);
						
						if(userEntry != "Invalid Entry"){
						
							var dollarVal = trimDollar(userEntry);
							
							dollarVal = dollarVal.replace(/,/, "");
							
							incomeSubTotal += Number(dollarVal);
							incomeSubTotal = incomeSubTotal.toFixed(2);
							document.iFellowApp.incomeSubTotal.value =  incomeSubTotal;
							valueBuffer[parseInt(id)] = Number(dollarVal);
							calcRequestedFunding();
						}
						
						else{
							document.iFellowApp.incomeSubtotal.value =  userEntry;
						}
					}
					
					function trimDollar(val){
						while (val.substring(0,1) == '$')
						{
							val = val.substring(1, val.length);
						}	
						return val;
					}

					function alltrim(sString) {
						while (sString.substring(0,1) == ' ')
						{
							sString = sString.substring(1, sString.length);
						}
						while (sString.substring(sString.length-1, sString.length) == ' ')
						{
							sString = sString.substring(0,sString.length-1);
						}
						return sString;
					}

					function validateValues(str) {
						str = alltrim(str);
						if (/^\$?[1-9][0-9]{0,2}(,[0-9]{3})*(\.[0-9]{0,2})?$/.test(str) ) {
							if (/\.[0-9]$/.test(str) ) {
							str += "0";
							}
							else if (/\.$/.test(str)) {
								str += "00";
							}
							else if (!/\.[0-9]{2}$/.test(str) ) {
								str += ".00";
							}
							return str;
						}
						else {
							return "Invalid Entry";
						}
					}
					
					