
function TestNoSpace(strNom)
{
	var i
	i = 0;
	
	for (i=0; i < strNom.length; i++)
	{
		if(strNom.charAt(i) == ' ')
		{
		alert("You did not obey the rules for entering family names and first names.\nPlease use the 'Rules for entering family names and first names' link on the research page.");
		return(1);
		}
	}
	return(0);
}

function TestIntervalleAnnees(strAnneeInf, strAnneeSup)
{
	if ((strAnneeInf.length == 0) && (strAnneeSup.length == 0))
	{
		return(0);
	}
	else
	{	
		if ((strAnneeInf.length != 0) && (strAnneeSup.length == 0))
		{
			alert("You must specify both dates !");
			return(1);
		}
		else if ((strAnneeInf.length == 0) && (strAnneeSup.length != 0))
		{
			alert("You must specify both dates !");
			return(1);
		}
		else if( isNaN( parseInt(strAnneeInf)) || isNaN(parseInt(strAnneeSup)) )
		{
			alert("Enter numbers only !");
			return(1);
		}
		else if( (strAnneeInf.length != 4) || (strAnneeSup.length != 4))
		{
			alert("You must specify a valid year !");
			return(1);
		}
		else if( parseInt(strAnneeInf) > parseInt(strAnneeSup))
		{
			alert("The second date must be equal or later than the first one!");
			return(1);
		}
		else if( (parseInt(strAnneeInf) < 1549) || (parseInt(strAnneeInf) > 1850) || (parseInt(strAnneeSup) < 1549) || (parseInt(strAnneeSup) > 1850))
		{
			alert("You must specify a year between 1549 and 1850 !");
			return(1);
		}
		else
		{
			return(0);
		}
	}
}
function TestIntervalleDates(strAnneeInf, strMoisInf, strJourInf, strAnneeSup, strMoisSup, strJourSup)
{
	if ((strAnneeInf.length == 0) && (strMoisInf.length == 0) && (strJourInf.length == 0) && (strAnneeSup.length == 0) && (strMoisSup.length == 0) && (strJourSup.length == 0))
	{
		return(0);
	}
	else
	{
		if ((strAnneeInf.length != 0) && (strAnneeSup.length == 0))
		{
			alert("You must specify both dates !");
			return(1);
		}
		else if ((strAnneeInf.length == 0) && (strAnneeSup.length != 0))
		{
			alert("You must specify both dates !");
			return(1);
		}
		else if( isNaN(parseInt(strAnneeInf)) || ((strMoisInf.length !=0 ) && isNaN(parseInt(strMoisInf))) || ( (strJourInf.length !=0 ) && isNaN(parseInt(strJourInf)) ) || isNaN(parseInt(strAnneeSup)) || ((strMoisSup.length !=0 ) && isNaN(parseInt(strMoisSup))) || ((strJourSup.length !=0 ) && isNaN(parseInt(strJourSup))) )
		{
			alert("Enter numbers only !");
			return(1);
		}
		else if( (strAnneeInf.length != 4) || (strAnneeSup.length != 4))
		{
			alert("You must specify a valid year !");
			return(1);
		}
		else if(	( ((strAnneeInf.length == 0) || (strMoisInf.length == 0)) && (strJourInf.length != 0) ) 
				||  ( ((strAnneeSup.length == 0) || (strMoisSup.length == 0)) && (strJourSup.length != 0) )
				)
		{
			alert("You must specify a valid date !");
			return(1);
		}
		else if( parseInt(strAnneeInf) > parseInt(strAnneeSup))
		{
			alert("The second date must be equal or later than the first one !");
			return(1);
		}
		else if( (parseInt(strAnneeInf, 10) < 1549) || (parseInt(strAnneeInf, 10) > 1850) || (parseInt(strAnneeSup, 10) < 1549) || (parseInt(strAnneeSup, 10) > 1850))
		{
			alert("You must specify a year between 1549 and 1850 !");
			return(1);
		}
		else if( (parseInt(strMoisInf, 10) < 1) || (parseInt(strMoisInf, 10) > 12) || (parseInt(strMoisSup, 10) < 1) || (parseInt(strMoisSup, 10) > 12))
		{
			alert("You must specify a month between 01 and 12 !");
			return(1);
		}
		else if( (parseInt(strJourInf, 10) < 1) || (parseInt(strJourInf, 10) > 31) || (parseInt(strJourSup, 10) < 1) || (parseInt(strJourSup, 10) > 31))
		{
			alert("You must specify a day between 01 and 31 !");
			return(1);
		}
		else
		{
			return(0);
		}
	}
}
