function wordCount( o, maxWords, doCount ) {
	text = o.value;
	nWords = 0; 
	jx=0;
	
	for( var j=1; j<text.length; j++ ) {
		if (text.charAt(j) == " " && text.charAt(j-1) != " ")  {
			nWords++
			//wordCounter.value = maxWords - nWords; 
			if(nWords >= maxWords && doCount ){
				alert('You have reached the maximum number of words allowed'); 
				o.value = text.substring(0,j);
				break; 
			}
		} 	
	}
	
}
