
		/******************************************************************************/
		function fieldOff(element) {
			element.style.backgroundColor="#FFFFFF";
			element.style.color="#333333";
			element.style.fontWeight="normal"
		}
		// Text Input Field Normal
		function fieldOn(element) {
			element.style.backgroundColor="#fefee3";
			element.style.color="#003366";
			element.style.fontWeight="bold"
		}
		/******************************************************************************/
		function countPhoneChars(frmCtrl) {
			/* Removed special character allowance
			Allow any key press defined in the Array: arrKeyCodes
			for (var i=0; i < arrKeyCodes.length; i++) {
				if (event.keyCode == arrKeyCodes[i]) {
					return true;
				}
			}
			*/
			// Check to see if it's a number.
			if ( (event.keyCode > 47) && (event.keyCode < 58)) {
				var phoneLen = parseInt(frmCtrl.value.length);
				// Automatically put in a dash
				if (phoneLen < 12) {
					if ( (phoneLen == 3) || (phoneLen == 7) ) {
						frmCtrl.value = frmCtrl.value + "-";
					}
				}
				else {
					return false;
				}
			}
			else {
				return false;
			}
		}
		/******************************************************************************/
		function isFilled(elm)
		{
			if (elm.value == "" || elm.value == null)
			return false;
			else return true;
		}
		/******************************************************************************/
		/* focus function must precede "showmsg = true;" statement in each validation
		routine -- will set focus to first field with an error after user clicks "OK"
		on alert window */
		function setFocusOnError(elm, elmfocus, showmsg){
		    if (showmsg != true)    {
		        return elm;
		    }	else {
			    return elmfocus;
			}
		}
		/*******************************************************************************/
		function isEmailValid(elm)
		{
				var emailStr = elm.value;
		    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=emailStr.match(emailPat);
		    if (matchArray==null)
		    {
		        return false;
		    }
		    var user=matchArray[1];
		    var domain=matchArray[2];
		
		    if (user.match(userPat)==null)
		    {
		        return false;
		    }
		    var IPArray=domain.match(ipDomainPat);
		    if (IPArray!=null) {
		          for (var i=1;i<=4;i++)
		          {
		            if (IPArray[i]>255)
		            {
		            return false;
		            }
		        }
		        return true;
		    }
		    var domainArray=domain.match(domainPat)
		    if (domainArray==null)
		    {
		        return false;
		    }
		    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)
		    {
		       return false;
		    }
		    if (len<2)
		    {
		       return false;
		    }
		    return true;
		}
		/******************************************************************************/
		function checkform(theForm) {
			var showmsg = false;
			var msg = "Your form could not be submitted. Please correct the following errors:\n\n";
			var elmfocus = theForm;
			
//			if (!isFilled(theForm.tbLastName)) {
//				msg += "Please enter the Last name of the person writing the comment\n";
//				elmfocus = setFocusOnError(theForm.tbLastName, elmfocus, showmsg);	
//				showmsg = true;
//			}
//			if (!isFilled(theForm.tbFirstName)) {
//				msg += "Please enter the First name of the person writing the comment\n";
//				elmfocus = setFocusOnError(theForm.tbFirstName, elmfocus, showmsg);	
//				showmsg = true;
//			}
						
			
			if (showmsg == true) {
				alert(msg);
				elmfocus.focus();
				return false;
			} else if (showmsg == false) {
				return true;
			}
		
		}
		
		
		