﻿var IE = (document.all) ? 1 : 0;
var DOM = 0; 
if (parseInt(navigator.appVersion) >=5) {DOM=1};
        function txtShow( cId, txt2show ) {
            // Detect Browser
            if (DOM) {
        var viewer = document.getElementById(cId);
                viewer.innerHTML=txt2show;
            }
            else if(IE) {
                document.all[cId].innerHTML=txt2show;
            }
        }//txtshow
        
        function getTxt( cId ) {
            var output = "";
            // Detect Browser
            if (DOM) {
        var viewer = document.getElementById(cId);
        output = viewer.value;
            }
            else if(IE) {
                output = document.all[cId].value;
            }
            return output;
        }//getTxt
function countChars(cBoxName, cTxtName, maxKeys) 
{
  var str = new String(getTxt(cBoxName));
  var len = str.length;
  var showstr = (maxKeys - len) + " characters left out of  " + maxKeys;
  if (len > maxKeys) showstr += '<br>Some information will be lost, please revise your entry';
  txtShow( cTxtName, showstr );
}