//determines the height and width of existing screen.
var screenY,screenX,dimensionY=600,dimensionX=800;
if(navigator.appName == "Microsoft Internet Explorer") {
  screenY = window.screen.availHeight;
  screenX = window.screen.availWidth;
}else{
  screenY = window.outerHeight
  screenX = window.outerWidth
}
screenY = (screenY - dimensionY) / 2;
screenX = (screenX - dimensionX) / 2;

var windowObj = null;

//Creates new window in the center of the screen.
function createWindow(loadPage){
  var tempConfig = "Resizable=1,Scrollbar=1,width="+dimensionX+",height="+dimensionY+",left="+screenX+",top="+screenY;
  var winObj = window.open(loadPage,"",tempConfig);
  windowObj = winObj;
  return;
}

//if popup window has been left open then close it
function checkPopup(){
  if(windowObj){
		windowObj.close();
  }
}
