document.getElementById('search').focus();

var form = document.getElementsByTagName('form')[0];
form.onsubmit = function() {
 var search = document.getElementById('search').value;
 window.location = this.action+'/'+escape(search);
 return false;
}
