function validDate(fld) {
	var testMo, testDay, testYr, inpMo, inpDay, inpYr, msg
	var inp = fld.value
	msg='';
	// attempt to create date object from input data
	var testDate = new Date(inp)
	// extract pieces from date object
	testMo = testDate.getMonth() + 1
	testDay = testDate.getDate()
	testYr = testDate.getFullYear()
	// extract components of input data
	inpMo = parseInt(inp.substring(0, inp.indexOf('/')), 10)
	inpDay = parseInt(inp.substring((inp.indexOf('/') + 1), inp.lastIndexOf('/')), 10)
	inpYr = parseInt(inp.substring((inp.lastIndexOf('/') + 1), inp.length), 10)
	// make sure parseInt() succeeded on input components
	if (isNaN(inpMo) || isNaN(inpDay) || isNaN(inpYr)) {
		msg = 'date is invalid'
	}
	// make sure conversion to date object succeeded
	if (isNaN(testMo) || isNaN(testDay) || isNaN(testYr)) {
		msg = 'date is invalid'
	}
	// make sure values match
	if (testMo != inpMo || testDay != inpDay || testYr != inpYr) {
		msg = 'date is invalid'
	}
	return msg;
}

function dataExists(val) {
	if (trim(val).length == 0) {
		return false;
	}
	else {
		return true;
	}
}

function makeCurrency(val) {
	var cur = 0;
	if (isNaN(val)) {
		cur=-1; //flag failure
	}
	else {
		var num = ''+ Math.round(val * Math.pow(10,2))
		var decpoint;
		while (num.length <= 2) {
			num="0" + num;
		}
		decpoint = num.length - 2;
		num = num.substring(0,decpoint) + '.' + num.substring(decpoint,num.length);
		cur = num;
	}
	return cur;
}

