var IE = (document.all) ? 1 : 0;
var DOM = 0; 
if (parseInt(navigator.appVersion) >=5) {DOM=1};

function countChars( cBoxName, cTxtName, maxKeys ) {
  var str = new String(getTxt(cBoxName));
  var len = str.length;
//  var showstr = "&nbsp (" + len + " of " + maxKeys + " characters";
  var showstr = "";
  if (len > maxKeys) showstr += "<strong>";
  showstr += len;
  if (len > maxKeys) showstr += "</strong>";
  showstr += " / " + maxKeys;
//  if (len > maxKeys) showstr += '-- <strong>excess will be discarded</strong>';
//  showstr += ")";
  txtShow( cTxtName, showstr );
}

function txtShow( cId, txt2show ) {
  // Detect Browser
  if (DOM) {
		var viewer = document.getElementById(cId);
    viewer.innerHTML=txt2show;
  }
  else if(IE) {
    document.all[cId].innerHTML=txt2show;
  }
} // End 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;
} // End getTxt

function countHide( cTxtName ) {
  // Detect Browser
  if (DOM) {
		var viewer = document.getElementById(cTxtName);
    viewer.innerHTML="";
  }
  else if(IE) {
    document.all[cTxtName].innerHTML="";
  }
} // End countHide

// Original: Eric King (eric_andrew_king@hotmail.com)
// Web Site: http://redrival.com/eak/
// See also:http://javascript.internet.com -->
// Function to popup a new window.
function NewWindow(mypage, myname, w, h, scroll) {
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2;
  winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
  win = window.open(mypage, myname, winprops)
  if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
} // NewWindow
