function taLimit(textArea) {
 if (textArea.value.length==textArea.maxLength) {
 return false;
 }
}

function taCount(textArea, visCnt, maxLength) {
 if (textArea.value.length>maxLength) textArea.value=textArea.value.substring(0,maxLength);
 if (visCnt) {
 var color = Math.round(10*(textArea.maxLength-textArea.value.length)/textArea.maxLength);
 if (color==0) {
 visCnt.innerHTML='<b><span id="w'+ color +'">'+(maxLength-textArea.value.length)+'</span></b>';
 }
 else {
 visCnt.innerHTML='<span id="w'+ color +'">'+(maxLength-textArea.value.length)+'</span>';
 }
 }
}

var mistakes=8;
function onlyNum(inputField, min, max) {
 var val= parseInt(inputField.value);
 if (isNaN(val) || val<min || val>max) {
  inputField.value = "";
  mistakes +=1;
  if (mistakes>10) {
   mistakes = 0;
   alert("Please only enter numbers in this box.");
  }
 }
 else {
 inputField.value = val;
 }
}

//var complete = 0;
//var segments = <TMPL_VAR NAME="numQs">;
//var completed = new Object();
//
//function updateProgress(comp) {
// if (comp>complete) {
// complete = comp;
// }
// percent = Math.floor(complete*100/segments);
// var html = "<table style=\"width: 300px\">";
// var i=0;
// for (; i<=complete; i++) {
// if (i>2*segments/3) html += "<td><span class=\"c3\"></span></td>";
// else if (i>segments/3) html += "<td><span class=\"c2\"></span></td>";
// else html += "<td><span class=\"c1\"></span></td>";
// }
// for (; i<=segments; i++) {
// html += "<td><span class=\"i\"></span></td>";
// }
// progress.innerHTML="Progress "+ percent + "%";
// progressBar.innerHTML=html + "</table>";
//}