<!--
	// this will give mouse focus to the first text or pword field 
	function findFocus(Frm) {
		var ctrl
		for (var i = 0; i < Frm.elements.length; i++) {
			ctrl = Frm.elements[i]
			if (ctrl.type == "text" || ctrl.type == "password") {
				giveFocus(ctrl)
				return
			}
		}
	}
	
	// check if field is empty
	function isEmpty(inputStr) {
		return (inputStr == null || inputStr == "" )
	}
	
	// check if value is pos integer
	function isPosInteger(inputVal) {
		var inputStr = inputVal.toString()
		for (var i = 0; i < inputStr.length; i++) {
			var oneChar = inputStr.charAt(i)
			if (oneChar < "0" || oneChar > "9") {
				return false
			}
		}
		return true
	}
	
	// check if string is alphanumeric
	function isAlphanumeric(inputVal) {
		var inputStr = inputVal.toString()
		for (var i = 0; i < inputStr.length; i++) {
			var oneChar = inputStr.charAt(i)
			if ((oneChar < "0" || oneChar > "9") && 
				(oneChar < "a" || oneChar > "z") && 
				(oneChar < "A" || oneChar > "Z")) return false
		}
		return true
	}
	
	// check if string has illegal chars
	function hasIllegalChars(inputVal) {
		var inputStr = inputVal.toString()
		for (var i = 0; i < inputStr.length; i++) {
			var oneChar = inputStr.charAt(i)
			switch (oneChar) {
				case "'":
				case '"':
					return true
					break
			}
		}
		return false
	}
	
	// give alert if illegal chars
	function validateField(Fld) {
		if (hasIllegalChars(Fld.value)) {
			alert ("Field contains illegal characters!")
			giveFocus(Fld)
			return false
		}
		return true
	}
	
	// give mouse focus to a form control
	function giveFocus(ctrl) {
		switch (ctrl.type) {
			case "text":
			case "password":
				ctrl.focus()
				break
		}
	}
	
	// make sure passwords match, are legal size, and don't contain illegal chars
	function validatePasswords(pword1, pword2){
		if (!isAlphanumeric(pword1.value)){
			alert("Password contains illegal characters!")
			giveFocus(pword1)
			return false
		}
		if(pword1.value.length < 3){
			alert("Password must be at least 3 characters.")
			giveFocus(pword1)
			return false
		}
		if (pword1.value != pword2.value){
			alert("Passwords do not match!")
			giveFocus(pword1)
			return false
		}
		return true
	}
	
	// find a string value in a select control and selects it
	function findSelection(sel, val){
		if(sel.type != "select-one") return
		for(var i = 0; i < sel.length; i++){
			if(sel[i].value == val){
				sel.selectedIndex = i
				return
			}
		}
	}
	
//-->

