<!--
function SetFocus (strControlID){
	document.getElementById(strControlID).focus();
}
function isLetter (c){   
	return ( ((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")) )
}
function isDate (c){   
	return ( ((c >= "0") && (c <= "9")) || (c == "/") || (c == "-") )
}
function isDigit (c){   
	return ( ((c >= "0") && (c <= "9")) || (c == ".") )
}
function isLetterOrDigit (c){   
	return (isLetter(c) || isDigit(c))
}

function Validate(){
	var blnValid = true
	
	// Loop through all the elements on the form (assumes one form per page), applying class-level validation
	
	for (ctr = 0; ctr < document.forms[0].elements.length; ctr++)
	{
		var strClassName
		var strElementName
		var strElementValue 
		var strLastInvalidLabel			// used when multiple input boxes share a single label (ie. phone #'s)
		var strElementLabel
		
		// Save the CLASS attribute of the current element
		strClassName = document.forms[0].elements[ctr].className;
		
		// Save the ID attribute of the current element
		strElementName = document.forms[0].elements[ctr].id;
		
		// Save the VALUE attribute of the current element
		strElementValue = document.forms[0].elements[ctr].value;
		
		// Get the length of the name/id of the current element
		var intNameLength = strElementName.length;
		
		// Replace the "txt" or "cbo" prefix with "lbl"
		strElementLabel = "lbl" + strElementName.substring(3,intNameLength);
		
		//strElementLabel = document.forms[0].elements[ctr].replace("txt", "lbl");
		//strElementLabel = strElementName.replace("txt", "lbl");
		//strElementLabel = strElementLabel.replace("cbo", "lbl");

		switch(strClassName)
		{
			case "InputBoxRequiredSmall":		
				if (strElementValue.length < 1 || strElementValue == "-99")
				{
					// Value was left empty or no selection in combo box was made
					blnValid = false;
					// Apply an invalid data class to the corresponding label
					document.getElementById(strElementLabel).className = "InvalidFormData";			
					break;
				}
				// If it gets here, the data must be valid
				document.getElementById(strElementLabel).className = "ValidFormData";
				break;									
		
			case "InputBoxRequired":		
				if (strElementValue.length < 1 || strElementValue == "-99")
				{
					// Value was left empty or no selection in combo box was made
					blnValid = false;
					// Apply an invalid data class to the corresponding label
					document.getElementById(strElementLabel).className = "InvalidFormData";			
					break;
				}
				// If it gets here, the data must be valid
				document.getElementById(strElementLabel).className = "ValidFormData";
				break;									

			case "InputBoxNumber":
				// Loop through each character in the value								
				for (intLetterCtr = 0; intLetterCtr < strElementValue.length; intLetterCtr++)
				{
					var c = strElementValue.charAt(intLetterCtr);
					if (!isDigit(c))
					{
						blnValid = false;
						// Apply an invalid data class to the corresponding label
						document.getElementById(strElementLabel).className = "InvalidFormData";	
						// Save the name of this label to prevent it from being changed back to valid
						strLastInvalidLabel = strElementLabel
						break;
					}
				}	
				// If it gets here, the data must be valid
				if (strElementLabel != strLastInvalidLabel)
					{
					document.getElementById(strElementLabel).className = "ValidFormData";
					}
				break;					
										
			case "InputBoxRequiredNumber":
				if (strElementValue.length < 1 || strElementValue == "-99")
				{
					// Value was left empty or no selection in combo box was made
					blnValid = false;
					// Apply an invalid data class to the corresponding label
					document.getElementById(strElementLabel).className = "InvalidFormData";	
					// Save the name of this label to prevent it from being changed back to valid
					strLastInvalidLabel = strElementLabel							
					break;
				}	
				// Loop through each character in the value				
				for (intLetterCtr = 0; intLetterCtr < strElementValue.length; intLetterCtr++)
				{			
					var c = strElementValue.charAt(intLetterCtr);
					if (!isDigit(c))
					{
						blnValid = false;
						// apply an invalid data class to the corresponding label
						document.getElementById(strElementLabel).className = "InvalidFormData";	
						// Save the name of this label to prevent it from being changed back to valid
						strLastInvalidLabel = strElementLabel								
						break;
					}	
				}	
				// If it gets here, the data must be valid
				if (strElementLabel != strLastInvalidLabel)
					{
					document.getElementById(strElementLabel).className = "ValidFormData";
					}
				break;		
			
			case "InputBoxEmail":
				if (strElementValue.length > 1 || strElementValue == "-99")
					if (strElementValue.indexOf("@") < 0 || strElementValue.indexOf(".") < 0)
					{
						// The value appears to be an invalid email address missing the "@" or "."
						blnValid = false;
						// Apply an invalid data class to the corresponding label
						document.getElementById(strElementLabel).className = "InvalidFormData";			
						break;
					}
				// If it gets here, the data must be valid
				document.getElementById(strElementLabel).className = "ValidFormData";
				break;
			
			case "InputBoxRequiredEmail":
				if (strElementValue.length < 1 || strElementValue == "-99")
				{
					// Value was left empty or no selection in combo box was made
					blnValid = false;
					// Apply an invalid data class to the corresponding label
					document.getElementById(strElementLabel).className = "InvalidFormData";			
					break;
				}	
				if (strElementValue.indexOf("@") < 0 || strElementValue.indexOf(".") < 0)
				{
					// The value appears to be an invalid email address missing the "@" or "."
					blnValid = false;
					// Apply an invalid data class to the corresponding label
					document.getElementById(strElementLabel).className = "InvalidFormData";			
					break;
				}				
				// If it gets here, the data must be valid
				document.getElementById(strElementLabel).className = "ValidFormData";
				break;		

			case "InputBoxDate":
				// Loop through each character in the value				
				for (intLetterCtr = 0; intLetterCtr < strElementValue.length; intLetterCtr++)
				{			
					var c = strElementValue.charAt(intLetterCtr);
					if (!isDate(c))
					{
						blnValid = false;
						// apply an invalid data class to the corresponding label
						document.getElementById(strElementLabel).className = "InvalidFormData";	
						break;
					}	
				}
				// If it gets here, the data must be valid
				if (strElementLabel != strLastInvalidLabel)
					{
					document.getElementById(strElementLabel).className = "ValidFormData";
					}
				break;		

			case "InputBoxRequiredDate":
				var now = new Date();
				var Today = (now.getMonth() + 1) + "/" + now.getDate() + "/" + now.getFullYear(); 	
								
				if (strElementValue.length < 1 )
				{
					// Value was left empty or no selection in combo box was made
					blnValid = false;
					// Apply an invalid data class to the corresponding label
					document.getElementById(strElementLabel).className = "InvalidFormData";	
					// Save the name of this label to prevent it from being changed back to valid
					strLastInvalidLabel = strElementLabel							
					break;
				}	
				// Loop through each character in the value				
				for (intLetterCtr = 0; intLetterCtr < strElementValue.length; intLetterCtr++)
				{			
					var c = strElementValue.charAt(intLetterCtr);
					if (!isDate(c))
					{
						blnValid = false;
						// apply an invalid data class to the corresponding label
						document.getElementById(strElementLabel).className = "InvalidFormData";	
						// Save the name of this label to prevent it from being changed back to valid
						strLastInvalidLabel = strElementLabel								
						break;
					}	
				}	
				// If it gets here, the data must be valid
				if (strElementLabel != strLastInvalidLabel)
					{
					document.getElementById(strElementLabel).className = "ValidFormData";
					}
				break;		
		}		
	}
	
	// If any data is invalid, display a message box
	if (blnValid == false)
	{
		alert("The identified fields contain invalid data.");
		return false;
	}		
}	
//-->
