/** public class FormValidationError extends CobaltError : Encapsulates handling of
  * cblt form validation errors.
  * @param Array fieldVOList List of fields that failed validation
  * @param Array message Message text for system alert
  * @param errorMsgId id of element to append error message to
  * @param errorType determines what visuals to show errors accepted entries:
  * 		label - colors the text of the label for the field
  * 		both - highlights the field error and text color
  *			class - highlight the field and add "fieldGroupError" class to parent
  * 		default is highlight the fields. 
  */
function FormValidationError(fieldList, message, errorMsgId, errorType) {
	this.fieldList = fieldList;
	if (message) this.message = message;
	if(errorMsgId) this.errorMsgId = errorMsgId;
	if(errorType) this.errorType = errorType;
}
FormValidationError.prototype = new CobaltError;
/** public void executeStandardAlert : Changes background color of fields,
  * opens a system alert displaying the message.
  */
FormValidationError.prototype.executeStandardActions = function() {
	
	if (this.errorType == "label") {
		FormUtility.colorLabels(this.fieldList);
	} else if (this.errorType == "both") {
		FormUtility.colorLabels(this.fieldList);
		FormUtility.highlightFields(this.fieldList);
	} else if (this.errorType == "class") {
		FormUtility.changeFieldsColor(this.fieldList, "fdd9db");
		FormUtility.addFieldGroupErrorClass(this.fieldList);
		FormUtility.highlightedFields = this.fieldList;
	} else {
		FormUtility.highlightFields(this.fieldList);
	}
	if (this.errorMsgId) {
		document.getElementById(this.errorMsgId).style.display = "block";
		document.getElementById(this.errorMsgId).innerHTML = this.message;
		if (typeof handleResize != "undefined") { handleResize(); }
		return false;
	} else {
		alert(this.message);
	}
	
}
/** public void handleException : overrides CobaltError.handleException.
  * Executes the standard form validation functionality.
  */
FormValidationError.prototype.handleException = function() { this.executeStandardActions(); }


/** public class MissingRequiredError extends CobaltError : Encapsulates handling of
  * missing required fields from form validation.
  * @param Array fieldVOList List of fields that failed validation
  */
function MissingRequiredError(fieldList,errorMsgId,errorType) {
	this.superClass(fieldList, ERRORMESSAGE_ENTER_REQUIRED_DATA, errorMsgId, errorType);
}
MissingRequiredError.prototype = new FormValidationError;
MissingRequiredError.prototype.superClass = FormValidationError;

/** public class BadFormatError extends CobaltError : Encapsulates handling of
  * fields formatted badly.
  * @param Array fieldVOList List of fields that failed validation
  */
function BadFormatError(fieldList,errorMsgId,errorType) {
	this.superClass(fieldList, ERRORMESSAGE_ENTER_REQUIRED_DATA, errorMsgId, errorType);
}
BadFormatError.prototype = new FormValidationError;
BadFormatError.prototype.superClass = FormValidationError;


