<!--
	//Don't crimp my code, deadbeat
	
	function ExactMatch(rePatterns, sString)
	{
		var i;
		if (!rePatterns.length && rePatterns.test(sString))
			return true;

		for (var i = 0; i < rePatterns.length; i++)
			if (rePatterns[i].test(sString))
				return true;
		return false;
	}

	function BuildRegExps(array)
	{
		var retVal = new Array();

		retVal.length = array.length;
		for(var it = 0; it < array.length; it++)
		{
			retVal[it] = new RegExp();
			retVal[it].compile(array[it], "i");
		}
		return retVal;
	}

	function validateEntry(oCollection)
	{
		for (var i=0; i< oCollection.length; i++)
			if (oCollection.item(i).getAttribute("required") != '' && oCollection.item(i).getAttribute("required") != null)
				if (oCollection.item(i).value == '')
				{
					if (oCollection.item(i).getAttribute("friendly") != '' && oCollection.item(i).getAttribute("friendly") != null)
						window.alert(oCollection.item(i).getAttribute("friendly") + " is a required entry.");
					else
						window.alert("Field is a required entry.");

					oCollection.item(i).focus();
					return false;
				}
		return true;
	}

	function validateAllRequiredEntry(oCollection)
	{
		for (var i=0; i< oCollection.length; i++)
			if (oCollection.item(i).value == '')
				{
					if (oCollection.item(i).getAttribute("friendly") != '' && oCollection.item(i).getAttribute("friendly") != null)
						window.alert(oCollection.item(i).getAttribute("friendly") + " is a required entry.");
					else
						window.alert("Field is a required entry.");

					oCollection.item(i).focus();
					return false;
				}
		return true;		
	}
	
	function validateNumberFormat(oCollection)
	{
		var Re = "", Retval = "";
		//RE_NUMBER = new Array("[+-]?\\d+([.,]\\d+)?", "[+-]?[.,]\\d+","[+-]?\\d+[.,]");
		//RE_NUMBER = new Array("^[-+]?\\d+([.,]\\d+)?$");
		RE_NUMBER = new Array("^[+]?\\d+([.,]\\d+)?$");
		RE_INTEGER = new Array("^?\\d+(\\d+)?$");
		RE_ZIP = new Array("\\d{5}", "\\d{5}(\\.|[- ])?\\d{4}");
		RE_PHONE = new Array("\\d{3}(\\.|[- ])?\\d{3}(\\.|[- ])?\\d{4}", "\\(\\d{3}\\)(\\.|[- ])?\\d{3}(\\.|[- ])?\\d{4}");
		//RE_EMAIL = new Array("^\\[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\\.)+[a-zA-Z0-9.-]{2,4}$");
		RE_EMAIL = new Array("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$");
		RE_PERCENT = new Array("^\\d{0,2}(\\.\\d{1,4})? *%?$");

		for (var i=0; i< oCollection.length; i++)			
			if (oCollection.item(i).getAttribute("numberFormat") != '' && oCollection.item(i).getAttribute("numberFormat") != null)
				if (oCollection.item(i).value != '')
				{
					switch (oCollection.item(i).getAttribute("numberFormat").toLowerCase())
					{

						case "integer":
							Re = BuildRegExps(RE_INTEGER);
							if (!ExactMatch(Re, oCollection.item(i).value))
								Retval = "Invalid integer format.";
							break;

						case "number":
							Re = BuildRegExps(RE_NUMBER);
							if (!ExactMatch(Re, oCollection.item(i).value))
								//Retval = "Invalid number format.\nPlease enter in #,### or #### format\n(e.g 1,234 or 1234).";
							      Retval = "Enter only positive numbers.\n(Do not enter a comma(,) between numbers nor the percentage(%) sign.)\n(Do not enter letters in this box. For example: \"N/A\", \"unknown\", etc.)";		
							break;

						case "zip":
							Re = BuildRegExps(RE_ZIP);
							if (!ExactMatch(Re, oCollection.item(i).value))
								Retval = "Invalid zip format.";
							break;

						case "phone":
							Re = BuildRegExps(RE_PHONE);
							if (!ExactMatch(Re, oCollection.item(i).value))
								Retval = "Invalid phone number format.";
							break;

						case "email":
							Re = BuildRegExps(RE_EMAIL);
							if (!ExactMatch(Re, oCollection.item(i).value))
								Retval = "Invalid email format.";
							break;

						case "percent":
							Re = BuildRegExps(RE_PERCENT);
							if (!ExactMatch(Re, oCollection.item(i).value))
								Retval = "Invalid percent format.";
							break;

						default:
					}


					if (Retval.length>0)
					{
						window.alert(Retval);
						oCollection.item(i).focus();
						return false;
					}
				}
	}

	function validateFormEntry(oForm)
	{
		var oInput = oForm.getElementsByTagName("Input");
		var oTextArea = oForm.getElementsByTagName("TextArea");
		var oSelect = oForm.getElementsByTagName("Select");

		return validateEntry(oInput) && validateEntry(oTextArea) && validateEntry(oSelect);
	}

	function validateFormNumberFormat(oForm)
	{
		var oInput = oForm.getElementsByTagName("Input");
		var oTextArea = oForm.getElementsByTagName("TextArea");
		var oSelect = oForm.getElementsByTagName("Select");

		return validateNumberFormat(oInput) && validateNumberFormat(oTextArea) && validateNumberFormat(oSelect);
	}

	function validateAll(oForm)
	{
		return validateFormEntry(oForm) && validateFormNumberFormat(oForm);
	}
	
	function validateFormAllRequiredEntry(oForm)
	{
		var oInput = oForm.getElementsByTagName("Input");
		var oTextArea = oForm.getElementsByTagName("TextArea");
		var oSelect = oForm.getElementsByTagName("Select");
		
		return validateAllRequiredEntry(oInput) && validateAllRequiredEntry(oTextArea) && validateAllRequiredEntry(oSelect);		
	}

	function validateLen(obj, allowedLength) 
	{
		var currentLength = obj.value.length; 
		
		if (currentLength >= allowedLength)
			 return false;
	}
	
	function validateFormAllRequiredEntryFormat(oForm)
	{
		return validateFormAllRequiredEntry(oForm) && validateFormNumberFormat(oForm);

	}
	
	function updateMessage(field, lineCount, maxLimit)
	{
		if (field.value.length > maxLimit)
			field.value = field.value.substring(0, maxLimit);
		else
			document.getElementById(lineCount).innerHTML =maxLimit - field.value.length;
	}	
// -->