function openWindow(URL, windowName, windowFeatures)
{
	var win;
	var windowLocation = 'left=50,top=50';
	
	if (windowLocation != '')
	{
		if (windowFeatures == '')
		{
			windowFeatures = windowLocation;
		}
		else
		{
			windowFeatures = windowFeatures + ',' + windowLocation;
		}
	}
	
	if (windowFeatures == '')
	{
		win = window.open(URL, windowName);
	}
	else
	{
		win = window.open(URL, windowName, windowFeatures);
	}

	win.focus();		
}

function openSizedWindow(URL, windowName, windowFeatures, height, width, position, offset)
{
	// position: 1 = Upper left.	+--------+
	//           2 = Upper right.	|1			2|
	//           3 = Lower left.   |     5	  |
	//           4 = Lower right.	|3			4|
	//           5 = Center.		+---------+
	//
	// offset: Distance to offset from the edge (margin).
	//         Only applies to position 1-4.
	
	var win;
	var top;
	var left;
	
	var availHeight = screen.availHeight - 30; //Allow for Taskbar.
	var availWidth = screen.availWidth - 10;   //Just need it.
	
	// Make sure height, width, and offset are integers
	height = Math.floor(height);
	width = Math.floor(width);
	offset = Math.floor(offset);
	
	// Make sure window is not too big
	height = Math.min(height, availHeight)
	width = Math.min(width, availWidth)
	
	// Make sure offset not too big
	var offsetHeight = Math.min(offset, (availHeight - height));
	var offsetWidth = Math.min(offset, (availWidth - width));
	
	position = position.toLowerCase()
	switch (position){
		case 'ul' :
			// Upper left
			top = 0 + offsetHeight;
			left = 0 + offsetWidth;
			break;
		case 'ur' :
			// Upper right
			top = 0 + offsetHeight;
			left = (availWidth - width) - offsetWidth;
			break;
		case 'll' :
			// Lower left
			top = (availHeight - height) - offsetHeight;
			left = 0 + offsetWidth;
			break;
		case 'lr' :
			// Lower right
			top = (availHeight - height) - offsetHeight;
			left = (availWidth - width) - offsetWidth;
			break;
		default :
			// Center
			top = Math.floor((availHeight - height) / 2);
			left = Math.floor((availWidth - width) / 2);
	}


	var windowLocation = 'top=' + top.toString() + ',left=' + left.toString() + ',height=' + height.toString() + ',width=' + width.toString();
	
	if (windowFeatures == '')
	{
		windowFeatures = windowLocation;
	}
	else
	{
		windowFeatures = windowFeatures + ',' + windowLocation;
	}
	
	if (windowFeatures == '')
	{
		win = window.open(URL, windowName);
	}
	else
	{
		win = window.open(URL, windowName, windowFeatures);
	}

	win.focus();		
}

function openHelpWindow(pageName)
{
	openSizedWindow('info.aspx?d='+pageName,'Info','resizable=yes,scrollbars=yes',window.screen.availHeight-100,window.screen.availWidth/2,'ur',0);
}