var forcedRefresh = true; /* The forcedRefresh variable specifies how the function should behave if the user clicks a link to open a window after it has already been opened. If set to true, the window will refresh with the address specified. If set to false, the window will simply gain the focus and not refresh its contents. */ var alreadyopen = new Array(); var newwin = new Array(); function openCenteredWindow(theURL, winName, features, w, h){ var winl = parseInt((screen.width - w - 10) / 2); var wint = parseInt((screen.height - h - 29) / 2); openWindow(theURL, winName, features + ',height=' + h + ',width=' + w + ',top=' + wint + ',left=' + winl); } function openWindow(theURL, winName, features){ if(forcedRefresh == false && alreadyopen[winName] && !newwin[winName].closed){ newwin[winName].focus(); } else{ alreadyopen[winName] = 1; newwin[winName] = window.open(theURL, winName, features); newwin[winName].focus(); } }