/** * Provides a generic method for opening JavaScript Popups. *
* We need to pollute the namespace (handleWindow) to maintain backwards compatibility * Most Flash movies require the global function handleWindow *
* handleWindow will be replaced by o2.popup in the future * * @author Maximilian Kellner * @version $Revision$ $Date$ $Author$ **/ o2.popup = { open: function(destUrl, doOpener, doClose, doFocus, name, x, y, width, height, params) { handleWindow(destUrl, doOpener, doClose, doFocus, name, x, y, width, height, params); } } /* * TODO: Implement new method for o2.popup * * @deprecated handleWindow() should no longer be used in the future. */ function handleWindow(destUrl, doOpener, doClose, doFocus, name, x, y, width, height, params) { var openWindow = function(url, name, x, y, width, height, params) { if (name != null) name = name.replace(/ /g,""); if (!isNaN(x) && x > 0) params += ",left=" + x; if (!isNaN(y) && y > 0) params += ",top=" + y; if (!isNaN(width) && width > 0) params += ",width=" + width; if (!isNaN(height) && height > 0) params += ",height=" + height; if (params != null && params.charAt(0) == ",") params = params.substring(1); var win = window.open(url, name, params); if (win) win.focus(); } if (doOpener != null && doOpener == "1") { // URL in opener - at least IE does not set opener to null if closed if ((top.opener != null) && (typeof top.opener.closed == 'boolean') && (!top.opener.closed)) { top.opener.location.href = destUrl; if (doFocus != null && doFocus == "1") { top.opener.focus(); } if (doClose != null && doClose == "1") { top.close(); } } else { openWindow(destUrl); if (doClose != null && doClose == "1") { top.close(); } // ignore doFocus } } else { // URL in this window or new window if (name != null || params != null) { openWindow(destUrl, name, x, y, width, height, params); if (doClose != null && doClose == "1") { top.close(); } // ignore doFocus } else { window.location.href = destUrl; // ignore doClose + doFocus } } }