function selectAll(source, maincheck, checkfield, numrecords){
// Select or Deselect all checkboxes in an area.
//	Parameters:
//			source - form object to be manipulated.
//			maincheck - the checkbox that when checked should check or uncheck 
//					all other boxes.
//			checkfield - The basic portion of the name of the checkfield that is 
//					similar to all the other ones.
//			numrecords - The total number of records to be looped through.
//===================================================================================
		for (x = 1; x <= numrecords; x++){
			newcheck = eval('source.'+checkfield+x);
			if (maincheck.checked == true){
				newcheck.checked = true;
			} else {
				newcheck.checked = false;
			}
		}	
}

// Select or Deselect all checkboxes in an area.  Same as above, except assumes 
// all checkboxes have the same name
//	Parameters:
//			source - form object to be manipulated.
//			maincheck - the checkbox that when checked should check or uncheck 
//					all other boxes.
//			checkfield - The basic portion of the name of the checkfield that is 
//					similar to all the other ones.
//			
//===================================================================================
function selectOne(source,maincheck,checkfield) {
    newcheck = eval('source.' + checkfield);
    for (i=0;i<newcheck.length;i++) {
            newcheck[i].checked = maincheck.checked;
    } 

}


function cfmMessage(message){
// Show a confirm box with a specific message in it.  If okay is chosen, return true.
// If cancel was chosen, return false.
//	Parameters
//			message - Message to show in box.
//===================================================================================
	if (confirm(message)){
		return true;
	} else {
		return false;
	}
}


function helpWindow(id) {
// Open a pop up window with specific help instructions

		HelpWindow = window.open('/bavn/index.cfm?fuseaction=home.help&hid='+id,'Help','resizable=yes,toolbar=yes,location=no,scrollbars=auto,width=350,height=400')
		HelpWindow.focus()
}



// Following functions set the parameters for the calendar popup

function calPosition()
{
	this.x = null;
	this.y = null;
}

function calPopupPosition(element, event)
{

	popupPosition = new calPosition();
	popupPosition.x = event.screenX;
	popupPosition.y = event.screenY;
	if (event.screenX > screen.availWidth - popupWidth)
		popupPosition.x = screen.availWidth - popupWidth - 10;
	if (event.screenY > screen.availHeight - popupHeight)
		popupPosition.y = screen.availHeight - popupHeight - 30;
	return popupPosition;
}

