function checkTextField(objFormTextField, strNameOfField)
{
	var theObject = objFormTextField;
	if (isEmpty(theObject.value)) {
		if (elementFocusCheck(theObject, 'free')) {
			verifyMessage('', 'noblank', strNameOfField);
			return false;
		}//if
	}
	return true;
}// function - checkTextField
		
function elementFocusCheck(objElement, strType)
{
	return elementFocus(objElement, strType);
}//function - elementFocusCheck

function elementFocus(objElement, strType)
{
	if (objElement) {
		objElement.focus();
		return true;
	} else {
		return false;
	}//if
}//function - elementFocus

function checkEmailSyntax(objFormTextField, strNameOfField)
{
	var emailAddress = objFormTextField.value.replace(/\-/gi,"");
	//emailAddress = objFormTextField.value;
	// checks for email syntax
	var email_syntax = /(\w+)@(\w+)[.](\w+)/
	if (!email_syntax.test(emailAddress)) {
		if (elementFocusCheck(objFormTextField, 'email')) {
			verifyMessage('', 'notValid', strNameOfField);
			return false;
		}//if
	}//if
	
	// checks for invalid characters
	//var invalid_char = " :,;`~!#$%^*()+={}[]/\<>?"; --commented to allow "/" in email - 20/10/2006
	var invalid_char = " :,;`~!#$%^*()+={}[]\<>?"; 
	var bad_char = "";
	
	for (i = 0; i < invalid_char.length; i++) {
		bad_char = invalid_char.charAt(i);
		if (emailAddress.indexOf(bad_char, 0) > -1) {
			if (elementFocusCheck(objFormTextField, 'email')) {
				verifyMessage('', 'notValid', strNameOfField);
				return false;
			}//if
		}//if
	}//for
	return true;
}// function - checkEmailSyntax

function checkNumCurrField(theObject)
{
	var bolOK = true;
	var intNumDollar = 0;
	for (var i = 0; i < theObject.value.length; i++) {
	    var c = theObject.value.charAt(i);
		c = escape(c);
		//dollar %24
		//pound %A3
		//yen %A5
		//euro %u20AC
		if ((c == '%24') || (c == '%A3') || (c == '%A5') || (c == '%u20AC')) {
			intNumDollar += 1;
		} else if (c == escape(',')) {
			if (theObject.value.length == 1) bolOK = false;
		} else {
			if (isNaN(c) == true)
				bolOK = false;
		}// if
		if (intNumDollar > 1) bolOK = false;
		if (!bolOK) break;
	}// for
	if ((bolOK == false) || (isEmpty(theObject.value))) {
		if (elementFocusCheck(theObject, 'currency')) { 
			verifyMessage('', 'notValidNumber', '');
			return false;
		}//if
	} // if
}// function - checkNumCurrField

function verifyField(strWhere, strFormName, strElementName, strDisplayName, strType, blnRequired)
{
	blnRequired = blnRequired.toLowerCase();
	objElement = eval('document.'+ strFormName +'.'+ strElementName);
	if (objElement) {
		if (strType == 'checkbox') {
			var bolChecked = false;
			var intElementLength;
			var objElementItem;
			if (strWhere == 'client') { intElementLength = parseInt(objElement.value) + 1; }
			else { intElementLength = objElement.length; }
			for (var j=0; j<intElementLength; j++) {
				if (strWhere == 'client') { objElementItem = document.getElementById(strElementName +'_'+ j); }
				else { objElementItem = objElement[j]; }
				if (objElementItem) {
					if (objElementItem.checked == true)  {
						bolChecked = true;
						break;
					}// if  
				} else {
					break;
				}//if
			}// for
			if (blnRequired == 'true' && !bolChecked) {
				if (strWhere == 'client') { objElementItem = document.getElementById(strElementName +'_0'); }
				else { objElementItem = objElement[0]; }
				if (elementFocusCheck(objElementItem, strType)) {
					verifyMessage(strWhere, 'noblank', strDisplayName);
					return false;
				}//if
			}// if
			return true;
		} else if (strType == 'radio') {
			var bolChecked = false;
			var intElementLength = objElement.length;
			if (intElementLength == null || intElementLength == undefined) {
				if (objElement.checked == true)
					bolChecked = true;
				else
					bolChecked = false;
			} else {
				for (var j=0; j<=intElementLength-1; j++) {
					if (objElement[j]) {
						if (objElement[j].checked == true)  {
							bolChecked = true;
							break;
						}// if  
					} else {
						break;
					}//if
				}// for
				objElement = objElement[0];
			}//if
			if (blnRequired == 'true' && !bolChecked) {
				if (elementFocusCheck(objElement, strType)) {
					verifyMessage(strWhere, 'noblank', strDisplayName);
					return false;
				}//if
			}// if
			return true;
		} else if (strType == 'select') {
			if (blnRequired == 'true') {
				if (objElement.options[objElement.selectedIndex].value == -1 || objElement.options[objElement.selectedIndex].value == '-1') {
					if (elementFocusCheck(objElement, strType)) {
						verifyMessage(strWhere, 'noblank', strDisplayName);
						return false;
					}//if
				}//if
			}// if
			return true;
		} else if (strType == 'date') {
			var strElementValue = objElement.value.replace(' ','');
			if (strElementValue == '' || strElementValue == null || strElementValue == '//') {
				if (blnRequired == 'true') {
					if (elementFocusCheck(objElement, strType)) {
						verifyMessage(strWhere, 'noblank', strDisplayName);
						return false;
					}//if
				} //if
			} else {
				if (!chkdate(strElementValue)) {
					if (elementFocusCheck(objElement, strType)) {
						verifyMessage(strWhere, 'notValidDate', strDisplayName);
						return false; 
					}//if
				}// if
			}// if
			return true;
		} else if (strType == 'free') {
			if (blnRequired == 'true') {
				if (objElement.value == '' || objElement.value == null || objElement.value == ' ' || objElement.value == '  ') {
					if (elementFocusCheck(objElement, strType)) {
						verifyMessage(strWhere, 'noblank', strDisplayName);
						return false;
					}//if
				}// if
			}// if
			return true;
		} else if (strType == 'file') {
			if (blnRequired == 'true') {
				var blnFocusCheck = true;
				if (objElement.value == '' || objElement.value == null || objElement.value == undefined || objElement.value == '-1') {
					blnFocusCheck = true;
				} else {
					blnFocusCheck = false;
				}// if
				if (blnFocusCheck == true && strWhere == 'client') {
					var objElementSpan = document.getElementById('file_span'+ objElement.id.replace(/property/g,''));
					if (objElementSpan) {
						if (objElementSpan.innerHTML == '') {
							blnFocusCheck = true;
						} else {
							blnFocusCheck = false;
						}// if
					}// if
				}// if
				if (blnFocusCheck) {
					if (elementFocusCheck(objElement, strType)) {
						verifyMessage(strWhere, 'noblank', strDisplayName);
						return false;
					}//if
				}//if
			}// if
			return true;
		} else if (strType == 'number' || strType == 'auto') {
			if (!isNumeric(objElement.value) && objElement.value != '' && objElement.value != null) {
				if (elementFocusCheck(objElement, strType)) {
					verifyMessage(strWhere, 'notValidNumber', strDisplayName);
					return false;
				}//if
			}//if
			if (blnRequired == 'true') {
				if (objElement.value == '' || objElement.value == null) {
					if (elementFocusCheck(objElement, strType)) {
						verifyMessage(strWhere, 'noblank', strDisplayName);
						return false;
					}//if
				}//if
			}//if
			return true;
		} else if (strType == 'pref') {
			return verifyPreference(strFormName);
		}// if - strType
	}// if
}// function - verifyField