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