// Contains functions for popping up windows
function new_popup(url, width, height) {
   // this function call is made by CCS when the page is set to open in a new window
   popup(url, '', width, height);
}

function popup(url, target, width, height, params) {
   popupReturn(url, target, width, height, params);
}

function fullScreen(theURL) {
   return window.open(theURL, '', 'fullscreen=yes, scrollbars=auto');
}

function popupReturn(url, target, width, height, params) {
   if (target == null) target="_new";
   if (width == null) width = 800;
   if (height == null) height = 600;
   if (params == null) params = "resizable=yes,menubar=no,status=yes,personalbar=no,scrollbars=yes";

   return openAWindow(url, target, width, height, params);
}

function openAWindow(url, target, width, height, params) {
  target = ""; // <<<<----- remove this when not needed. For now all windows open in new

  var winl = (screen.availWidth - width) / 2;
  var wint = (screen.availHeight - height) / 2;

  return window.open(url, target, "top=" + wint + ",left=" + winl +
  	",width=" + width + ",height=" + height + "," + params);
}

function popupFullscreen(url, target) {
	window.open(url, target, 'fullscreen=yes');
}

function popupMaximised(url, target, params) {
	var win = popupReturn(url, target, screen.availWidth, screen.availHeight, params);
}
var popupMaximized=popupMaximised;

function maximiseWindow(theWindow) {
   theWindow.moveTo(0,0);
   theWindow.outerHeight = screen.availHeight;
   theWindow.outerWidth = screen.availWidth;

}
var maximizeWindow=maximiseWindow;
