function subimSearch() { window.location.href = "/news/search-news/"+document.getElementById("searchinput").value.replace(/(^\s*)|(\s*$)/g,"").replace(/ /g,"-").toLocaleLowerCase()+"/"; } if(typeof $ == "function") { $(function(){ var ipe = $("#searchinput"); ipe.keydown(function(){ if(event.keyCode==13) subimSearch(); }); ipe.focus(function(){ if($(this).val() == 'News Search')$(this).val(''); }); ipe.blur(function(){ if($(this).val() =='')$(this).val('News Search'); }); }); }