
function EnterKeyProcess(Evnt, BtnId) {
  // Evnt is calling control's OnKeyPress event's 'event' object
  // Btn  is button we will click if user pressed Enter
  // usage: control attribute: onkeypress="EnterKeyProcess(event, <strTargetCtlId>);"
  // where <strTargetCtlId> is the Id of the control to be clicked.
  var KeyPressed;

  if (! window.event)                       // there is no window.event object
    KeyPressed = Evnt.which;                // browser is Standard
  else                                      // there is a  window.event object
    KeyPressed = window.event.keyCode;      // browser is IE

//KeyPressed = KeyCodeGet(Evnt);

  if (KeyPressed == 13)                     // current keystroke is Enter
    document.getElementById(BtnId).click(); // click the button caller specified
} // EnterKeyProcess

function KeyCodeGet(Evnt) { // return current KeyCode
  var keyEsc;
  var keyCode;

  if (! window.event) {             //     standard
    keyEsc = Evnt.DOM_VK_ESCAPE     // init
    if (Evnt.which)                 // collect
      keyCode = Evnt.which          // regular key
    else
      keyCode = Evnt.keyCode;       // special key
  } else {                          // non-standard
    keyEsc = 27                     // init
    keyCode = window.event.keyCode; // collect
  }

  return keyCode; // return it
} // KeyCodeGet

//function KeystrokeIs(Evnt, KeyCode) { // return whether this Evnt has this KeyCode
//  var KeyPressed = KeyCodeGet(Evnt);
//
//  return (KeyPressed == KeyCode);
//}
