function getYears (startDate, endDate) {
/* Calculate the difference in years between startDate and endDate.
   If endDate is not passed, set it to the current date and perform
   the calculations.
*/
	if (typeof endDate == 'undefined') { endDate = new Date() }			//If no endDate is passed set it to current date
	var intYears = endDate.getFullYear() - startDate.getFullYear();		//Get number of years difference
	startDate.setYear(endDate.getFullYear());	//Set endDate year to this year to determine if date has passed
	if (endDate < startDate) intYears--;		//If endDate hasn't occurred yet this year, subtract 1
	return intYears;
}

function dateDiff(strToDate) {
// Calculate the number of days until a certain date (toDate) in the current/next year.
var curDate = new Date();
var toDate = new Date(strToDate);
	toDate.setYear(curDate.getFullYear());		//Ensure toDate is set to the current year.
	if (toDate < curDate) { toDate.setYear(curDate.getFullYear() + 1) }		//If toDate has passed, calculate to next year.
	return ( Math.ceil((toDate - curDate) / (24*60*60*1000)) );
}


