// JavaScript Document
/*
    Useful JavaScript functions that can be used to validate form information with ColdFusion.
		
		Author: Scott Jibben (scott@jibben.com)
		Create: 11/01/2005 3:35 AM
		Update: 

    NOTE: THIS NEEDS TO BE INCLUDED BETWEEN THE HEAD TAGS TO BE COMPATIBLE!
		
		example:
		<script language="JavaScript" src="FormExtUtils.js" type="text/javascript"></script>
		
*/		

// this function will verify that an item is selected in a list
function SingleSelectRequired(Form, Field) {
  var itemSelected = eval('document.' + Form + '.' + Field + '.selectedIndex');
  if (itemSelected == 0) {
    return false;
  }
  else {
    return true;
  }
}

// this function will verify that there is data in a text(area) field
function TextAreaRequired(Form, Field) {
  var nTALen = eval('document.' + Form + '.' + Field + '.value.length');
  if (nTALen <= 0) {
    return false;
  }
  return true;
}

// this function will verify that a text(area) does not exceed a specified length
function MaxTextAreaLen(Form, Field, MaxLength) {
  var nTALen = eval('document.' + Form + '.' + Field + '.value.length');
  if (nTALen > MaxLength) {
    return false;
  }
  return true;
}
