﻿var KP_hasFocus = null; 

function KP_setFocus(obj) {
  KP_hasFocus = obj;
}

function KP_loseFocus() {
 // KP_hasFocus = null; 
}

document.onkeypress = function checkKeyPress(e) {
  if(!e)e = window.event;
  var key = (typeof e.which == 'number')?e.which:e.keyCode;
  if(key == 13) {
    handleKP();
    return (false); 
  }
}

function handleKP() {
  if (KP_hasFocus == null) return (false);
  switch (KP_hasFocus.id) {
  case "txtEmpty":
  case "ctlCategoryNav1_txtKeyword":
    document.getElementById('ctlCategoryNav1_btnSearch').click();
    break;
  }
  return (false);
}