var errorFlag 			= false;
var errorCount 			= 0;
var oErrorObjectArray 	= new Array();
var oErrorDialog;
var sErrorDialogFile
var errorLimit
var sXML
var sGlobalErrorText    = "";
sErrorDialogFile 		= "/errors/errordialog.asp";	
errorLimit				= -1;
function DecimalValidator(sField, sDisplayFieldName, bRequired, nMinVal, nMaxVal)
{
	var bValid = true;
	var sErrorText = "";
	var Value = eval("document." + sField + ".value"); 
	if(HandleRequired(Value, sField, sDisplayFieldName, bRequired))
	{	
		return;
	}
    if ( (nMaxVal != null && nMinVal != null) && (Value > nMaxVal) || (Value < nMinVal))
    {
    	sErrorText = sDisplayFieldName + ' does not match the minimum value of ' + nMinVal + ' and maximum value of ' + nMaxVal + '!';
    	bValid=false;
    }
	else	
	{
    	bValid = PerformSimpleValidation(Value,
    									/^((\+)|(\-))?(\d)*(\.)?(\d)*$/ );
		if (!bValid)
		{
			sErrorText = sDisplayFieldName + ' is not a valid decimal!';
		}
	}
	if (!bValid)
	{
		HandleError(sField, sDisplayFieldName, sErrorText);
	}
}
function PositiveDecimalValidator(sField, sDisplayFieldName, bRequired, bAllowZeroValue, nMinVal, nMaxVal)
{
	var bValid = true;
	var sErrorText = "";
	var Value = eval("document." + sField + ".value"); 
	if(HandleRequired(Value, sField, sDisplayFieldName, bRequired))
	{	
		return;
	}
	if(Value<0)
	{	
		sErrorText = sDisplayFieldName + ' is not a valid positive decimal!';
		HandleError(sField, sDisplayFieldName, sErrorText);
		return;
	}
    if ( (nMaxVal != null && nMinVal != null) && (Value > nMaxVal) || (Value < nMinVal))
    {
    	sErrorText = sDisplayFieldName + ' does not match the minimum value of ' + nMinVal + ' and maximum value of ' + nMaxVal + '!';
    	bValid=false;
    }
	else	
	{
    	bValid = PerformSimpleValidation(Value,
    			                            /^(\+)?(\d)*(\.)?(\d)*$/ );
		if (!bValid)
   		{
    		sErrorText = sDisplayFieldName + ' is not a valid positive decimal!';
    		if (!bAllowZeroValue) 
    		{
    			sErrorText += '  ' + sDisplayFieldName + ' is not allowed to be zero!';
    		}
		}
	}
	var dFloat = parseFloat(Value);
	if (isNaN(dFloat))
	{
		bValid = false;
	}
	if (!bAllowZeroValue && dFloat == 0.0)
	{ 
		bValid = false;		
	}
	if (!bValid)
	{
		HandleError(sField, sDisplayFieldName, sErrorText);
	}
}
function NegativeDecimalValidator(sField, sDisplayFieldName, bRequired, bAllowZeroValue, nMinVal, nMaxVal)
{
	var bValid = true;
	var sErrorText = "";
	var Value = eval("document." + sField + ".value"); 
	if(HandleRequired(Value, sField, sDisplayFieldName, bRequired))
	{	
		return;
	}
	if(Value>0)
	{	
		sErrorText = sDisplayFieldName + ' is not a valid negative decimal!';
		HandleError(sField, sDisplayFieldName, sErrorText);
		return;
	}
    if ( (nMaxVal != null && nMinVal != null) && (Value < nMaxVal) || (Value > nMinVal))
    {
    	sErrorText = sDisplayFieldName + ' does not match the minimum value of ' + nMinVal + ' and maximum value of ' + nMaxVal + '!';
    	bValid=false;
    }
	else	
	{
    	bValid = PerformSimpleValidation(Value,
    			 	                          /^(\-)(\d)*(\.)?(\d)*$|^[0]*(\.)[0]*$/ );
		if (!bValid)
		{
    		sErrorText = sDisplayFieldName + ' is not a valid negative decimal!';
    		if (!bAllowZeroValue) 
    		{
    			sErrorText += '  ' + sDisplayFieldName + ' is not allowed to be zero!';
    		}
		}
	}
	var dFloat = parseFloat(Value);
	if (isNaN(dFloat))
	{
		bValid = false;
	}
	if (!bAllowZeroValue && dFloat == 0.0)
	{ 
		bValid = false;		
	}
	if (!bValid)
	{
		HandleError(sField, sDisplayFieldName, sErrorText);
	}
}
function IntegerValidator(sField, sDisplayFieldName, bRequired, nMinVal, nMaxVal)
{
	var bValid = true;
	var sErrorText = "";
	var Value = eval("document." + sField + ".value"); 
	if(HandleRequired(Value, sField, sDisplayFieldName, bRequired))
	{	
		return;
	}
    if ( (nMaxVal != null && nMinVal != null) && (Value > nMaxVal) || (Value < nMinVal))
    {
    	sErrorText = sDisplayFieldName + ' does not match the minimum value of ' + nMinVal + ' and maximum value of ' + nMaxVal + '!';
    	bValid=false;
    }
	else	
	{
    	bValid = PerformSimpleValidation(Value,
    									/^[\-,\+]?[0-9]+$/ );
		if (!bValid)
		{
			sErrorText = sDisplayFieldName + ' is not a valid integer!';
		}
	}
	if (!bValid)
	{
		HandleError(sField, sDisplayFieldName, sErrorText);
	}
}
function PositiveIntegerValidator(sField, sDisplayFieldName, bRequired, bAllowZeroValue, nMinVal, nMaxVal)
{
	var bValid = true;
	var sErrorText = "";
	var Value = eval("document." + sField + ".value"); 
	if(HandleRequired(Value, sField, sDisplayFieldName, bRequired))
	{	
		return;
	}

	if(Value<0)
	{	
		sErrorText = sDisplayFieldName + ' is not a valid positive integer!';
		HandleError(sField, sDisplayFieldName, sErrorText);
		return;
	}
    if ( (nMaxVal != null && nMinVal != null) && (Value > nMaxVal) || (Value < nMinVal))
    {
    	sErrorText = sDisplayFieldName + ' does not match the minimum value of ' + nMinVal + ' and maximum value of ' + nMaxVal + '!';
    	bValid=false;
    }
	else	
	{
    	if (bAllowZeroValue)
    	{
    		bValid = PerformSimpleValidation(Value,
    			                            /^[\+]?[0-9]+$/ );
    	}	
    	else
    	{
    		bValid = PerformSimpleValidation(Value,
    	    	                           /^[\+]?[1-9]+[0-9]*$/);
    	} 
		if (!bValid)
		{
			sErrorText = sDisplayFieldName + ' is not a valid positive integer!  Please ensure there are no commas or decimals in your input!';
			if (!bAllowZeroValue) 
			{
				sErrorText += '  ' + sDisplayFieldName + ' is not allowed to be zero!';
			}	
		}
	}
	if (!bValid)
	{
		HandleError(sField, sDisplayFieldName, sErrorText);
	}
}
function NegativeIntegerValidator(sField, sDisplayFieldName, bRequired, bAllowZeroValue, nMinVal, nMaxVal)
{
	var bValid = true;
	var sErrorText = "";
	var Value = eval("document." + sField + ".value"); 

	//	Handle whether or not a field is required or not
	if(HandleRequired(Value, sField, sDisplayFieldName, bRequired))
	{	
		return;
	}
	if(Value>0)
	{	
		sErrorText = sDisplayFieldName + ' is not a valid positive decimal!';
		HandleError(sField, sDisplayFieldName, sErrorText);
		return;
	}
    if ( (nMaxVal != null && nMinVal != null) && (Value < nMaxVal) || (Value > nMinVal))
    {
    	sErrorText = sDisplayFieldName + ' does not match the minimum value of ' + nMinVal + ' and maximum value of ' + nMaxVal + '!';
    	bValid=false;
    }
	else	
	{
    	if (bAllowZeroValue)
    	{
    		bValid = PerformSimpleValidation(Value,
    			                            /^[\-][0-9]+$|^[0]*$/ );
    	}	
    	else
    	{
    		bValid = PerformSimpleValidation(Value,
    	    	                          	/^[\-][1-9]+[0-9]*$/ );
    	} 
		if (!bValid)
		{
			sErrorText = sDisplayFieldName + ' is not a valid negative integer!';
			if (!bAllowZeroValue) 
			{
				sErrorText += '  ' + sDisplayFieldName + ' is not allowed to be zero!';
			}	
		}
	}
	if (!bValid)
	{
		HandleError(sField, sDisplayFieldName, sErrorText);
	}
}
function StringValidator(sField, sDisplayFieldName, bRequired, nMinChars, nMaxChars)
{
	var bValid = true;
	var sErrorText = "";
	var Value = eval("document." + sField + ".value"); 
    Value = StripLeadingSpaces(Value);
    Value = StripTrailingSpaces(Value);
	if(HandleRequired(Value, sField, sDisplayFieldName, bRequired))
	{	
		return;
	}
    if ( (nMaxChars != "" && nMinChars != "") && (Value.length > nMaxChars)|| (Value.length < nMinChars))
    {
    	sErrorText = sDisplayFieldName + ' does not match the minimum length of ' + nMinChars + ' and maximum length of ' + nMaxChars + '!';
    	bValid=false;
    }
	else if (Value != "")
	{
		bValid = PerformSimpleValidation(Value,
									/^[0-9a-zA-Z\ \!\@\#\$\%\^\&\*\(\)\_\+\-\=\[\]\|\\\{\}\;\'\:\"\,\.\/\<\>\?\r\n]+$/ );
		if (!bValid)
		{
			sErrorText = sDisplayFieldName + ' is not a valid string!';
		}
	}
	if (!bValid)
	{
		HandleError(sField, sDisplayFieldName, sErrorText);
	}
}
function SelectValidator(sField, sDisplayFieldName, sItemName)
{
	var bValid = true;
	var sErrorText = "";
	var nullTest = eval("document." + sField)
	if(nullTest.options.length != 0)
	{
		if(nullTest.selectedIndex < 0)
		{
			bValid = false
		}else{
			var Value = eval("document." + sField + ".options[document." + sField + ".selectedIndex].value"); 
			if(Value == -1 || Value == "-1")
			{
				bValid = false
			}
		}
	}else{
		bValid = false
	}
	if(bValid == false)
	{
		if(sItemName == "")
		{
			sErrorText = "You must select a " + sDisplayFieldName + "!";
		} else {
			sErrorText = "You must select a " + sItemName + " for " + sDisplayFieldName + "!";
		}
		HandleError(sField, sDisplayFieldName, sErrorText);
	}

}
function DateValidator(monthField, dayField, yearField, sDisplayFieldName, bRequired, bValidateAll)
{   
	var bValid = true;
	var sErrorText = "";
	if (typeof bValidateAll != "boolean")
	{
		bValidateAll = false;
	}
   	var month 	= eval("document." + monthField + ".value")
   	var day 	= eval("document." + dayField + ".value")
   	var year 	= eval("document." + yearField + ".value")
	if (month != "" || day != "" || year != "")
	{
		bRequired = true;
	}
	if ((month=="" || day=="" || year =="") && bRequired)
	{
   		sErrorText = sDisplayFieldName + ' is a required field!';
   		HandleError(monthField, sDisplayFieldName, sErrorText);
	}
	bValid = MonthValidator(monthField,sDisplayFieldName+" Month",bValidateAll) & DayValidator(dayField,sDisplayFieldName+" Day",bValidateAll) & YearValidator(yearField,sDisplayFieldName+" Year",bValidateAll);
	if (bValid)
	{
        var intMonth= parseInt(month, 10);
        var intDay 	= parseInt(day, 10);
        var intYear = parseInt(year, 10);
	    if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intDay > 31 || intDay < 1)) 
		{
    		sErrorText = sDisplayFieldName + ' is not a valid date!';
    		HandleError(monthField, sDisplayFieldName, sErrorText);
	    }
    	if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intDay > 30 || intDay < 1)) 
		{
    		sErrorText = sDisplayFieldName + ' is not a valid date!';
    		HandleError(monthField, sDisplayFieldName, sErrorText);
    	}
	    if (intMonth == 2) 
		{
        	if (LeapYear(intYear) == true) 
    		{
    		    if (intDay > 29) 
    			{
    				sErrorText = sDisplayFieldName + ' is not a valid date!';
    				HandleError(monthField, sDisplayFieldName, sErrorText);
        		}
        	}
        	else 
    		{
        		if (intDay > 28) 
    			{
    				sErrorText = sDisplayFieldName + ' is not a valid date!';
    				HandleError(monthField, sDisplayFieldName, sErrorText);
    		    }
        	}
		}
	}
}
function ServiceDateValidator(monthField, dayField, yearField, sDisplayFieldName, bRequired)
{   
	var bValid = true;
	var sErrorText = "";
	var dDate = new Date();
	var iDay = dDate.getDate();
	var iMonth = dDate.getMonth() + 1;
	var iYear = dDate.getYear();

   	var iServiceMonth 	= eval("document." + monthField + ".value")
   	var iServiceDay 	= eval("document." + dayField + ".value")
   	var iServiceYear 	= eval("document." + yearField + ".value")

	var dServiceDate = new Date(iServiceYear, iServiceMonth, iServiceDay)
	var dToday = new Date(iYear, iMonth, iDay)

	if (dServiceDate > dToday)
	{
		sErrorText = "New Service Date must be prior to today";
		HandleError(iServiceMonth, sDisplayFieldName, sErrorText); 
	}	
}
function LeapYear(intYear) 
{
    if (intYear % 100 == 0) 
	{
    	if (intYear % 400 == 0) 
		{ 
			return true; 
		}
    } else {
    	if ((intYear % 4) == 0) 
		{ 
			return true; 
		}
    }
    return false;
}
function MonthValidator(sField, sDisplayFieldName, bRequired)
{   
	var bValid = true;
	var sErrorText = "";
	var Value = eval("document." + sField + ".value"); 
	if(HandleRequired(Value, sField, sDisplayFieldName, bRequired))
	{	
		return false;
	}

	if( isNaN(Value) || Value <= 0 || Value > 12)
	{	
		sErrorText = sDisplayFieldName + ' is not a valid month!';
		HandleError(sField, sDisplayFieldName, sErrorText);
		return false
	}
	return true;
}
function DayValidator(sField, sDisplayFieldName, bRequired)
{   
	var bValid = true;
	var sErrorText = "";
	var Value = eval("document." + sField + ".value"); 

	//	Handle whether or not a field is required or not
	if(HandleRequired(Value, sField, sDisplayFieldName, bRequired))
	{	
		return false;
	}

	if( isNaN(Value) || Value <= 0 || Value > 31)
	{	
		sErrorText = sDisplayFieldName + ' is not a valid day!';
		HandleError(sField, sDisplayFieldName, sErrorText);
		return false;
	}
	return true;
}
function YearValidator(sField, sDisplayFieldName, bRequired)
{   
	var bValid = true;
	var sErrorText = "";
	var Value = eval("document." + sField + ".value"); 
	if(HandleRequired(Value, sField, sDisplayFieldName, bRequired))
	{	
		return false;
	}

	if( isNaN(Value) || Value <= 0 || Value.length != 4 || Value < 1900)
	{	
		sErrorText = sDisplayFieldName + ' is not a valid year!';
		HandleError(sField, sDisplayFieldName, sErrorText);
		return false;
	}
	return true;
}
function SSNValidator(sField, sDisplayFieldName, bRequired)
{
	var bValid = true;
	var sErrorText = "";
	var Value = eval("document." + sField + ".value"); 

	//	Handle whether or not a field is Required or not
	if(HandleRequired(Value, sField, sDisplayFieldName, bRequired))
	{	
		return;
	}
	bValid = (PerformSimpleValidation(Value, /^\d{3}-\d{2}-\d{4}$/ ) || PerformSimpleValidation(Value, /\d{9}/ ))
	if (!bValid)
	{
 		sErrorText = sDisplayFieldName + ' is not a valid Social Security Number!  The format for a SSN is: 999-99-9999';
		HandleError(sField, sDisplayFieldName, sErrorText);
	}
}
function SeperatedSSNValidator(sField1,sField2,sField3, sDisplayFieldName, bRequired)
{
	var bValid = true;
	var sErrorText = "";
	var Value1 = eval("document." + sField1 + ".value"); 
	var Value2 = eval("document." + sField2 + ".value"); 
	var Value3 = eval("document." + sField3 + ".value"); 
	if (Value1 != "" || Value2 != "" || Value3 != "")
	{
		bRequired = true;
	}
	if(HandleRequired(Value1, sField1, sDisplayFieldName, bRequired) || HandleRequired(Value2, sField2, sDisplayFieldName, bRequired) || HandleRequired(Value3, sField3, sDisplayFieldName, bRequired))
	{	
		return;
	}
	sErrorText = sDisplayFieldName + ' is not a valid Social Security Number!  The format for a SSN is: 999-99-9999';
	bValid = PerformSimpleValidation(Value1, /^\d{3}$/ );
	if (!bValid)
	{
		HandleError(sField1, sDisplayFieldName, sErrorText);
	}
	bValid = PerformSimpleValidation(Value2, /^\d{2}$/ );
	if (!bValid)
	{
		HandleError(sField2, sDisplayFieldName, sErrorText);
	}
	bValid = PerformSimpleValidation(Value3, /^\d{4}$/ );
	if (!bValid)
	{
		HandleError(sField3, sDisplayFieldName, sErrorText);
	}
}
function PhoneValidator(sField, sDisplayFieldName, bRequired)
{
	var bValid = true;
	var sErrorText = "";
	var Value = eval("document." + sField + ".value"); 
	if(HandleRequired(Value, sField, sDisplayFieldName, bRequired))
	{	
		return;
	}
	bValid = PerformSimpleValidation(Value, /(^\([0-9]{3}\)\s[0-9]{3}\-[0-9]{4}$)|(^[0-9]{3}\-[0-9]{3}\-[0-9]{4}$)/ );
	if (!bValid)
	{
		sErrorText = sDisplayFieldName + ' is not a valid Phone Number!  Valid formats include: (904) 555-1212 OR 904-555-1212';
		HandleError(sField, sDisplayFieldName, sErrorText);
	}
}
function SeperatedPhoneValidator(sField1,sField2,sField3, sDisplayFieldName, bRequired)
{

	var bValid = true;
	var sErrorText = "";
	var Value1 = eval("document." + sField1 + ".value"); 
	var Value2 = eval("document." + sField2 + ".value"); 
	var Value3 = eval("document." + sField3 + ".value"); 
	if (Value1 != "" || Value2 != "" || Value3 != "")
	{
		bRequired = true;
	}

	if(HandleRequired(Value1, sField1, sDisplayFieldName, bRequired) || HandleRequired(Value2, sField2, sDisplayFieldName, bRequired) || HandleRequired(Value3, sField3, sDisplayFieldName, bRequired))
	{	
		return;
	}
	sErrorText = sDisplayFieldName + ' is not a valid Phone Number!  Ex: 904 555 1212';
	bValid = PerformSimpleValidation(Value1, /\d{3}/ );
	if (!bValid)
	{
		HandleError(sField1, sDisplayFieldName, sErrorText);		
	}
	bValid = PerformSimpleValidation(Value2, /\d{3}/ );
	if (!bValid)
	{
		HandleError(sField2, sDisplayFieldName, sErrorText);
	}
	bValid = PerformSimpleValidation(Value3, /\d{4}/ );
	if (!bValid)
	{
		HandleError(sField3, sDisplayFieldName, sErrorText);
	}
}
function ZipCodeValidator(sField, sDisplayFieldName, bRequired)
{
	var bValid = true;
	var sErrorText = "";
	var Value = eval("document." + sField + ".value"); 
	if(HandleRequired(Value, sField, sDisplayFieldName, bRequired))
	{	
		return;
	}
	bValid = (PerformSimpleValidation(Value,/^\d{5}-\d{4}$/)  || PerformSimpleValidation(Value,/\d{5}/));
	if (!bValid)
	{
		sErrorText = sDisplayFieldName + ' is not a valid Zip Code!  Example: 99999-9999 or 99999';
	}		
	if (!bValid)
	{
		HandleError(sField, sDisplayFieldName, sErrorText);
	}
}
function SeperatedZipCodeValidator(sField1, sField2, sDisplayFieldName, bRequired)
{
	var bValid = true;
	var Value2 = "";
	var Value2 = "";
	var sErrorText = "";

	Value1 = eval("document." + sField1 + ".value"); 
	if (typeof sField2 != "string" && sField2 != "")
	{	
		Value2 = eval("document." + sField2 + ".value"); 
	}
	if(HandleRequired(Value1, sField1, sDisplayFieldName, bRequired))
	{	
		return;
	}
	bValid = PerformSimpleValidation(Value1, /^\d{5}$/ );
	if (!bValid)
	{
		sErrorText = sDisplayFieldName + ' is not a valid Zip Code!  The format for a Zip is: 99999';
		HandleError(sField1, sDisplayFieldName, sErrorText);
		bValid = true; // Reset so the extension gets validated
	}
	if (bValid && Value2 != "")
	{
		bValid = PerformSimpleValidation(Value2, /^\d{4}$/ );
	}
	if (!bValid)
	{
		sErrorText = sDisplayFieldName + ' is not a valid Zip Code Extension!  The format for the extension is: 9999';
		HandleError(sField2, sDisplayFieldName, sErrorText);
	}
}
function EmailValidator(sField, sDisplayFieldName, bRequired)
{
	var bValid = true;
	var sErrorText = "";
	var Value = eval("document." + sField + ".value"); 
	if(HandleRequired(Value, sField, sDisplayFieldName, bRequired))
	{	
		return;
	}
	bValid = PerformSimpleValidation(Value, /^[\w-_.]*[\w-_.]\@[\w].+[\w]+[\w]$/ );
											
	if (!bValid)
	{		
		sErrorText = sDisplayFieldName + ' is not a valid email address!  The format for Email is: xxx@xxxx.xx';
	}		
	if (!bValid)
	{
		HandleError(sField, sDisplayFieldName, sErrorText);
	}
}
function EmailConfirmValidator(sField, sDisplayFieldName, sFieldConfirm, sDisplayFieldConfirmName)
{
	var bValid = true;
	var sErrorText = "";
	var Value = eval("document." + sField + ".value"); 
	var ValueConfirm = eval("document." + sFieldConfirm + ".value"); 

	if (Value != ValueConfirm)
	{
		sErrorText = sDisplayFieldName + ' and ' + sDisplayFieldConfirmName + ' do not match!';
		HandleError(sFieldConfirm, sDisplayFieldConfirmName, sErrorText)

		return true;
	}	
}
function HandleRequired(Value, sField, sDisplayFieldName, bRequired)
{
	if (bRequired && Value == "" || Value == null)
	{
		sGlobalErrorText = sErrorText = sDisplayFieldName + ' is a Required field!';
		HandleError(sField, sDisplayFieldName, sErrorText)		
		return true;
	}
	else if (!bRequired && Value == "" || Value == null)
	{
		return true;
	}
	else
	{
		return false;
	}
}
function PerformSimpleValidation(sString, regExTemplate)
{
	sString = StripLeadingSpaces(sString);
	sString = StripTrailingSpaces(sString);
	if (!MatchRegExPattern(sString, regExTemplate))
	{
		return false;
	} 
	else 
	{
		return true;
	}
}
function MatchRegExPattern(sString, sPattern)
{
	return sPattern.test(sString);
}
function StripLeadingSpaces(sString)
{
	var regExTemplate = /^\s*/;
	return sString.replace(regExTemplate, "");
}
function StripTrailingSpaces(sString)
{
	var regExTemplate = /\s*$/;
	return sString.replace(regExTemplate, "");
}
function CheckForErrors()
{
	if (errorFlag)
	{	
		RenderError();
		return false;
	} else {
		return true;
	}
}
function HandleError(sFieldName, sDisplayName, sErrorText)
{
	sGlobalErrorText = sErrorText;
	if (errorLimit == -1 || errorCount < errorLimit)
	{
		oErrorObjectArray[errorCount] = {
									FieldName:sFieldName,
									DisplayName:sDisplayName, 
									Number:errorCount+1, 
									Description:sErrorText
									};
		errorCount++;
		errorFlag = true;
	}
}
function RenderError()
{
	sXML = ArraytoXML(oErrorObjectArray);
	oErrorDialog = window.open(sErrorDialogFile,"ErrorPage","toolbar=no,scrollbars=yes,menubar=no,directories=no,location=no,status=no,width=600,height=420");
	ResetErrors();
}
function ResetErrors()
{
	errorFlag = false;
	errorCount = 0;
	oErrorObjectArray = new Array();
}
function ArraytoXML(aArray)
{
	var sResult = "<root><errs>";
	for(var i=0; i<aArray.length; i++)
	{
		sResult += "<e>";
		sResult += "<Fld>" 	+ aArray[i]["FieldName"] 			+ "</Fld>";
		sResult += "<Disp>" + aArray[i]["DisplayName"] 	+ "</Disp>";
		sResult += "<Num>"  + aArray[i]["Number"] 				+ "</Num>";
		sResult += "<Desc>" + aArray[i]["Description"]	+ "</Desc>";
		sResult += "</e>";
	}
	sResult += "</errs></root>";
	return sResult;
}
