Jonathan Sampson's HTML5 solution is probably the best. If you are using jQuery, the sample sample should work too. To be complete, here you go with a simple JS solution for all browsers and IE10 +
window.addEventListener("load",function() { document.getElementById("namanyay-search-box").focus(); });
source share