function keyFilter(e, strPattern){
   var isIE = (document.all) ? 1 : 0;
   var chr = (isIE) ? e.keyCode : e.which;
   var ch = String.fromCharCode(chr);

   if (chr != 13 && chr != 8 && chr != 0)
   {
      var re = new RegExp(strPattern);

      if (ch.search(re) == -1)
      {
         if(isIE)
          e.returnValue = false;
         else
          e.preventDefault();
      }
   }
}

