var flag = true;
function chkNums()
{
	for (i = 0; i < document.f.length; i++)
	{
		if (i > 0 && i < 7)
		{
			if (isNaN(document.f[i].value))
			{
				alert("The date fields must contain only numeric values.")
				return false;
			}
		}
	}
	return true;
}
function chkNumsNews()
{
	for (i = 0; i < document.f.length; i++)
	{
		if (i > 1 && i < 5)
		{
			if (isNaN(document.f[i].value))
			{
				alert("The date fields must contain only numeric values.")
				return false;
			}
		}
	}
	return true;
}
function chkNumsEvents()
{
	for (i = 0; i < document.f.length; i++)
	{
		if (i > 1 && i < 8)
		{
			if (isNaN(document.f[i].value))
			{
				alert("The date fields must contain only numeric values.")
				return false;
			}
		}
	}
	return true;
}
function valFrom()
{
	d = new Date();
	if(flag)
		return true
	else
	{
		if (document.f.fmonth.value == "" || document.f.fmonth.value < 1 || document.f.fmonth.value > 12)
		{
			alert("Please either do not fill any of the date fields or at least fill the month field with a valid value");
			document.f.fmonth.focus();
			return false;
		}
		else
		{
			if (document.f.fday.value == "" || document.f.fday.value < 1 || document.f.fday.value > 31)
			{
				document.f.fday.value = "01";
			}
			if (document.f.fyear.value == "")
			{
				if (!document.layers)
					document.f.fyear.value = d.getYear();
				else
					document.f.fyear.value = d.getYear() + 1900;
			}
			return true;
		}
	}
}
function valTo()
{
	d = new Date();
	if(flag)
		return true
	else
	{
		if (document.f.tmonth.value == "" || document.f.tmonth.value < 1 || document.f.tmonth.value > 12)
		{
			alert("Please either do not fill any of the date fields or at least fill the month field with a valid value");
			document.f.tmonth.focus();
			return false;
		}
		else
		{
			if (document.f.tday.value == "" || document.f.tday.value < 1 || document.f.tday.value > 31)
			{
				document.f.tday.value = "01";
			}
			if (document.f.tyear.value == "")
			{
				if (!document.layers)
					document.f.tyear.value = d.getYear();
				else
					document.f.tyear.value = d.getYear() + 1900;
			}
			return true;
		}
	}
}
