			function calculate() {
				var o = document.form;
				// calculate values
				var t_invested = o.num.value * o.cost.value;
				var t_closed   = o.num.value * o.closed.value * .01 * o.amount.value;
				var t_earned   = (t_closed * .01 * o.collected.value) - t_invested;
				var roi        = 100.0 * t_earned / t_invested;
				// round up values
				t_invested = Math.round(t_invested);
				t_closed   = Math.round(t_closed);
				t_earned   = Math.round(t_earned);
				roi        = Math.round(roi);
				// commify values
				t_invested = commify(t_invested);
				t_closed   = commify(t_closed);
				t_earned   = commify(t_earned);
				roi        = commify(roi);
				// output values
				o.t_invested.value = t_invested;
				o.t_closed.value   = t_closed;
				o.t_earned.value   = t_earned;
				o.roi.value        = roi+"%";
			}
			function commify(amount) {
				var delimiter = ",";
				var re = /\./;
				var isdec;
				if (re.test(amount)) {
					isdec = true;
				} else {
					isdec = false;
					amount = amount + '.00';
				}
				var tmpamount = amount
				var a = tmpamount.split('.',2)
				var d = a[1];
				var i = parseInt(a[0]);
				if(isNaN(i)) { return ''; }
				var minus = '';
				if(i < 0) { minus = '-'; }
				i = Math.abs(i);
				var n = new String(i);
				var a = [];
				while(n.length > 3) {
					var nn = n.substr(n.length-3);
					a.unshift(nn);
					n = n.substr(0,n.length-3);
				}
				if(n.length > 0) { a.unshift(n); }
				n = a.join(delimiter);
				if(isdec == true)
				n = n + '.' + d;
				amount = minus + n;
				return amount;
			}
		
		/* Adapted from a tutorial on mredkj.com - thanks guys! */
		
		// set up allowable characters
		var reg = /(\d|\x46|\x08|\x09)/; // digits, backspace, delete & tab chars
		var reg2 = /(\x46|\x08|\x09)/; // backspace, delete & tab chars
		
		// function to prevent anything but digits from being entered
		function noLetters(e) {
		
			// set up variables
			var key;
			if (window.event) {
				// for IE, e.keyCode or window.event.keyCode can be used
				key = e.keyCode; 
		
			} else if (e.which) {
				// netscape
				key = e.which; 
		
			} else {
				// no event, so pass through
				return true;
		
			}
		
			// return the boolean regex test results of the stringified character
			return reg.test( String.fromCharCode(key) );
		
		}