// openCenteredWindow.js
// url = The url to open.
// width = The width of the window (default is 750 px).
// height = The height of the window (default is 550 px).
function openCenteredWindow(url,width,height) {
	var width = (width == null || width == 0) ? 750 : width;
	var height = (height == null || height == 0) ? 550 : height;
  var top = Math.floor( (screen.height - height) / 4);
  var left = Math.floor( (screen.width - width) / 4);
  var winParms = "top=" + top + ",left=" + left + ",height=" + height + ",width=" + width + ",scrollbars=yes,resizable=yes";
  var win = window.open(url, "", winParms);
  if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
  return win;
}
function openSameSizeWindow(url) {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  openCenteredWindow(url,myWidth,myHeight)
}