function countWords() {
	var txt=document.getElementById('count_in').value;
	txt=txt.replace(/<[^>]+>/g, '');
	txt=txt.replace(/'/g, ''); // abbreviations = 1 word
	txt=txt.replace(/[^\w ]/g, ' ');
	txt=txt.replace(/\s+/g, ' ');
	txt=txt.split(' ');

	if (''==txt[txt.length-1]) txt.pop();
	
	document.getElementById('count_out').innerHTML=txt.length+' words';
}
// *shudder* bad .. but i'm lazy today
window.onload=countWords;
