// *****************BEGIN GENERIC FUNCTIONS*******************************

/* ======================================================================
FUNCTION:  	IsAlpha
INPUT:		str (string) - the string to be tested
RETURN:  	true, if the string contains only alphabetic characters false, otherwise.
====================================================================== */
function IsAlpha( str ) {
	// Return immediately if an invalid value was passed in
	if (str+"" == "undefined" || str+"" == "null" || str+"" == "")	
		return false;

	var isValid = true;

	str += "";	// convert to a string for performing string comparisons.

	// Loop through string one character at time,  breaking out of for
	// loop when an non Alpha character is found.
  	for (i = 0; i < str.length; i++) {
		// Alpha must be between "A"-"Z", or "a"-"z"
		if ( !( ((str.charAt(i) >= "a") && (str.charAt(i) <= "z")) ||
      			((str.charAt(i) >= "A") && (str.charAt(i) <= "Z")) ) ) {
         				isValid = false;
         				break;
      			}
   } // end for loop
   
	return isValid;
}  // end IsAlpha 


/* ======================================================================
FUNCTION:	IsAlphaNum
INPUT:		str (string) - a string that will be tested to ensure that
    		each character is a digit or a letter.
RETURN:  	true, if all characters in the string are a character from 0-9
     		or a-z or A-Z;  
			false, otherwise
====================================================================== */
function checkDate(dVal) {
	//Check date is valid
		
	if (dVal.length == 0){
		return false; // cancel the submit
	}
	if (isNaN(Number(new Date(dVal)))){
		return false; // cancel the submit
	}
			
	return true; // dont cancel
}



/* ======================================================================
FUNCTION:	IsAlphaNum
INPUT:		str (string) - a string that will be tested to ensure that
			each character is a digit or a letter.
RETURN:  	true, if all characters in the string are a character from 0-9
			or a-z or A-Z; false, otherwise
====================================================================== */
function IsAlphaNum( str ) {
	// Return immediately if an invalid value was passed in
	if (str+"" == "undefined" || str+"" == "null" || str+"" == "")	
		return false;

	var isValid = true;
	
	// convert to a string for performing string comparisons.
   	str += "";	

	// Loop through length of string and test for any alpha numeric 
	// characters
   	for (i = 0; i < str.length; i++)
   	{
			// Alphanumeric must be between "0"-"9", "A"-"Z", or "a"-"z"
      	if (!(((str.charAt(i) >= "0") && (str.charAt(i) <= "9")) || 
      			((str.charAt(i) >= "a") && (str.charAt(i) <= "z")) ||
      			((str.charAt(i) >= "A") && (str.charAt(i) <= "Z"))))
			{
				isValid = false;
				break;
			}	
   	} // END for   
   
   	return isValid;
}  // end IsAlphaNum



/* ======================================================================
FUNCTION:	IsAlphaNumOrUnderscore
INPUT:		str (string) - the string to be tested
RETURN:  	true, if the string contains only alphanumeric characters or underscores.
			false, otherwise.
====================================================================== */
function IsAlphaNumOrUnderscore( str ) {
	// Return immediately if an invalid value was passed in
	if (str+"" == "undefined" || str+"" == "null" || str+"" == "")	
		return false;

	var isValid = true;

	str += "";	// convert to a string for performing string comparisons.
	// Loop through string one character at a time. If non-alpha numeric
	// is found then, break out of loop and return a false result

	for (i = 0; i < str.length; i++)
   	{
		// Alphanumeric must be between "0"-"9", "A"-"Z", or "a"-"z"
      		if ( !( ((str.charAt(i) >= "0") && (str.charAt(i) <= "9")) || 
      			((str.charAt(i) >= "a") && (str.charAt(i) <= "z")) ||
      			((str.charAt(i) >= "A") && (str.charAt(i) <= "Z")) ||
      			(str.charAt(i) == "_") ) )
      		{
   				isValid = false;
         		break;
      		}

	} // END for   
   
	return isValid;

}  // end IsAlphaNumOrUnderscore




/* ======================================================================
FUNCTION:  	IsInt
INPUT:  	numstr (string/number) 	 - the string that will be tested to ensure 
			that each character is a digit
			allowNegatives (boolean) - (optional) when true, allows numstr to be
			negative (contain a '-').  When false, any negative number or a string starting
			with a '-' will be considered invalid.
RETURN:  	true, if all characters in the string are a character from 0-9,
			regardless of value for allowNegatives
			true, if allowNegatives is true and the string starts with a '-', and all other
			characters are 0-9. false, otherwise.
====================================================================== */
function IsInt( numstr, allowNegatives ) {
	// Return immediately if an invalid value was passed in
	if (numstr+"" == "undefined" || numstr+"" == "null" || numstr+"" == "")	
		return false;

	// Default allowNegatives to true when undefined or null
	if (allowNegatives+"" == "undefined" || allowNegatives+"" == "null")	
		allowNegatives = true;

	var isValid = true;

	// convert to a string for performing string comparisons.
	numstr += "";	

	// Loop through string and test each character. If any
	// character is not a number, return a false result.
 	// Include special case for negative numbers (first char == '-').   
	for (i = 0; i < numstr.length; i++) {
    	if (!((numstr.charAt(i) >= "0") && (numstr.charAt(i) <= "9") || (numstr.charAt(i) == "-"))) {
       	isValid = false;
       	break;
		} else if ((numstr.charAt(i) == "-" && i != 0) || 
				(numstr.charAt(i) == "-" && !allowNegatives)) {
       	isValid = false;
       	break;
      }
         	         	       
   } // END for   
   
   	return isValid;
}  // end IsInt




/* ======================================================================
FUNCTION:	IsBlank
INPUT:		val - the value to be tested
RETURN:  	true, if the string is null, undefined or an empty string, ""
			false, otherwise.
CALLS:		IsNull(), IsUndef() which are defined elsewhere in the Script Library
====================================================================== */
function IsBlank( str ) {
	var isValid = false;

 	if ( IsNull(str) || IsUndef(str) || (str+"" == "") )
 		isValid = true;
		
	return isValid;
}  // end IsBlank




/* ======================================================================
FUNCTION:	IsNull
INPUT:		val - the value to be tested
RETURN:  	true, if the value is null;
      		false, otherwise.
====================================================================== */
function IsNull( val ) {
	var isValid = false;

 	if (val+"" == "null")
 		isValid = true;
		
	return isValid;
}  // end IsNull




/* ======================================================================
FUNCTION:  	IsNum
INPUT:  	numstr (string/number) - the string that will be tested to ensure 
      		that the value is a number (int or float)
RETURN:  	true, if all characters represent a valid integer or float
     		false, otherwise.
====================================================================== */
function IsNum( numstr ) {
	// Return immediately if an invalid value was passed in
	if (numstr+"" == "undefined" || numstr+"" == "null" || numstr+"" == "")	
		return false;

	var isValid = true;
	var decCount = 0;		// number of decimal points in the string

	// convert to a string for performing string comparisons.
	numstr += "";	

	// Loop through string and test each character. If any
	// character is not a number, return a false result.
 	// Include special cases for negative numbers (first char == '-')
	// and a single decimal point (any one char in string == '.').   
	for (i = 0; i < numstr.length; i++) {
		// track number of decimal points
		if (numstr.charAt(i) == ".")
			decCount++;

    	if (!((numstr.charAt(i) >= "0") && (numstr.charAt(i) <= "9") || 
				(numstr.charAt(i) == "-") || (numstr.charAt(i) == "."))) {
       	isValid = false;
       	break;
		} else if ((numstr.charAt(i) == "-" && i != 0) ||
				(numstr.charAt(i) == "." && numstr.length == 1) ||
			  (numstr.charAt(i) == "." && decCount > 1)) {
       	isValid = false;
       	break;
      }         	         	       
//if (!((numstr.charAt(i) >= "0") && (numstr.charAt(i) <= "9")) || 
   } // END for   
   
   	return isValid;
}  // end IsNum



/* ======================================================================
FUNCTION:  	IsMoney
INPUT:  	numstr (string/number) - the string that will be tested to ensure 
      		that the value is a number (int or float),
      		fldName - the name of the form field 
RETURN:  	true, if all characters represent a valid integer or float
     		false, otherwise.
====================================================================== */
function IsMoney( numstr, fldName ) {
	// Return immediately if an invalid value was passed in
	if (numstr+"" == "undefined" || numstr+"" == "null" || numstr+"" == "")	
		return false;
	
	var isValid = true;
	var decCount = 0;		// number of decimal points in the string

	// convert to a string for performing string comparisons.
	numstr += "";	

	// Loop through string and test each character. If any
	// character is not a number, return a false result.
 	// Include special cases for dollar sign (first char == '$'), comma (any char in string == ','),
	// and a single decimal point (any one char in string == '.').   
	for (i = 0; i < numstr.length; i++) {
		// track number of decimal points
		if (numstr.charAt(i) == ".")
			decCount++;

    	if (!((numstr.charAt(i) >= "0") && (numstr.charAt(i) <= "9") || (numstr.charAt(i) == ",") || 
				(numstr.charAt(i) == "$") || (numstr.charAt(i) == "."))) {
       	isValid = false;
       	break;
		} else if ((numstr.charAt(i) == "$" && i != 0) ||
				(numstr.charAt(i) == "." && numstr.length == 1) ||
				(numstr.charAt(i) == "," && numstr.length < 4) ||
				(numstr.charAt(i) == "." && decCount > 1)) {
       	isValid = false;
       	break;
      }         	         	       
//if (!((numstr.charAt(i) >= "0") && (numstr.charAt(i) <= "9")) || 
   } // END for   
   
  // alert ("isValid=" + isValid)
   if (isValid){
		var strRes = StripNonNumericMoney(numstr,fldName)
	//	alert ("strRes=" + strRes)
		if (strRes !=""){
		 	isValid = true;
		}else{
			isValid = false;
		}	
	}
	return isValid;
}  // end IsMoney



/* ======================================================================
FUNCTION:	IsUndef
INPUT:		val - the value to be tested
RETURN:  	true, if the value is undefined
      		false, otherwise.
====================================================================== */
function IsUndef( val ) {
	var isValid = false;

 	if (val+"" == "undefined")
 		isValid = true;
		
	return isValid;
}  // end IsUndef




/* ======================================================================
FUNCTION:  	ParseQueryString
INPUT:		searchstr - the querystring value to be returned
RETURN:  	the value of that querystring item, or "" if blank
====================================================================== */
function ParseQueryString(searchStr) 
{
	var tempStr = window.location.search;
	var startOfString = tempStr.indexOf(searchStr);
	var result = "";

	result = "";
	if (startOfString != -1) {
		var endOfString = tempStr.indexOf("&",startOfString+searchStr.length+1);
	
		if (endOfString != -1)  {               
			var result = tempStr.substring(startOfString+searchStr.length+1, endOfString);
		} else {
			var result = tempStr.substring(startOfString+searchStr.length+1, tempStr.length);
		}
	}
	return unescape(result);
}



/* ======================================================================
FUNCTION:  	StripNonNumeric
INPUT:    	str (string)
RETURN:  	true, if the string contains digits and dashes in the form 111-12-3456;
CALLS:		IsInt(), which is defined elsewhere in the Script Library
====================================================================== */
function StripNonNumeric( strN, fldName ) {
	// Return immediately if an invalid value was passed in
	if (strN+"" == "undefined" || strN+"" == "null" || strN+"" == "")	
		return "";
		
	strN += "";	// make sure it's a string
	var strD = strN;

	for (j = 0; j < strN.length; j++) {
		if (strD+"" == "" || strD.length == 0) return;
		
		// track number of decimal points
		if (strN.charAt(j) == " " || !IsNum(strN.charAt(j))) {
			strD = strN.substring(0,j) + strN.substring(j+1,strN.length);
			j-- ;
		}else{
			if (strN.charAt(j) == "-") strD = strN.substring(0,j) + strN.substring(j+1,strN.length);
			if (strN.charAt(j) == "(") strD = strN.substring(0,j) + strN.substring(j+1,strN.length);
			if (strN.charAt(j) == ")") strD = strN.substring(0,j) + strN.substring(j+1,strN.length);
			if (strN.charAt(j) == " ") strD = strN.substring(0,j) + strN.substring(j+1,strN.length);
		}
		strN = strD;
	}
	
	if (fldName != "") {
		var eStr = "document.forms[0]." + fldName + ".value='" + strD + "';";
		eval(eStr);
	}

// alert(strD);
 	return strD;
} // end StripNonNumeric

/* ======================================================================
FUNCTION:  	StripNonNumericMoney
INPUT:    	str (string)
RETURNS:  	if successful, will set form field to string of numbers
			(all characters stripped except decimal);
CALLS:		IsInt(), which is defined elsewhere in the Script Library
====================================================================== */
function StripNonNumericMoney( strN, fldName ) {
	// Return immediately if an invalid value was passed in
	if (strN+"" == "undefined" || strN+"" == "null" || strN+"" == "")	
		return "";
		
	strN += "";	// make sure it's a string
	var strD = strN;

	for (j = 0; j < strN.length; j++) {
		if (strD+"" == "" || strD.length == 0) return;
		
		// track number of decimal points
		
		if (!IsNum(strN.charAt(j))){
			if (strN.charAt(j)!= ".") {
				strD = strN.substring(0,j) + strN.substring(j+1,strN.length);
				j-- ;
			}
		}
		strN = strD;
	}
	
	if (fldName != "" && strD != "") {
		var eStr = "document.forms[0]." + fldName + ".value=" + strD + ";";
		eval(eStr);
	}

// alert(strD);
 	return strD;
} // end StripNonNumericMoney



// *****************END GENERIC FUNCTIONS*********************************





// *****************BEGIN SPECIAL FUNCTIONS*******************************

/* ======================================================================
FUNCTION:  	IsValidEmail
INPUT:    	str (string) - an e-mail address to be tested
RETURN:  	true, if the string contains a valid e-mail address which is a string
			plus an '@' character followed by another string containing at least 
			one '.' and ending in an alpha (non-punctuation) character.
			false, otherwise
CALLS:		IsBlank(), IsAlpha() which are defined elsewhere in the Script Library
====================================================================== */
function IsValidEmail( str ) {
	// Return immediately if an invalid value was passed in
	if (str+"" == "undefined" || str+"" == "null" || str+"" == "")	
		return false;

	var isValid = true;

	str += "";

	namestr = str.substring(0, str.indexOf("@"));  // everything before the '@'
	domainstr = str.substring(str.indexOf("@")+1, str.length); // everything after the '@'

	// Rules: namestr cannot be empty, or that would indicate no characters before the '@',
	// domainstr must contain a period that is not the first character (i.e. right after
	// the '@').  The last character must be an alpha.
   	if (IsBlank(str) || (namestr.length == 0) || 
			(domainstr.indexOf(".") <= 0) ||
			(domainstr.indexOf("@") != -1) ||
			!IsAlpha(str.charAt(str.length-1)))
		isValid = false;
   
   	return isValid;
} // end IsValidEmail



/* ======================================================================
FUNCTION:  	IsValidPhone
INPUT:    	str (string) - an phone number to be tested
			incAreaCode (boolean) - if true, area code is included (10-digits);
			if false or undefined, area code not included
RETURN:  	true, if the string contains a 7-digit phone number and incAreaCode == false
			or is undefined 
			true, if the string contains a 10-digit phone number and incAreaCode == true
			false, otherwise
CALLS:		StripNonNumeric(), which is defined elsewhere in the Script Library
====================================================================== */
function IsValidPhone(str, fldName, incAreaCode) {
	// Return immediately if an invalid value was passed in
	if (str+"" == "undefined" || str+"" == "null" || str+"" == "")	
		return false;

	// Set default value for incAreaCode to true, if undefined or null
	if (incAreaCode+"" == "undefined" || incAreaCode+"" == "null")	
		incAreaCode = true;

	var isValid = true;

	str += "";

	// After stripping out non-numeric characters, such as dashes, the
	// phone number should contain 7 digits (no area code) or 10 digits (area code)
	str = StripNonNumeric(str+"", fldName);

	if (str.length != 10) isValid = false;
	
   	return isValid;
} // end IsValidPhone


/* ======================================================================
FUNCTION:  	IsValidCCNum
			This function tests a credit card number with a LUHN-10 algorithm
			to validate - it works for MasterCard, Visa, AMEX, Diners Club,
			Discover, EnRoute, and JCB
INPUT:		ccVal - the credit card number
RETURN:  	true or false
====================================================================== */
function IsValidCCNum(ccVal)
{
  var checkOK = "0123456789";
  var checkStr = ccVal;
  var CrValid = true;
  var checksum=0;
  var ddigit=0;
  var kdig = 0;
  if (checkStr.length < 13) alert ('You have not entered enough digits. Please check the number for errors.');
  for (i = checkStr.length-1;  i >= 0;  i--)
  {
    kdig++;
    ch = checkStr.charAt(i);
    if ((kdig % 2) != 0)
       checksum=checksum+parseInt(ch)
    else {
       ddigit=parseInt(ch)*2;
       if (ddigit >= 10)
          checksum=checksum+1+(ddigit-10)
       else
          checksum=checksum+ddigit;
    }
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      return(false);
    }
  }
  if ((checksum % 10) != 0){
       return (false);
  }else{
       return(true);
  }
}



/* ======================================================================
FUNCTION:  	IsValid5DigitZip
INPUT:    	str (string) - a 5-digit zip code to be tested
RETURN:  	true, if the string is 5-digits long
			false, otherwise
CALLS:		IsBlank(), IsInt() which are defined elsewhere in the Script Library
====================================================================== */
function IsValid5DigitZip( str ) {
	// Return immediately if an invalid value was passed in
	if (str+"" == "undefined" || str+"" == "null" || str+"" == "")	
		return false;
	
	var isValid = true;

	str += "";

	// Rules: zipstr must be 5 characters long, and can only contain numbers from
   // 0 through 9
   if (IsBlank(str) || (str.length != 5) || !IsInt(str, false))
		isValid = false;
   
   return isValid;
} // end IsValid5DigitZip




/* ======================================================================
FUNCTION:  	IsValid5Plus4DigitZip
INPUT:    	str (string) - a 5+4 digit zip code to be tested
RETURN:  	true, if the string contains 5-digits followed by a dash followed by 4 digits
			false, otherwise
CALLS:		IsBlank(), IsInt() which are defined elsewhere in the Script Library
====================================================================== */
function IsValid5Plus4DigitZip( str ) {
	// Return immediately if an invalid value was passed in
	if (str+"" == "undefined" || str+"" == "null" || str+"" == "")	
		return false;

	var isValid = true;

	str += "";

	// Rules: The first five characters may contain only digits 0-9,
	// the 6th character must be a dash, '-', and 
	// the last four characters may contain only digits 0-9.
	// The total string length must be 10 characters.
   	if (IsBlank(str) || (str.length != 10) || 
			!IsInt(str.substring(0,5), false) || str.charAt(5) != '-' ||
			!IsInt(str.substring(6,10), false))
		isValid = false;
   
   	return isValid;
} // end IsValid5Plus4DigitZip




/* ======================================================================
FUNCTION:  	IsValidSSN
INPUT:    	str (string) - an phone number to be tested
			incDashes (boolean) - if true, str includes dashes (e.g. 111-12-3456);
			if false, str contains only digits
RETURN:  	true, if the string contains digits and dashes in the form 111-12-3456;
			true, if the string contains a 9-digit number and incDashes is false;
			false, otherwise
CALLS:		IsInt(), which is defined elsewhere in the Script Library
====================================================================== */
function IsValidSSN( str, incDashes ) {
	// Return immediately if an invalid value was passed in
	if (str+"" == "undefined" || str+"" == "null" || str+"" == "")	
		return false;

	var isValid = true;

	// Set default value for incDashes to true, if undefined or null
	if (incDashes+"" == "undefined" || incDashes+"" == "null")	
		incDashes = true;

	str += "";	// make sure it's a string

	if (!incDashes && (!IsNum(str) || str.length != 9))
		isValid = false;

	var part1 = str.substring(0,3);
	var part2 = str.substring(4,6);
	var part3 = str.substring(7,str.length);

	// Ensure that the first part is a number and 3 digits long,
	// the second part is a number and 2 digits long,
	// the third part is a number and 4 digits long, e.g. 111-22-3333
	if (incDashes && ((!IsInt(part1, false) || part1.length != 3) ||
			(!IsInt(part2, false) || part2.length != 2) || 
			(!IsInt(part3, false) || part3.length != 4)) )
		isValid = false;

   	return isValid;
} // end IsValidSSN


/* ======================================================================
FUNCTION:  	IsValidDate
INPUT:    	str (string) - a date string to be tested 
			Accepts dashes or forwardslashes as separators
RETURNS:  	true, if the string is a valid date;
			false, otherwise
CALLS:		LeapYear(), which is defined below
====================================================================== */
function IsValidDate(str) {

// Return immediately if an invalid value was passed in
	if (str+"" == "undefined" || str+"" == "null" || str+"" == "")	
		return false;
	
	if (str.length < 6)
		return false;
		
var strDatestyle = "US"; //United States date style
//var strDatestyle = "EU";  //European date style
var strDate = str;
var strDateArray;
var strDay;
var strMonth;
var strYear;
var intday;
var intMonth;
var intYear;
var booFound = false;
var strSeparatorArray = new Array("-","/");
var intElementNr;
var err = 0;
var strMonthArray = new Array(12);
strMonthArray[0] = "Jan";
strMonthArray[1] = "Feb";
strMonthArray[2] = "Mar";
strMonthArray[3] = "Apr";
strMonthArray[4] = "May";
strMonthArray[5] = "Jun";
strMonthArray[6] = "Jul";
strMonthArray[7] = "Aug";
strMonthArray[8] = "Sep";
strMonthArray[9] = "Oct";
strMonthArray[10] = "Nov";
strMonthArray[11] = "Dec";
if (strDate.length < 1) {
return true;
}
for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
strDateArray = strDate.split(strSeparatorArray[intElementNr]);
if (strDateArray.length != 3) {
err = 1;
return false;
}
else {
strDay = strDateArray[0];
strMonth = strDateArray[1];
strYear = strDateArray[2];
}
booFound = true;
   }
}
if (booFound == false) {
if (strDate.length>5) {
strDay = strDate.substr(0, 2);
strMonth = strDate.substr(2, 2);
strYear = strDate.substr(4);
   }
}
if (strYear.length == 2) {
strYear = '20' + strYear;
}
// US style
if (strDatestyle == "US") {
strTemp = strDay;
strDay = strMonth;
strMonth = strTemp;
}
intday = parseInt(strDay, 10);
if (isNaN(intday)) {
err = 2;
return false;
}
intMonth = parseInt(strMonth, 10);
if (isNaN(intMonth)) {
for (i = 0;i<12;i++) {
if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
intMonth = i+1;
strMonth = strMonthArray[i];
i = 12;
   }
}
if (isNaN(intMonth)) {
err = 3;
return false;
   }
}
intYear = parseInt(strYear, 10);
if (isNaN(intYear)) {
err = 4;
return false;
}
if (intMonth>12 || intMonth<1) {
err = 5;
return false;
}
if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
err = 6;
return false;
}
if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
err = 7;
return false;
}
if (intMonth == 2) {
if (intday < 1) {
err = 8;
return false;
}
if (LeapYear(intYear) == true) {
if (intday > 29) {
err = 9;
return false;
}
}
else {
if (intday > 28) {
err = 10;
return false;
}
}
}
return true;
}
function LeapYear(intYear) {
if (intYear % 100 == 0) {
if (intYear % 400 == 0) { return true; }
}
else {
if ((intYear % 4) == 0) { return true; }
}
return false;
}

// *****************END SPECIAL FUNCTIONS*********************************




// *****************BEGIN CUSTOM FUNCTIONS********************************

/* ======================================================================
FUNCTION:  	testRadio
INPUT:    	radioFld - the field name of the radio button to test
RETURN:  	the value of the radio field's selected item. If none selected,
			then it returns "" (empty string). 
CALLS:		Nothing
====================================================================== */
	function testRadio(radioFld){
		var fReturn = "";
		for (var i=0; i < radioFld.length; i ++){
			if (radioFld[i].checked) fReturn = radioFld[i].value;
		}
		return fReturn;
	}

	
/* ======================================================================
FUNCTION:  	testCheckbox
INPUT:    	ckFld - the field name of the checkbox to test
RETURN:  	the value of the checkbox's selected item(s). If none selected,
			then it returns "" (empty string). 
CALLS:		Nothing
====================================================================== */
	function testCheckbox(ckFld){
		var fReturn = "";
		for (var i=0; i < ckFld.length; i ++){
			if (ckFld[i].checked) fReturn = fReturn + ckFld[i].value + ",";
		}
		return fReturn;
	}

// *****************END CUSTOM FUNCTIONS**********************************
