var popupWin; // contains handle to a "popup" window // FUNCTION newWindow - open a new browser window function newWindow( URL, winName, winParms, width, height, reloadParent ) { winParms += ( ( winParms != "" ) ? "," : "" ) + "width=" + String( width ) + ",height=" + String( height ); if ( parseInt( navigator.appVersion, 10 ) >= 4 ) { // center the new window in browsers version 4 and above var xTop = screen.width/2 - ( width/2 ); var yTop = screen.height/2 - ( height/2 ); winParms += ",left=" + String( xTop ) + ",top=" + String( yTop ); } // close the "popup" window if it is already open if ( !( !popupWin || popupWin.closed ) ) { popupWin.close() } // open a "popup" window popupWin = window.open( URL, winName, winParms ); if ( reloadParent == "true" ) { // reload parent window popupWin.opener.history.go(-1) } popupWin.focus() }