function previewWordCount(text, target, bonus_target, wc_target, base){
  var content = text.value;
  content = content.replace(/[^A-Za-z0-9\s]+/g,"").replace(/\s+/g, " ").replace(/^\s+/, "").replace(/\s+$/, "");
  words = (content.length == 0) ? 0 : content.split(" ").length;
  bonus = Math.floor(words / 2);
  if (bonus > 200) { bonus = 200; }
  credits = Number(base) + Number(bonus);
  document.getElementById(target).innerHTML = credits;
  document.getElementById(bonus_target).innerHTML = bonus;
  document.getElementById(wc_target).innerHTML = words;
}
