var SerpKeyboardNavigation;(function(){function c(){h=_d.activeElement;n=null;u=null;e=!1;t=-1;nt();u=_w.NavSelector&&NavSelector(!1)}function p(){v();n=null}function w(i){var o,e;i&&(i.keyCode==r.Tab&&s&&(f("TOP"),s=!1),o=_d.activeElement,u&&o&&o.className!=="b_searchbox"&&(i.keyCode==r.Enter?(n=null,f(t==-1?"EN":"EE",t)):b(i)&&(e=k(i.keyCode),e!==-1&&e!==t&&(tt(e),sj_pd(i)))))}function f(n,t){sj_log("CI.SerpKeyboardNav",n,t?t.toString():"")}function b(t){return n||h==_d.activeElement?t.altKey||t.ctrlKey?!1:!0:!1}function k(n){if(n===r.Tab)return d();if(n===r.Down||n===r.Up){var t=document.activeElement;return t&&(t.tagName.toLowerCase()==="select"||t.tagName.toLowerCase()==="input")?-1:g(n===r.Down)}return-1}function d(){var i=-1;return n?(v(),e=!0,t=-1,f("TO")):(i=0,f("TI")),i}function g(i){var r=-1,s,h,o;return n&&(e?(e=!1,s=u.indexOf(_d.activeElement),s!==-1?r=l(i,s):(h=_w.NavSelector&&NavSelector(!0),o=h.indexOf(_d.activeElement),o!==-1&&(r=a(i?o:o-1)))):r=l(i,t),f(i?"AD":"AU",r)),r}function l(n,t){return a(n?t+1:t-1)}function a(n){return Math.max(Math.min(n,u.length-1),0)}function nt(){i=sj_ce("div","kn_p");o=sj_ce("span",y);o.innerHTML="►";i.appendChild(o);o.title="Use the up and down arrow keys to focus results"}function tt(r){t=r;n=u[t];n&&n.parentNode&&(n.parentNode.insertBefore(i,n.parentNode.firstChild),it(i),n.setAttribute("aria-live","true"),n.focus())}function v(){i&&i.parentNode&&i.parentNode.removeChild(i)}function it(n){var t=n.getBoundingClientRect();t.bottom>window.innerHeight&&n.scrollIntoView()}var n,u,t=-1,e=!1,y="kn_a",i,o,s=!0,h,r;(function(n){n[n.Up=38]="Up";n[n.Down=40]="Down";n[n.Tab=9]="Tab";n[n.Enter=13]="Enter"})(r||(r={}));sj_be(_d,"keydown",w);sj_be(_d.body,"mousedown",p,!0);sj_evt.bind("ajax.load",c,1,1);c()})(SerpKeyboardNavigation||(SerpKeyboardNavigation={}))