/*

Contains the methods for the window object.

*/

var optionStrings = new Array()
optionStrings["filing"] = "";		// Opens as a normal window.


function _openWindow(whatID, whatPath, whatBookmarkData)
{
	// If the window has been created, see if it needs reloading or re-creating.
	// In any case, re populate the bookmarkData.
	if (this.openWindows[whatID])
	{
		this.openWindows[whatID].bookmarkData = whatBookmarkData;
		if (this.openWindows[whatID].windowHandle.closed)	// If its closed, just re-open it.
		{
			this.openWindows[whatID].windowHandle = window.open(whatPath, whatID, optionStrings[whatID]);
		}
		else
		{
			this.openWindows[whatID].windowHandle.focus();
		}
	}
	else	// If not, create the object
	{
		this.openWindows[whatID] = new Object()
		this.openWindows[whatID].bookmarkData = whatBookmarkData
		//window.open ("generic/lms_frameset.htm","courseWin","width=790,height=530,left=0,top=0,scrollbars=no,location=no,status=no,resizable=no,fullscreen=no")
		this.openWindows[whatID].windowHandle = window.open(whatPath, whatID, optionStrings[whatID])
	}
}

function _closeWindow(whatID)
{
	if (!this.openWindows[whatID].closed)
	{
		if (this.openWindows[whatID].windowTracker)
		{
			this.openWindows[whatID].windowTracker.closeAllWindows()
		}
		this.openWindows[whatID].windowHandle.close();
	}
}

function _closeAllWindows()
{
	for (currWinID in this.openWindows)
	{
		this.closeWindow(currWinID)
	}
}

function _connectToOpener()
{	
	if (window.opener)
	{
		this.openerWindow = window.opener
		if (this.openerWindow.windowTracker)
		{
			if (this.openerWindow.windowTracker.openWindows[window.name])
			{
				// Copy the bookmark data to this object if its not "".
				if (this.openerWindow.windowTracker.openWindows[window.name].bookmarkData != "")
					this.bookmarkData = this.openerWindow.windowTracker.openWindows[window.name].bookmarkData
			}
		}
	}
}
