function focus(id) {
  if (document.getElementById && document.getElementById(id)) {
    document.getElementById(id).focus();
  }
}