function clearAgeVerificationInputs()
{
	if (!document.getElementById) return;
	var dayInput = document.getElementById("s1");
	var monthInput = document.getElementById("s2");
	var yearInput = document.getElementById("s3");
	
	// Check our 'Day' input
	if (dayInput)
	{
		dayInput.onfocus = function()
		{
			if (dayInput.value == 'dd') dayInput.value = '';
		}
		dayInput.onkeyup = function()
		{
			if(dayInput.value.length == 2 && isNumeric(dayInput.value) && dayInput.value <= '31') monthInput.focus();
		}
		dayInput.onblur = function()
		{
			if (dayInput.value != 'dd')
			{
				if (!isNumeric(dayInput.value)) dayInput.value = 'dd';
			}
			if (dayInput.value == '') dayInput.value = 'dd';
			if (dayInput.value > '31') dayInput.value = 'dd';
		}
	}
	
	// Check our 'Month' input
	if (monthInput)
	{
		monthInput.onfocus = function()
		{
			if (monthInput.value == 'mm') monthInput.value = '';
		}
		monthInput.onkeyup = function()
		{
			if (monthInput.value.length == 2 && isNumeric(monthInput.value) && monthInput.value <= '12') yearInput.focus();
		}
		monthInput.onblur = function()
		{
			if (monthInput.value != 'mm')
			{
				if (!isNumeric(monthInput.value)) monthInput.value = 'mm';
			}
			if (monthInput.value == '') monthInput.value = 'mm';
			if (monthInput.value > '12') monthInput.value = 'mm';
		}
	}
	
	// Check our 'Year' input
	if (yearInput)
	{
		yearInput.onfocus = function()
		{
			if (yearInput.value == 'aaaa') yearInput.value = '';
		}
		yearInput.onblur = function()
		{
			if (yearInput.value != 'aaaa')
			{
				if (!isNumeric(yearInput.value)) yearInput.value = 'aaaa';
			}
			if (yearInput.value == '') yearInput.value = 'aaaa';
		}
	}
}

function isNumeric(string)
{
	if(string.search(/^[0-9]*$/) != -1) return true;
	else return false;
}

function addLoadEvent(func)
{
	var oldonload = window.onload;
	if (typeof window.onload != 'function')
	{
		window.onload = func;
	}
	else
	{
		window.onload = function()
		{
			if (oldonload)
			{
				oldonload();
			}
			func();
		}
	}
}

addLoadEvent(clearAgeVerificationInputs);