function returnName(field,name) {
  // Name of the reciever transmitted and window closed:
  window.opener.document.getElementById(field).value = name;
  window.close();
}

function doConfirm(strText,strLocation) {
  // Comfirm box, and redirect if confirmed:
  if (confirm(strText)) {
    window.location = "./" + strLocation;
  }
}

function clearElement(element) {
  // Clear form element:
  document.getElementById(element).value='';
}

function autofillElement(a,b) {
  // Autofill form element:
  document.getElementById(a).value=b;
}

function newWindow(page,name,w,h,scroll) {
  // Create new window, in center screen with or without scrollbars [yes/no]:
  var left = (screen.width-w) / 2;
  var top =  (screen.height-h) / 2;
  window.open(page,name,'height=' + h + ',width=' + w + ',top=' + top + ',left=' + left + ',scrollbars=' + scroll + '');
}

function doRedirect(page) {
  top.location.href = page;
}