/*
  Function that clears fields in forms
  provided a comma-separated list of
  document id:s
*/

function clearFields(fields) {
  var arr = fields.split(",");
  
  for (var i = 0; i < arr.length; i++) {
    var field = document.getElementById(arr[i]);
    
    if (field)
      field.value = "";
  }
}

/*
  Function that either submits the gallery page
  or opens a new window for archived links:
*/

function onChangeGallery(select) {
  if (select.value.match("http://"))
    window.open(select.value);
  else {
    select.form.submit();
  }
}

function onClickPublishIssue() {
  alert("You are about to create a new issue. This may take several minutes.\nDo NOT press the button again, just wait for your browser to finish and then follow the instructions.");
  return true;
}
