function popupWindow(url,wd,ht) {
		
	var windowheight=ht;
	var windowwidth=wd;
	
	var strPopupBlockerMsg = "You have a popup blocker installed.\r\n"
	strPopupBlockerMsg+= "\r\n"
	strPopupBlockerMsg+= "Please either disable popup blocking\r\n"
	strPopupBlockerMsg+= "or allow us to launch popups\r\n"
	strPopupBlockerMsg+= "by holding the CTRL key when clicking a link."
		
	//gets top and left positions based on user's resolution so hint window is centered.
	var iMyWidth = (window.screen.width/2) - ((windowwidth/2) + 10);
	var iMyHeight = (window.screen.height/2) - ((windowheight/2) + 50);
	var win2 = window.open(url,"win2","status,height=" + windowheight + ",width=" + windowwidth + ",resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes");
	if (win2.closed)
	{
		alert(strPopupBlockerMsg);
	}
	else
	{
		win2.resizeTo(windowwidth, windowheight);
		win2.focus();
	}

}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		new_member_area_03_over = newImage("images/new-member-area_03-over.gif");
		new_member_area_05_over = newImage("images/new-member-area_05-over.gif");
		new_member_area_07_over = newImage("images/new-member-area_07-over.gif");
		new_member_area_11_over = newImage("images/new-member-area_11-over.gif");
		new_member_area_13_over = newImage("images/new-member-area_13-over.gif");
		new_member_area_15_over = newImage("images/new-member-area_15-over.gif");
		preloadFlag = true;
	}
}

function checkFileExtension(objField, strType) {
	/** Purpose:	Verifies that the extension provided in a file path is of an acceptable type.
	  * Params:		objField					- Form field that contains the file path to check.
	  *				strType					- String that defines what type of file will be uploaded.
	  * Returns:	True if the extension is empty or in aryExtensions, false otherwise.
	  * Devel:		LGS 4/28/2003
	  * Modified:	LGS 5/2/2003 - Updated to return true if the "Upload a new image" option isn't selected.
	  */
															  
	if (strType == "") {
		// any file type is fine.
		return true;
	} else {
																
		// If the "Upload a new image" option isn't selected, there's no need to check the extension.
		var strFieldName = objField.name;
		var objRadio = objField.form["radUseServerImage" + strFieldName];
		for (i=0; i < objRadio.length; i++) {
			if (objRadio[i].checked) {							
				if (objRadio[i].value!="No") {
					return true;
				}
			}
		}
																
		var extension = new String(objField.value);
		extension = extension.toLowerCase();
		extension = extension.slice(extension.lastIndexOf(".")+1);
																
		var type = new String(strType);
		type = type.toLowerCase();
																
		var aryExtensions;
																
		switch(type) {
			case "img" :
				aryExtensions = new Array("", "jpg", "jpeg", "gif", "bmp");
				break
			case "jpg" : 
				aryExtensions = new Array("", "jpg", "jpeg");
				break;
			case "doc" :
				aryExtensions = new Array("", "doc", "txt", "pdf", "rtf");
				break;
			case "movie" :
				aryExtensions = new Array("", "mpg", "mpeg");
				break;
			default :
				aryExtensions = new Array("");
				break;
		}
																
		for (i=0; i < aryExtensions.length; i++) {
			if (extension==aryExtensions[i]) {
				return true;
			}
		}			
																
		// the extension was not found in the array
		var err = "The file you have selected is of an unacceptable type.\n"
		err = err + "Please choose a file of one of the following extensions:\n"
		for (i=1; i < aryExtensions.length; i++) {
			err = err + aryExtensions[i] + "\n";
		}
		alert(err);
		return false;
	} 
												
}

function checkFormField(objField, strMessage) {
	/* Purpose: Determine whether a form field has been completed
	 * Params:	objField				- Field to check
	 *			strMessage			- Alert message to display if this check fails
	 * Returns:	True if check is successful
	 * Devel:	LGS 12/15/2003
	 */
				 
	
	var strValue = new String(objField.value);
					
	strValue = strValue.replace(" ", "");					
	if (strValue=="") {
		if (strMessage != "")
		{
			alert(strMessage);
			objField.focus();
		}		
	} else {		
		return true;
	}
	
	return false;
}

function validateTextField(objField, strMessage)
{
	/** Purpose:	Verifies that a value has been entered into a text field
	  *				May be used for the following form field types:
	  *				input type="text"
	  *				textarea
	  * Params:		objField	- Reference to the field to check
	  *				strMessage	- Message to display if invalid data is found
	  * Returns:	BOOLEAN
	  * Devel:		LH 11/11/2005
	  */
	
	if (objField)
	{
		if (objField.value.replace(" ", "") == "")
		{
			if (strMessage.replace(" ", "") != "")
			{
				alert(strMessage);
				objField.focus();
			}
			return false;
		}
	}
	return true;
}

function validateSelectList(objField, strMessage)
{
	/** Purpose:	Verifies that a value other than "None" has been selected
	  *				in a select list
	  * Params:		objField	- Reference to the field to check
	  *				strMessage	- Message to display if invalid data is found
	  * Returns:	BOOLEAN
	  * Devel:		LH 11/11/2005
	  */
	  
	if (objField)
	{
		var blnValid = true;
		if (objField.selectedIndex == -1)
		{
			blnValid = false;
		}
		else if (objField[objField.selectedIndex].value == -1)
		{
			blnValid = false;
		}
		
		if (!blnValid)
		{
			if (strMessage.replace(" ", "") != "")
			{
				alert(strMessage);
				objField.focus();
			}
			return false;
		}
	}
	return true;
}

function validateRadioGroup(objField, strMessage)
{
	/** Purpose:	Verifies that at least one radio button out of a group
	  *				has been selected
	  * Params:		objField	- Reference to the group to check
	  *				strMessage	- Message to display if invalid data is found
	  * Returns:	BOOLEAN
	  * Devel:		LH 11/11/2005
	  */
	  
	if (objField)
	{
		var intSelected = -1;		
		if (objField.length > 0)
		{
			for (var i=0; i<objField.length; i++)
			{
				if (objField[i].checked)
				{
					intSelected = i;
					i=objField.length;
				}
			}
		}
		else
		{
			// there's only one option, which may or may not be a radio group
			intSelected = 0;
		}
				
		if (intSelected < 0)
		{
			if (strMessage.replace(" ", "") != "")
			{
				alert(strMessage);				
			}
			return false;
		}
	}	
	return true;
}

function formatPhone(field) {
	/** Formats phone numbers into (000)000-0000 x 000 format **/
   var temp = field.value.replace(/[^0-9]/g, "");
   var cursor = temp.length;

   temp = temp.replace(/^(\d{0,3})(\d{0,3})(\d{0,4})(\d*)/, "($1) $2-$3 x $4");

   if (cursor < 11)
           temp = temp.replace(/\s*x\s*$/, "");
   if (cursor < 7)
           temp = temp.replace(/\-\s*$/, "");
   if (cursor < 3)
           temp = temp.replace(/\)\s*$/, "");
   if (! cursor)
           temp = "";

   field.value = temp;
   return true;
}
		
function formatURL(field) {
	/** Formats to always have http:// **/
	var temp = field.value.replace(/(http\:\/\/)/g, "");
	if (temp > "") {
		temp = "http://" + temp				
	}
	field.value = temp;
	return true;
}

function formatTime(objField) {
	/** Purpose:	Formats timestamps as the values are entered. (hh:mm)
		* Params:		objField				- Reference to the form field to format		  
		* Returns:	Nothing
		* Devel:		LGS 9/1/2003
		*/
			
	var temp = objField.value.replace(/[^0-9]/g, "");		// Remove all non-numerical characters
	var cursor = temp.length;										// Save the length of the string
	var exp, str
			
			
	if (cursor == 2) {
		temp = temp.replace(/^(\d{0,2})/, ":$1");			
	} else if (cursor == 3) {
		temp = temp.replace(/^(\d{0,1})(\d{0,2})/, "$1:$2");			
	} else if (cursor >= 4) {
		temp = temp.replace(/^(\d{0,2})(\d{0,2})/, "$1:$2");			
	}
			
	objField.value = temp;		
}

function toggleChecks(objMaster, objChecks)
{
	if (objMaster && objChecks)
	{
		for (var i=0; i<objChecks.length; i++)
		{
			objChecks[i].checked = objMaster.checked;
		}
	}
}