<!--

// ----------------------------------------------------------------------------------------------------------------------------------------
// This file contains miscellaneous utility functions.
// ----------------------------------------------------------------------------------------------------------------------------------------



// ----------------------------------------------------------------------------------------------------------------------------------------
// utility method that opens a browser window with the proper parameters depending on the browser version.
// ----------------------------------------------------------------------------------------------------------------------------------------
// tested on Netscape 2.02
// tested on Netscape 3.01, 3.01B1, 3.02, 3.03, 3.04
// tested on Netscape 4.03, 4.05, 4.08, 4.5, 4.51, 4.61, 4.7, 4.72, 4.73, 4.74, 4.75, 4.76, 4.77, 4.78, 4.79, 4.8
// tested on Netscape 6.01, 6.1, 6.2, 6.2.1, 6.2.2, 6.2.3
// tested on Netscape 7.0
// tested on Mozilla 1.0.1, 1.1, 1.2B
// tested on Opera 6.05, 7.0
// tested on Internet Explorer 5.0, 5.5, 6.0
// ----------------------------------------------------------------------------------------------------------------------------------------
// BUGS: in Netscape 6.x, if locationbar=1, then resizable can only be 0
// BUGS: in Netscape 2.x and 3.x and 4.x, no space is allowed after the commas
// BUGS: in Netscape 2.x and 3.x, window locations cannot be set
// BUGS: in Netscape 2.x, only unresizable windows can be created
// BUGS: in Opera 6.x, cannot hide menubar
// BUGS: in Opera 6.x, cannot hide toolbar
// BUGS: in Opera 6.x, cannot hide the status bar
// BUGS: in Opera 6.x, hiding location bar also hides all other chrome
// BUGS: in Opera 6.x and 7.x, cannot create non-resizable windows (all windows are resizable)
// BUGS: in Opera 7.x, cannot hide scrollbars if they are needed
// BUGS: in Opera 7.x, the window location is relative to the MDI container instead of the screen
// BUGS: in Opera 7.x, the toolbar is not located in the window
// BUGS: in Opera 7.x, the menubar is not located in the window
// BUGS: in Opera 7.x, there is no statusbar
// ----------------------------------------------------------------------------------------------------------------------------------------

function openWindow (url, name, size, x, y, parent, attributes)
{
	// ----------------------------------------------------------------------------------------------------------------------------------
	// compute location of window relative to parent
	// ----------------------------------------------------------------------------------------------------------------------------------

	if (parent != null && typeof (parent) != "undefined")
	{
		if (browserName == "Internet Explorer")
		{
			x += parent.screenLeft;
			y += parent.screenTop;
		}
		else
		{
			x = x + parent.screenX + parent.outerWidth - parent.innerWidth;
			y = y + parent.screenY + parent.outerHeight - parent.innerHeight;
		}
	}

	// ----------------------------------------------------------------------------------------------------------------------------------
	// create location attributes
	// ----------------------------------------------------------------------------------------------------------------------------------

	var location = "";
	if (browserName == "Netscape")
	{
		location = ",screenX=" + x + ",screenY=" + y;
	}
	else
	{
		location = ",left=" + x + ",top=" + y;
	}

	// ----------------------------------------------------------------------------------------------------------------------------------
	// create and return window
	// ----------------------------------------------------------------------------------------------------------------------------------

	if (attributes != null && attributes != "" && typeof (attributes) != "undefined")
	{
		var win = window.open (url, name, size + location + "," + attributes);
	}
	else
	{
		var win = window.open (url, name, size + location);
	}

	win.focus();
	return win;
}

// ----------------------------------------------------------------------------------------------------------------------------------------
// utility method that sets the background color of the specified element to the specified color.
// ----------------------------------------------------------------------------------------------------------------------------------------

function setBgColor (e, color)
{
	// ANX: This check is incomplete. It does not check for all possible browsers.
	// ANX: I need to grab my reference code from danas menu

	if (navigator.appName == "Netscape")
	{
		alert (e.bgColor);
		e.bgColor = color;
	}
	else if (navigator.appName == "Microsoft Internet Explorer")
	{
		e.style.backgroundColor = color;
	}
}

//-->
