- if (typeof(String.prototype.trim) === "undefined") {
- String.prototype.trim = function() {
- return String(this).replace(/^\s+|\s+$/g, '');
- };
- };
- function number_with_commas(x) {
- return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
- };
- function count_words(words) {
- var ct = (words == "") ? 0 : words.split(/[\s\.\?]+/).length;
- $("#word_count span").html(number_with_commas(ct));
- };