function MonthYearStringToRegularDateString(txtDate)
{
	return txtDate.substring(0,2) + "/1/" + txtDate.substring(3,7);
}

function normalizeYearString(txtYear)
{
	year = parseInt(txtYear, 10);
	if (year < 100)
	{
		if (year < 69)
			year = 2000 + year;
		else
			year = 1900 + year;
	}
	
	return String(year);		
}

function normalizeMonthYearString(txtDate)
{
	var arr, month, year;

	arr = txtDate.replace(".", "/").replace(" ", "/").replace("-", "/").split("/");
	month = parseInt(arr[0], 10); // The ", 10" specifies base ten, necessary to fix an obscure quasi-bug with parseInt where numbers with leading zeroes are pased as octal numbers(!) if no base is specified.
	year = parseInt(arr[1], 10);
	if (month < 10)
		month = '0' + month;
	if (year < 100)
		if (year < 69)
			if (year < 10)
				year = '200' + year;
			else
				year = '20' + year;
		else
			year = '19' + year;
	
	return month + '/' + year;
}

function normalizeDateString(txtDate)
{
	var arr, month, year, day;
	var regex = /^(0?[1-9]|1[0-2])(0?[1-9]|[12][0-9]|3[0-1])(19|20)?[0-9][0-9]$/;
	
	if (regex.test(txtDate))
	{
		month = parseInt(txtDate.substring(0, 2), 10); // The ", 10" specifies base ten, necessary to fix an obscure quasi-bug with parseInt where numbers with leading zeroes are pased as octal numbers(!) if no base is specified.
		day = parseInt(txtDate.substring(2, 4), 10);
		year = parseInt(txtDate.substring(4, 8), 10);
	}
	else
	{
		arr = txtDate.replace(/\./g, "/").replace(/ /g, "/").replace(/-/g, "/").split("/");
		month = parseInt(arr[0], 10); // The ", 10" specifies base ten, necessary to fix an obscure quasi-bug with parseInt where numbers with leading zeroes are pased as octal numbers(!) if no base is specified.
		day = parseInt(arr[1], 10);
		year = parseInt(arr[2], 10);
		
		if (year < 100)
			if (year < 69)
				if (year < 10)
					year = '200' + year;
				else
					year = '20' + year;
			else
				year = '19' + year;
	}
		
	return month + '/' + day + '/' + year;
}

function normalizeDOBDateString(txtDate)
{
	var arr, month, year, day;
	var regex = /^(0?[1-9]|1[0-2])(0?[1-9]|[12][0-9]|3[0-1])(19|20)?[0-9][0-9]$/;
	
	if (regex.test(txtDate))
	{
		month = parseInt(txtDate.substring(0, 2), 10); // The ", 10" specifies base ten, necessary to fix an obscure quasi-bug with parseInt where numbers with leading zeroes are pased as octal numbers(!) if no base is specified.
		day = parseInt(txtDate.substring(2, 4), 10);
		year = parseInt(txtDate.substring(4, 8), 10);
	}
	else
	{
		arr = txtDate.replace(/\./g, "/").replace(/ /g, "/").replace(/-/g, "/").split("/");
		month = parseInt(arr[0], 10); // The ", 10" specifies base ten, necessary to fix an obscure quasi-bug with parseInt where numbers with leading zeroes are pased as octal numbers(!) if no base is specified.
		day = parseInt(arr[1], 10);
		year = parseInt(arr[2], 10);
	}

	var today = new Date();
	var today_mo = today.getMonth();
	var today_dt = today.getDate();
	var today_yr = today.getFullYear();

	if (year < 100)
	{
		if (2000 + year > today_yr)
			year = 1900 + year;
		else
			year = 2000 + year;
	}

	return month + '/' + day + '/' + year;
}

function normalizeYearField(this_field)
{
	this_field.value = normalizeYearString(this_field.value);
}

function normalizeMonthYearField(this_field)
{
	this_field.value = normalizeMonthYearString(this_field.value);
}

function normalizeDateField(this_field)
{
	this_field.value = normalizeDateString(this_field.value);
}

function normalizeDOBDateField(this_field)
{
	this_field.value = normalizeDOBDateString(this_field.value);
}
