function isComboBoxRequired( obj, msg ){
	bReturn = true;
		
	// null for NetScape, "" for IE
	if (( obj.value == null ) || (obj.value == "")) {
		alert("Please select a " + msg + "."  );
		obj.focus();
		bReturn = false;
   } //end if
   return bReturn;
} //end checkComboBoxRequired()

function setObjFocus( obj ) {
	// set focus to the object (highlight exisiting text)
	if ( typeof( obj.select ) ) {
		obj.select();
	} // end if
	obj.focus();
	return;
} // end setObjFocus()

function isRequired( obj, msg ){
	bReturn = true;
	
	if ( obj.value.length == 0 ){
		alert( "Please enter " + msg )
		setObjFocus( obj );
		bReturn = false;
   } //end if
   return bReturn;
} //end checkRequired()

function isNumeric( obj, msg ){
	for ( x = 0; x < obj.value.length; x++ ){
		if ( ( obj.value.charAt(x) != "1" ) & 
	  		( obj.value.charAt(x) != "2" ) &
			( obj.value.charAt(x) != "3" ) &
			( obj.value.charAt(x) != "4" ) &
			( obj.value.charAt(x) != "5" ) &
			( obj.value.charAt(x) != "6" ) &
			( obj.value.charAt(x) != "7" ) &
			( obj.value.charAt(x) != "8" ) &
			( obj.value.charAt(x) != "9" ) &
			( obj.value.charAt(x) != "0" ) ) {
			alert("Please enter only numeric characters for the " + msg + ".");
			setObjFocus( obj );
			return false;
      } //end else
   } //end for
   return true;
} //end checkNum

function isAlpha( obj, msg ){
	for ( x = 0; x < obj.value.length; x++ ) {
		for ( i = 0; i <= 10; i++ ){
			if ( obj.value.charAt(x) == i ) {
				if ( obj.value.charAt(x) != " " ) {
					alert("Please enter only alpha characters for the " + msg + ".");
					setObjFocus( obj );
					return false;
				} //end inner if
			} // end if
		} //end inner for
	} //end for
	return true;
} //end checkAlpha

function checkSize( obj, size, msg, on ) {
	if ( ( obj.value.length != size ) && ( obj.value.length != 0 ) ){
		if ( on ) {
			alert ( "Please enter a " + size + " digit " + msg + ".");
		}
		else {
			alert ( "Please enter the complete " + msg + ".");
		}
		setObjFocus( obj );
		return false;
	} //end if 
	return true;
} //end checkSize

function checkEmail ( obj ) {
	var emailPat=/^(.+)@(.+)$/
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars="\[^\\s" + specialChars + "\]"
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom=validChars + "+"
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
	var matchArray= obj.value.match(emailPat)

	if ( obj.value != ""){
		if (matchArray==null) {
			alert("Please check the format of your e-mail address.  It must contain a @ and a '.' (dot).")
			setObjFocus( obj );
			return false;
		} //end if
		var user=matchArray[1]
		var domain=matchArray[2]
		// Verify "user" is valid 
		if (user.match(userPat)==null) {
			// user is not valid
			alert("Please check the username in your e-mail address.")
			setObjFocus( obj );
			return false;
		} //end if
		// Verify IP address
		var IPArray=domain.match(ipDomainPat)
		if (IPArray!=null) {
			// this is an IP address
			for (var i=1;i<=4;i++) {
				if (IPArray[i]>255) {
					alert("Please check the Destination IP address in your e-mail address.")
					setObjFocus( obj );
					return false;
				} // end if
			} // end for
			return true
		} // end if
		// Verify symbolic name
		var domainArray=domain.match(domainPat)
		if (domainArray==null) {
			alert("Please check the e-mail address.")
			setObjFocus( obj );
			return false;
		} // end if 
		// verify domain
		var atomPat=new RegExp(atom,"g")
		var domArr=domain.match(atomPat)
		var len=domArr.length
		if (domArr[domArr.length-1].length<2 || 
			domArr[domArr.length-1].length>3) {
			alert("Please make sure your e-mail address ends in a three-letter domain, or two letter country.")
			setObjFocus( obj );
			return false;
		} //end if
		// Verify host name precedes the domain.
		if (len<2) {
			var errStr="Please check the hostname in your e-mail address."
			alert(errStr)
			setObjFocus( obj );
			return false;
		} //end if
	} //end if
	return true;
} //end checkEmail
