function newWindow (u, n) {
  var s = 'toolbar=yes, location=yes, directories=yes, status=yes, menubar=yes, scrollbars=yes, resizable=yes, favorites=yes';
  var wp = window.open(u, n, s);
  wp.focus();
}

function closeWindow () {
  window.self.close();
}

function FullScreenWindowOpen (u, n) {
  var s = 'location=no, menubar=no, personalbar=no, resizable=no, scrollbars=no, status=no, toolbar=no';
  var wp = window.open(u, n, s);
  wp.focus();
  location.href = 'thanks.html';
}

function WindowResize () {
  window.moveTo(0, 0);
  window.resizeTo(screen.availWidth, screen.availHeight);
}

function newWindowNum (u, n, w, h) {
  var tx = parseInt((getScreenAvailWidth() - w) / 2, 10);
  var ty = parseInt((getScreenAvailHeight() - h) / 2, 10);
  if ((navigator.appVersion.indexOf('Mac',0) != -1) && (navigator.appName.charAt(0) == 'M')) {
    if (!!window && u) {
      var wp = window.open(u, n, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, favorites=no');
      wp.focus();
      wp.moveTo(tx, ty);
      wp.resizeTo(w, h);
    }
  } else {
    if (!!window && u) {
      var wp = window.open(u, n, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, favorites=no, width=' + w + ',height=' + h + ',left=0, top=0, screenX=' + tx + ', screenY=' + ty);
      wp.focus();
    }
  }
}

function openStaff (num) {
  newWindowNum('./staff/index.html?'+num, 'directus_staff', 1024, 484);
}

function getScreenAvailWidth() {
  if (!!window.screen)
  return screen.availWidth
  else
  return null
}
function getScreenAvailHeight() {
  if (!!window.screen)
  return screen.availHeight
  else
  return null
}