/**

	form.js

	This library will contain supporting functions used by all qForm forms.

	DateTime	Initials	Description
	------------------------------------------------------
	05/07/2006	ADL			Created.

*/

// Set all of the form fields that match a given object.		
function setObjectValues(obj){

	// Create a reference to the current collection of form fields
	var currentFields = objForm.getFields();

	// Get the fields from the form
	for( var thisField in currentFields ){
	
		// Was this form field found in the address definition?
		if( obj[thisField] != undefined ){ eval('objForm.' + thisField + '.setValue(obj[thisField])'); }

	}
	
}

// Create a method to reset the current form
function resetForm() {

	// Initialize any variables required
	var resetFlag = true;
	
	// Has the form changed?
	if( objForm.hasChanged() ){
			
		// Confirm that the user would like to cancel their changes
		if( !confirm('Reset and lose your changes?') ){					
				
			// Set the redirect flag to false;
			resetFlag = false;

		}

	} 
	
	// Is the reset flag set to true
	if( resetFlag == true ){
				
		// Reset the original form values
		qFormsInit();

	}		

}


