function ValidateSurName(validator, valueToValidate)
{
	var controlToValidate = xGetElementById(validator.getAttribute("controltovalidate"));
	var enteredValue = controlToValidate.value;
	var validChars = " '.-";

	// haal alle hoofdletters op
	validChars += GetChars( 65, 90 );
	// haal alle kleine letters op
	validChars += GetChars( 97, 122 );
	// haal alle letters met diakritische tekens op
	validChars += GetChars( 192, 1255 );

	// alleen karakters in validChars voldoen
	if ( IsValidChar( validChars, enteredValue ) )
	{
		// verwijder alle leading spaces
		while (enteredValue.substring(0,1) == ' ')
		{
			enteredValue = enteredValue.substring(1,enteredValue.length);
		}
		// verwijder alle trailing spaces
		while (enteredValue.substring(enteredValue.length-1,enteredValue.length) == ' ')
		{
			enteredValue = enteredValue.substring(0,enteredValue.length-1);
		}

		// verwijder alle dubbele spaties
		var newValue = "";
		for ( i = 0; i < enteredValue.length; i++ )
		{
			if ( enteredValue.charAt( i ) != ' ' || enteredValue.charAt( i + 1 ) != ' ' )
			{
				newValue += enteredValue.charAt( i );
			}
		}
		
		controlToValidate.value = newValue;
		valueToValidate.IsValid = true;
	}
	else
	{
		controlToValidate.value = enteredValue;
		valueToValidate.IsValid = false;
	}
}

