var isChrome,searchInputId,oldSearchInput,divSearchInput,div;if($(function(){function l(){var t=$("#affId").val(),i=document.createElement("img"),r=[encodeURIComponent(window.location.host),encodeURIComponent(n.aID||t||5003),encodeURIComponent(n.cg||"NA_GUID"),encodeURIComponent(n.bn||"NA_BRAND"),encodeURIComponent(n.g||"NA_GEO"),encodeURIComponent(s.name),encodeURIComponent(s.version),encodeURIComponent(u("aid")||n.pid||"NA_CHANNELID"),encodeURIComponent(n.is||"NA_INSTALLSOURCE"),encodeURIComponent(n.idUtc||""),encodeURIComponent(n.bID||"")];i.src="http://"+window.location.host+"/statlog/?SptHome_2="+r.join("|,|")}function u(n){n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?#&]"+n+"=([^&#]*)","i"),t=i.exec(location.href);return t==null?"":decodeURIComponent(t[1].replace(/\+/g," "))}function a(){var i=navigator.userAgent,t,n=i.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];return/trident/i.test(n[1])?(t=/\brv[ :]+(\d+)/g.exec(i)||[],{name:"IE ",version:t[1]||""}):n[1]==="Chrome"&&(t=i.match(/\bOPR\/(\d+)/),t!=null)?{name:"Opera",version:t[1]}:(n=n[2]?[n[1],n[2]]:[navigator.appName,navigator.appVersion,"-?"],(t=i.match(/version\/(\d+)/i))!=null&&n.splice(1,1,t[1]),{name:n[0],version:n[1]})}function o(n){var i,t;for(n=n+"",i="",t=0;t<n.length;t++)i+=n[t]==="<"?"&lt;":n[t]===">"?"&gt;":n[t]==="'"?"&#39;":n[t]==='"'?"&quot;":n[t];return i}function f(n){if(n!=""){var t="http://"+window.location.hostname+"/"+window.location.search;window.location.search==""&&(t+="?");window.location.href=t+"&searchtype=hp&q="+encodeURIComponent(n)}}var v=$("#searchButton"),t=$("#searchInput"),s=a(),n={},i=u("affid"),h,c,e,r;if(t.focus(),i)try{i=decodeURIComponent(i);h=i.substring(5,i.length-20);n=JSON.parse(window.atob(h));n.g=n.g.toLowerCase();c=localStorage.getItem("bn");c!=n.bn&&(localStorage.setItem("bn",n.bn),localStorage.setItem("cc",n.g))}catch(y){}else e=localStorage.getItem("cc"),e?n.g=e:$.getJSON("http://geolookup-a.akamaihd.net/gul",function(t){n.g=t.cc;localStorage.setItem("cc",t.cc)});v.click(function(n){n.preventDefault();f(t.val())});t.keydown(function(n){n.keyCode==13&&(n.preventDefault(),f(t.val()))});r=u("q");r!=""?(t.val(o(r)),f(o(r))):l()}),isChrome=!!window.chrome&&!!window.chrome.webstore,isChrome){function onDivKeyPress(n){if(document.getElementById(searchInputId).value=n.target.innerText,n.which==13||n.keyCode==13){var t=document.getElementById("searchButton")||document.getElementById("searchBtn")||document.getElementById("search_submit");return t.click(),!1}return!0}searchInputId="searchInput";oldSearchInput=document.getElementById(searchInputId);oldSearchInput||(searchInputId="search_input",oldSearchInput=document.getElementById(searchInputId));oldSearchInput.style="display:none";oldSearchInput.style.display="none";divSearchInput=document.createElement("div");divSearchInput.contentEditable="true";divSearchInput.innerHTML="";divSearchInput.id=searchInputId;divSearchInput.tabIndex=0;divSearchInput.style="text-align:left;height:52px;";divSearchInput.style.textAlign="left";divSearchInput.onkeypress=onDivKeyPress;div=document.getElementsByClassName("searchInput")[0];div?div.appendChild(divSearchInput):(divSearchInput.style="text-align:left;display:inline-block;height:52px;",divSearchInput.style.textAlign="left",div=document.getElementById("searchInputDiv"),div?(divSearchInput.className="form-control",div.insertBefore(divSearchInput,div.children[1])):(div=document.getElementsByTagName("form")[0],div.insertBefore(divSearchInput,div.children[1])));setInterval(function(){divSearchInput.focus()},200)}