/********************************************************
Purpose	:	Opens a new window
Input	:	strURL			// location of the page
			strFeatures		// list of features (ie: resizable, menubar, etc.)
			intHeight		// height of the window		
			intWidth		// width of the window
Output	:	None
********************************************************/

function newWindow(strURL, strFeatures, intWidth, intHeight) {

	var objPopupWindow;
	var strFeaturesList;
	var intCenterWidth;
	var intCenterHeight;
		
	// if no width is provided, set window width to a factor of the screen width
	if (intWidth == "") {
		intWidth = screen.width * .70;
	}
		
	// if no height is provided, set window height to a factor of the screen height
	if (intHeight == "") {
		intHeight = screen.height * .70;
	}
		
	// center window in screen
	intCenterHeight = (screen.height / 2) - (intHeight / 2);
	intCenterWidth = (screen.width / 2) - (intWidth / 2);
	
	// if no features are provided
	if (strFeatures == "") {
		strFeaturesList = "height=" + intHeight + 
						  ",width=" + intWidth + 
						  ",screenY=" + intCenterHeight + 
						  ",screenX=" + intCenterWidth +
						  ",top=" + intCenterHeight + 
						  ",left=" + intCenterWidth;
	}
	// else if features are provided
	else  {
		// if "all" is provided, show all default features
		if (strFeatures == "all")  {
			strFeaturesList = "location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes" +
							  ",height=" + intHeight + 
							  ",width=" + intWidth + 
							  ",screenY=" + intCenterHeight + 
							  ",screenX=" + intCenterWidth +
							  ",top=" + intCenterHeight + 
							  ",left=" + intCenterWidth;
		}
		// else show only those features listed
		else  {
			strFeaturesList = strFeatures + 
						  ",height=" + intHeight + 
						  ",width=" + intWidth +
						  ",screenY=" + intCenterHeight + 
						  ",screenX=" + intCenterWidth +
						  ",top=" + intCenterHeight + 
						  ",left=" + intCenterWidth;
		}
	}
	
	objPopupWindow = window.open(strURL, 'PopupWindow', strFeaturesList);
	objPopupWindow.focus();
	
}


/********************************************************
Purpose	:	Sets the focus on the first field in the form
Inputs	:	None
Output	:	None
********************************************************/

function setFormFocus(){

	document.forms[0].elements[0].focus();
}