function CountWords(ctrl)
{
	var i;
	var scontent=ctrl.value;
	var ilen=scontent.length;
	var iwords=0;
	var imax_words=20;
	var sword_array=scontent.split(" ");
	// Scan the entered string for alternate words.
	for(i=0;i<ilen;i++)
	{
		if(scontent.substr(i,1) == " ")
		{
			iwords++;
		}
	}
	// If we have more than max words from either accounting
	// method, warn the user.
	if(iwords>=imax_words || sword_array.length>=imax_words)
	{
		alert("Maximum number of words is " + imax_words + ". You have typed " + sword_array.length + ' words.');
	}
}