/* 
Library Name:	members-update.js

Synopsis:		Supply scripts for the HTML page generated by members-update.aspx

Author:			David A. Gray of Simple Soft Services, Inc., d/b/a P6 Consulting

Copyright:		(c) 2007, The Edit House, Inc., d/b/a The Learning Agency

Modification history:

	Date	   Version Who What was done.
	---------- ------- --- ----------------------------------------------------------------------------------------------------
	2007/04/3 1.0.0.0 DAG Initial version.
	============================================================================
*/

function TestFieldGroups ( pActionCode )
{
	/*
	Name:		p6new_br

	Synopsis:	Open a new browser window.

	Arguments:	pActionCode     = Numeric action code, to determine action to
								  perform.

	Author:		David A. Gray, of Simple Soft Services, Inc., d/b/a WizardWrx,
				on behalf of The Edit House, Inc., d/b/a The Learning Agency.

	Created:	Wednesday, 25 April 2007 to Friday, 27 April 2007.

	Copyright: 	2007, The Edit House, Inc., d/b/a The Learning Agency.
	 			All rights reserved world wide.

	Modification history:

	Date	   Who What was done.
	---------- --- -------------------------------------------------------------
	2007/04/27 DAG Created and tested original feature set.

	*/

	// Declare variables.

	var BlurryObjectValue ;

	// The Big Switch drives everything.

	//alert ( 'pActionCode = ' + pActionCode ) ;
	switch ( parseInt ( pActionCode ) ) {
		case 1 :
			// If CertificationState is National Registry, disable the state license fields.
			BlurryObjectValue = switchDom ( this , 'CertificationState' ).value ;
			//alert ( 'BlurryObjectValue = ' + BlurryObjectValue ) ;
			if ( BlurryObjectValue == 'NR' ) {
				EnableControls('NationalRegistryID;NRReRegDate','text');
				switchDom (this,'NatRegChoice').checked = true;
				switchDom (this,'NatRegChoice').disabled = true;
				if ( !DisableControls ( 'LicenseRenewalDate;StateLicenseID' ) ) {
					alert ( 'Processing error 001 in JavaScript function TestFieldGroups - please contact EmCert, Inc.' ) ;
				}
			} else {
				switchDom (this,'NatRegChoice').disabled = false;
				if ( !EnableControls ( 'LicenseRenewalDate;StateLicenseID','text' ) ) {
					alert ( 'Processing error 002 in JavaScript function TestFieldGroups - please contact EmCert, Inc.' ) ;
				}
			}
			break ;
		case 2 :
			// If NationalRegistryID is blank, disable the corresponding renewal date field.
			BlurryObjectValue = switchDom ( this , 'NationalRegistryID' ).value ;
			if ( BlurryObjectValue == '' ) {
				if ( !DisableControls ( 'NRReRegDate' ) ) {
					alert ( 'Processing error 003 in JavaScript function TestFieldGroups - please contact EmCert, Inc.' ) ;
				}
			} else {
				if ( !EnableControls ( 'NRReRegDate' ) ) {
					alert ( 'Processing error 004 in JavaScript function TestFieldGroups - please contact EmCert, Inc.' ) ;
				}
			}
			break ;
		case 3 :
			if (switchDom (this,'NatRegChoice').checked){
				EnableControls('NationalRegistryID;NRReRegDate','text');
			}
			else{
				DisableControls('NationalRegistryID;NRReRegDate');
			}
			break ;
		default :
			// EEK!
			alert ( 'Processing error 005 in JavaScript function TestFieldGroups - please contact EmCert, Inc.' ) ;
			return false ;
	}
	return true ;
}
