<!-- Original:  Shawn Seley -->

<!-- Begin
function CountWords (this_field,count_field) 
{
	
	var min_word = 50; <!-- verander min_word als je kortere of langere berichten wil. -->
	var char_count = this_field.value.length;
	var fullStr = this_field.value + " ";
	var initial_whitespace_rExp = /^[^A-Za-z0-9]+/gi;
	var left_trimmedStr = fullStr.replace(initial_whitespace_rExp, "");
	var non_alphanumerics_rExp = rExp = /[^A-Za-z0-9]+/gi;
	var cleanedStr = left_trimmedStr.replace(non_alphanumerics_rExp, " ");
	var splitString = cleanedStr.split(" ");
	var word_count = splitString.length -1;
	if (fullStr.length <2) {
	word_count = 0;
}
	if (word_count == 1)
	{
		wordOrWords = " word";
	}
	else {
		wordOrWords = " words";
	}
	if (char_count == 1) 
	{
		charOrChars = " character";
	} else {
		charOrChars = " characters";
	}
	count_field.value = "Je moet nog " + (min_word - word_count) + " woorden.";
	if(word_count >= min_word)
	{
		count_field.value = "Je hebt genoeg woorden.";
	}
	return word_count;
}
//  End -->
