function blank_year( year )
{
	if( year.value == "YYYY" )
	{
		year.value = "";
	}
}
function blank_month( month )
{
	if( month.value == "MM" )
	{
		month.value = "";
	}
}
function blank_day( day )
{
	if( day.value == "DD" )
	{
		day.value = "";
	}
}
function checkyear( year )
{
	yr = parseInt( year.value, 10 );
	if( isNaN( yr ) == true )
	{
		alert("You must supply a four digit year." );
		return false;
	}
	if( year.value == "" )
	{
		alert("You must supply a year." );
		return false;
	}
	else if ( (yr < 100) && (yr > 50) )
		year.value = "19" + year.value;
	else if ( (yr < 100) && (yr <= 50) )
		year.value = "20" + year.value;
	return true;
}
function checkmonth( month )
{
	if( month.value == "" )
	{
		alert("You must supply a month." );
		return false;
	}
	mon = parseInt( month.value, 10 );
	if( isNaN( mon ) == true )
	{
		alert("You must supply a two digit month." );
		return false;
	}
	if ( (mon < 1) || (mon > 12) )
	{
		alert("The month must be between 1 and 12." );
		return false;
	}
	if( month.value.length == 1 )
	{
		month.value = "0" + month.value;
	}
	return true;
}
function checkday( day )
{
	dy = parseInt( day.value, 10 );
	if( isNaN( dy ) == true )
	{
		alert("You must supply a two digit day." );
		return false;
	}
	if( day.value == "" )
	{
		alert("You must supply a day." );
		return false;
	}
	else if ( (dy < 1) || (dy > 31) )
	{
		alert("The day must be between 1 and 31." );
		return false;
	}
	if( day.value.length == 1 )
		day.value = "0" + day.value;

	return true;
}
function checkjday( day )
{
	dy = parseInt( day.value, 10 );
	if( isNaN( dy ) == true )
	{
		alert("You must supply a three digit day." );
		return false;
	}
	if( day.value == "" )
	{
		alert("You must supply a day." );
		return false;
	}
	else if ( (dy < 1) || (dy > 366) )
	{
		alert("The day must be between 1 and 366." );
		return false;
	}

	if( day.value.length == 1 )
	{
		day.value = "00" + day.value;
	}
	else if( day.value.length == 2 )
	{
		day.value = "0" + day.value;
	}

	return true;
}


function checkstartmonth( month )
{
	if( month.value == "" || month.value == "MM")
	{
		alert("You must supply a month." );
		return false;
	}
	mon = parseInt( month.value, 10 );
	if( isNaN( mon ) == true )
	{
		alert("You must supply a two digit month." );
		return false;
	}
	if ( (mon < 1) || (mon > 12) )
	{
		alert("The month must be between 1 and 12." );
		return false;
	}
	if( month.value.length == 1 )
	{
		month.value = "0" + month.value;
	}
	return true;
}
function checkstartday( day )
{
	if( day.value == "" || day.value == "DD") {
		alert("You must supply a day." );
		return false;
	}
	dy = parseInt( day.value, 10 );
	if( isNaN( dy ) == true ) {
		alert("You must supply a valid day." );
		return false;
	} else if ( (dy < 1) || (dy > 31) ) {
		alert("The day must be between 1 and 31." );
		return false;
	}
	if( day.value.length == 1 )
		day.value = "0" + day.value;
	return true;
}

function checkstarthhmmss( hhmmss )
{

	if( hhmmss.value == "") hhmmss.value = "000000";
	var v=parseInt(hhmmss.value, 10);
	if (isNaN(v)) {
		alert("Non-numeric start time: hhmmss" );
		return false;
	}
	else {
		if (hhmmss.value.length != 6) {
			alert("Invalid start time: hhmmss" );
			return false;
		}
		if (hhmmss.value.substring(0,2) > "24" || hhmmss.value.substring(0,2) < "00")  {
			alert("The start hour must be between 00 and 23." );
			return false;
		}
		if (hhmmss.value.substring(2,4) > "59" || hhmmss.value.substring(2,4) < "00") {
			alert("The start minute must be between 0 and 59." );
			return false;
		}
		if (hhmmss.value.substring(4,6) > "59" || hhmmss.value.substring(4,6) < "00") {
			alert("The start second must be between 0 and 59." );
			return false;
		}
	}

	return true;
}
function checkendmonth( month )
{
	if( month.value == "" || month.value == "MM")
	{
		alert("You must supply a month." );
		return false;
	}
	mon = parseInt( month.value, 10 );
	if( isNaN( mon ) == true ) {
		alert("You must supply a valid numeric month." );
		return false;
	}
	if ( (mon < 1) || (mon > 12) )
	{
		alert("The month must be between 1 and 12." );
		return false;
	}
	if( month.value.length == 1 )
	{
		month.value = "0" + month.value;
	}
	return true;
}

function checkendday( day )
{
	if( day.value == "" || day.value == "DD")
	{
		alert("You must supply a day." );
		return false;
	}
	dy = parseInt( day.value, 10 );
	if( isNaN( dy ) == true )
	{
		alert("You must supply a valid numeric day." );
		return false;
	}
	if( day.value == "" )
	{
		alert("You must supply a day." );
		return false;
	}
	else if ( (dy < 1) || (dy > 31) )
	{
		alert("The day must be between 1 and 31." );
		return false;
	}
	if( day.value.length == 1 )
		day.value = "0" + day.value;
	return true;
}


function checkendhhmmss( hhmmss )
{

	if( hhmmss.value == "") hhmmss.value = "235959";
	var v=parseInt(hhmmss.value, 10);
	if (isNaN(v)) {
		alert("Non-numeric end time: hhmmss" );
		return false;
	}
	else {
		if (hhmmss.value.length != 6) {
			alert("Invalid end time: hhmmss" );
			return false;
		}
		if (hhmmss.value.substring(0,2) > "24" || hhmmss.value.substring(0,2) < "00")  {
			alert("The end hour must be between 00 and 23." );
			return false;
		}
		if (hhmmss.value.substring(2,4) > "59" || hhmmss.value.substring(2,4) < "00") {
			alert("The end minute must be between 0 and 59." );
			return false;
		}
		if (hhmmss.value.substring(4,6) > "59" || hhmmss.value.substring(4,6) < "00") {
			alert("The end second must be between 0 and 59." );
			return false;
		}
	}

	return true;
}
