// [PUBLIC] Check or uncheck all postings
function WBC_checkAllPostings( bChecked ) 
{
	// IMPORTANT: If the name of the form fields (NC_Posting) are changed
	// in the ASP (IDS_FORM_ELEMENT_SELECTFORAPPROVEDECLINE), this routine 
	// needs updating
	
	if ( document.WBC_frmApprovalAssistant.NC_Postings ) 
	{
		if ( !document.WBC_frmApprovalAssistant.NC_Postings.length ) 
		{
			// only 1 item in list
			document.WBC_frmApprovalAssistant.NC_Postings.checked = bChecked
			
		} 
		else 
		{
			// multiple items in list	
			for ( var i = 0; i < document.WBC_frmApprovalAssistant.NC_Postings.length; i++ )
			{
				document.WBC_frmApprovalAssistant.NC_Postings[i].checked = bChecked;
				
			}  // for i over all pages in list
			
		}  // else multiple items in list
		
	}  // if pages displayed
	
}  // WBC_checkAllPostings


// [PRIVATE] Determine if at least one page has been selected for approve or
// decline action.
function WBC_isPostingSelected() 
{	
	// IMPORTANT: If the name of the form fields (NC_Postings) are changed
	// in the ASP (IDS_FORM_ELEMENT_SELECTFORAPPROVEDECLINE), this routine 
	// needs updating
	
	var bIsPostingSelected = false;

	// handle case where only one page is listed in the window
	if ( !document.WBC_frmApprovalAssistant.NC_Postings.length ) 
	{
		if 	( document.WBC_frmApprovalAssistant.NC_Postings.checked == true )
		{
			bIsPostingSelected = true;
			
		}  // if the single item is checked
		
	}  // if there is only one item on the page
	
	else
	{
		for ( var i = 0; i < document.WBC_frmApprovalAssistant.NC_Postings.length; i++ ) 
		{	
			if 	( document.WBC_frmApprovalAssistant.NC_Postings[i].checked == true )
			{
				bIsPostingSelected = true;
				break;
				
			}  // if at least one posting checked
			
		}  //  loop over all postings on page
		
	}  // else more than one item listed
			
	return bIsPostingSelected;
	
}  // WBC_isPostingSelected


// Approve or decline selected postings
function WBC_processApproveDeclineAction( strAction )
{
	if ( WBC_isPostingSelected() == true) 
	{
		document.WBC_frmApprovalAssistant[ "NC_ApproveOrDecline" ].value = strAction;
		document.WBC_frmApprovalAssistant.submit();
		
	}  // if at least one posting selected
	
	else
	{
		// no postings selected when the button was clicked, so display 
		// an error message and let the dialog remain as-is
		alert( IDS_APPROVALASSISTANT_NOPOSTINGSSELECTED );
		
	}  // else no postings selected
	
}  // WBC_processApproveDeclineAction