
<!--
//********************************************************
//* Created for Orion Systems by Scott A. Caldwell
//* 2005-09-14
//* excel.js
//* core functions to support excel-like page behavior
//********************************************************
//********************************************************
//* formatdollar
//* 	formats a string into dollars and cents
//*		of only dollars depending on whether
//*		whdol is true or false
//********************************************************
var whdol = false;
function formatdollar(s) {
	if (s == '') {
		s='0.00';
	} else {
		if (s == 0) {
			s='0.00';
		} else {
			t=s.toString();
			k=t.indexOf('.',0);
			if (k == -1) {
				s=t+'.00';
			} else {
				x=t.length;
				y=k+3;
				if (x < y) {
					s=t;
					for (k=x; k < y; k++) {
						s += '0';
					}
				} else {
					s=t.substring(0,y);
				}
			}
		}
	}
	if (whdol == true) {
		k=s.length-3;
		t=s.substring(0,k);
		s=t;
	}
	return s;
}
//********************************************************
//* gensum
//* 	returns the sum of a list of numbers
//*		the first parameter passed (i) is the count
//*		of the numbers in the list
//********************************************************
function gensum(i,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17) {
	var k,x,y,s,t;
	s=0;
	for (k=1; k <= i; k++) {
		eval('x=s'+k+';');
		y=(x == '') ? 0 : parseFloat(x);
		s += y;
	}
	s = formatdollar(s);
	return s;
}
//********************************************************
//* gendiff
//* 	returns the cumulative difference of a list of
//*		numbers, the first parameter passed (i) is the count
//*		of the numbers in the list.
//*		the first number number is the base and each
//*		number after that in the list is subtracted
//*		from the running difference.
//********************************************************
function gendiff(i,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17) {
	var k,x,y,s,t;
	s=0;
	for (k=1; k <= i; k++) {
		eval('x=s'+k+';');
		y=(x == '') ? 0 : parseFloat(x);
		if (k==1)
			s+=y;
		else
			s -= y;
	}
	s = formatdollar(s);
	return s;
}
//********************************************************
//* reformat
//* 	if the element (c) passed exists,
//*		the cell is reformatted to accommodate a change
//*		in the whdol setting to display whole dollars
//********************************************************
function reformat(c) {
	if (c == undefined) return;
	c.value = formatdollar(c.value);
}
//-->
