// JavaScript Document
function textLimit(field, maxlen) {
if (field.value.length > maxlen + 1)
alert('The maximum number of characters is 100');
if (field.value.length > maxlen)
field.value = field.value.substring(0, maxlen);
} 

function textCounter(field, countfield, maxlimit) {
/*
* The input parameters are: the field name;
* field that holds the number of characters remaining;
* the max. numb. of characters.
*/ 
if (field.value.length > maxlimit) // if the current length is more than allowed
field.value =field.value.substring(0, maxlimit); // don't allow further input
else
countfield.value = maxlimit - field.value.length;} // set the display field to remaining number
