function put_topics() {
  // get the list dropdown value
  select = document.getElementById('topicToAdd');
  option = select.options[select.selectedIndex].text;

  if (!option) {
    return;
  }
  
  topic = /\w*([A-Z][0-9]{2})=.*/;
  topicCode = topic.exec(option)[1];

  // get existing text value
  txt = document.forms[0].topics.value;

  // don't add the same topic twice
  if (txt.indexOf(topicCode) != -1) {
    return;
  }

  // if non-null, append ' OR ' before appending the list value
  if (txt.length > 0) {
    txt = txt + ' <OR> ';
  }
    
  // append the list value to the previous text value
  txt = txt + topicCode;
  document.forms[0].topics.value = txt;
}
