home *** CD-ROM | disk | FTP | other *** search
- // Edugen JavaScripts Library V1.0 =========================================
- //
- // File windows.js
- //
- // This file is part of the Edugen JavaScripts Library.
- // Copyright (c) 2002 WWL Corp. - A Subsidiary of John Wiley & Sons, Inc.
- // =========================================================================
-
- // Create an array to hold references to the child windows.
- // Each member of this array will be a window object created using the createWindow function below.
- var m_Windows = new Array();
-
- // Constructor for the window.
- // This function should be called only by the createWindow function below.
- function newWindow(in_URL, in_windowName)
- {
- var features = "";
- if (null != arguments[2])
- {
- features = arguments[2];
- }
-
- return window.open(in_URL, in_windowName, features);
- }
-
- // Add a window to the m_Windows collection.
- // If a window was already opened and yet not close - focus the window.
- function createWindow(in_URL, in_windowName)
- {
- var features = "";
- if (null != arguments[2])
- {
- features = arguments[2];
- }
-
- if (m_Windows[in_windowName])
- {
- if (!m_Windows[in_windowName].closed)
- {
- m_Windows[in_windowName].focus();
- m_Windows[in_windowName] = new newWindow(in_URL, in_windowName, features);
- }
- else
- {
- m_Windows[in_windowName] = new newWindow(in_URL, in_windowName, features);
- }
- }
- else
- {
- m_Windows[in_windowName] = new newWindow(in_URL, in_windowName, features);
- }
- }
-
- // Close all the opened windows.
- // To close an individual window, its close method is called.
- // This function should be called during the onUnload event to automatically close all open windows.
- function closeWindows()
- {
- for (w in m_Windows)
- {
- if (m_Windows[w]!=null)
- {
- if (!m_Windows[w].closed)
- {
- m_Windows[w].close();
- m_Windows[w]=null;
- }
- else
- {
- m_Windows[w]=null;
- }
- }
- else
- {
- m_Windows[w]=null;
- }
- }
- }
-
- // Close an individual opened window.
- function closeWindow(in_window)
- {
- if (m_Windows[in_window]!=null)
- {
- if (!m_Windows[in_window].closed)
- {
- m_Windows[in_window].close();
- m_Windows[in_window]=null;
- }
- else
- {
- m_Windows[in_window]=null;
- }
- }
- else
- {
- m_Windows[in_window]=null;
- }
- }
-