/*
=====================================
       Javascript functions for Help Popup Html File
=====================================
*/

/*
 *	name:			openHelpPopupOffScreen
 *	purpose:	Opens window off of screen
 *  params:
 *				- xURL : relative path to Help Popup file
 *				- name : name of popup window
*/
function openHelpPopupOffScreen(xURL, name, width, height)
{
	var options = "width=" + width + ",height=" + height + ",left=0,top=0,resizable=yes,toolbar=no,location=no,directories=no,menubar=no,scrollbars=no";
	window.open(xURL, name, options);
}

function openHelpPopupOffScreenScroll(xURL, name, width, height)
{
	var options = "width=" + width + ",height=" + height + ",left=0,top=0,resizable=yes,toolbar=no,location=no,directories=no,menubar=no scrollbars=yes";
	window.open(xURL, name, options);
}

/*
 *	name:			helpPopupResizeWindow
 *	purpose:	Resizes window
*/
function helpPopupResizeWindow( popupWidth, popupHeight )
{
	window.resizeTo( popupWidth, popupHeight );
}

/*
 *	name:			helpPopupMoveWindow
 *	purpose:	Moves window to the desired Locaton
 *	params:
 *		- horizontalOffset : indicate the number of
 *																pixels to horizontally offset the window
 *																relative to the specified object
 *		- verticalOffset : indicate the number of
 *														pixels to vertically offset the window
 *														relative to the specified object
 *		- reference :	indicates what object to reference and 
 *												what on the object to reference
 *							Possible Values:
 *								- "TOP_LEFT_OF_BROWSER"
 *								- "TOP_LEFT_OF_SCREEN"
 *								- "BOTTOM_RIGHT_OF_SCREEN"
 *								-  anything else
*/
function helpPopupMoveWindow( horizontalOffset, verticalOffset, reference )
{
	var adj_X = 0;
	var adj_Y = 0;
	
	switch( reference )
	{
		case "TOP_LEFT_OF_BROWSER":
			adj_X = window.opener.screenLeft;
			adj_Y = window.opener.screenTop;
			
			adj_X += horizontalOffset;
			adj_Y += verticalOffset;
			
			break;
			
		case "TOP_LEFT_OF_SCREEN":
			adj_X += horizontalOffset;
			adj_Y += verticalOffset;
			
			break;
			
		case "BOTTOM_RIGHT_OF_SCREEN":
			adj_X = screen.availWidth;
			adj_Y = screen.availHeight;
			
			adj_X = adj_X - popupWidth;
			adj_Y = adj_Y - popupHeight;
			
			adj_X = adj_X - horizontalOffset;
			adj_Y = adj_Y - verticalOffset;
			
			break;
			
		default:
			adj_X = Math.round( (screen.availWidth / 2) - (popupWidth / 2) );
			adj_Y = Math.round( (screen.availHeight / 2) - (popupHeight / 2) );
			
	}
	
	window.moveTo( adj_X, adj_Y );
	window.focus();
	
}