function wordCount(string, minWordsRequired, maxWordsRequired, maxCharacters, elementToUpdate)
{
	if (string.length == 0)
		var words								=	0;
	else
	{
		var a									=	string.replace(/^\s+|\s+$/g,"").split(/\s+/g);	// split the text into an array of words
		var words								=	a.length;
	}
			
	var text									=	'';
			
	if (words == 1)
		text									=	words + ' word entered';
	else
		text									=	words + ' words entered';
				
	var moreWordsRequired						=	minWordsRequired - words;
	var tooManyWords							=	words - maxWordsRequired;
				
	if (moreWordsRequired > 0)
	{
		text									=	text + '; <b>' + (moreWordsRequired) + ' more ';
				
		if (moreWordsRequired == 1)
			text								=	text + 'word required';
		else
			text								=	text + 'words required';
			
		text									=	text + '</b>';
	}
	else
		if (tooManyWords > 0)
			text								=	text + '; <b>' + (tooManyWords) + ' over the limit</b>.'
					
	//  -- no longer supported with IE7
	// window.status								=	text;
	
	document.getElementById(elementToUpdate).innerHTML	=	text;
				
	return true;
}

