function textlimit(id,max) {
    limit=getObject(id);
    limitcnt=getObject(id+"cnt");
    if (max<limit.value.length) {
        limit.value=limit.value.substr(0,max);
    }
    limitcnt.value=max-limit.value.length;
    limit.focus();
}

function getObject(obj) {
  var theObj;
  if(document.all) {
    if(typeof obj=="string") {
      return document.all(obj);
    } else {
      return obj.style;
    }
  }
  if(document.getElementById) {
    if(typeof obj=="string") {
      return document.getElementById(obj);
    } else {
      return obj.style;
    }
  }
  return null;
}
				
