	//Define an object that will be used as validation functions return value.
	function ReturnInfo(iReturnCode, sErrorDescription, iErrorField) {
		this.ReturnCode = iReturnCode;
		this.ErrorDescription = sErrorDescription;
		this.ErrorField = iErrorField;
	}
	
	
	//Define an object that will be used to display error messages to the user.
	function UserError(sErrorField, sErrorMessage, iErrorLineID, iErrorSeverity) {
		this.ErrorField = sErrorField;
		this.ErrorMessage = sErrorMessage;
		this.ErrorLineID = iErrorLineID;
		this.ErrorSeverity = (iErrorSeverity==null?1:iErrorSeverity);
	}

	// Create and discard an initial Circle object.
	// This forces the prototype object to be created in JavaScript 1.1.
	new UserError(0, '', 0, 1);
	
	//Assign the a function to the DisplayError method of the UserError object.
	UserError.prototype.DisplayError = DisplayUserError;
	
	


	//=========================================================================
	// Clear the error messages and reset the field captions.
	//=========================================================================
	function ResetErrorDisplay(bEstForm) {
	
	if(bEstForm == null)
    bEstForm = true;
    
	var hErrorMessageLines = document.getElementsByTagName('label');
	var iIndex;
	
		for (iIndex = 0; iIndex < hErrorMessageLines.length; iIndex++) {
			if (hErrorMessageLines[iIndex].attributes["name"].value == 'ErrorMessageLine') {
			var src;
			if (hErrorMessageLines[iIndex].parentElement) src = hErrorMessageLines[iIndex].parentElement;
			else if (hErrorMessageLines[iIndex].parentNode) src = hErrorMessageLines[iIndex].parentNode; 
				src.className = 'ErrorMessageOff';
				hErrorMessageLines[iIndex].innerHTML = '';
			}
				
			if (hErrorMessageLines[iIndex].attributes["name"].value == 'FieldCaption')
				hErrorMessageLines[iIndex].style.color = "#000000";
				if(bEstForm) {
          hErrorMessageLines[iIndex].style.fontWeight = 'normal';
        }
		}
		
	}



	//=========================================================================
	// Display an error message and focus on the field with the error.	
	//=========================================================================
	function DisplayUserError() {
	var hInputCaption = document.getElementById('lbl' + this.ErrorField.slice(3));
	//alert(hInputCaption.id);
	var hInputObject = document.getElementById(this.ErrorField);
	var sMessageLabel = 'lblErrorMessage' + this.ErrorLineID;
	var sErrorIcon;

		switch (this.ErrorSeverity) {
		case 1:
			sErrorIcon = '<IMG src="smartlead/images/error_icon.gif" align="absmiddle" width="17" height="17">';
			break;
		case 2:
			sErrorIcon = '<IMG src="smartlead/images/warning_icon.gif" align="absmiddle" width="17" height="17">';
			break;
		case 3:
			sErrorIcon = '<IMG src="smartlead/images/info_icon.gif" align="absmiddle" width="17" height="17">';
		}
		
		var msg_lbl = document.getElementById(sMessageLabel);
		
		if (msg_lbl.parentElement) msg_lbl.parentElement.className = 'ErrorMessageOn';
		else if (msg_lbl.parentNode) msg_lbl.parentNode.className = 'ErrorMessageOn';
		msg_lbl.innerHTML = '&nbsp;' + this.ErrorMessage + '&nbsp;';
		msg_lbl.scrollIntoView();

		if (hInputCaption != null) {
			hInputCaption.style.color = '#ff0000';
			hInputCaption.style.fontWeight = 'bold';
    }

		if (hInputObject != null)
			hInputObject.focus();
}
