<!--

function ValidListName(name) {
	if ( (name != "") && (name[0] != " ") ) {
		return 1;
	}
	return 0;
}

function AnyCheckBoxesTagged(CheckBox) {
	return AnyRadioTagged(CheckBox);
}


function AnyRadioTagged(Radio) {
	var i;
	var count = 0;

	if ( !Radio ) {
		return false;
	}

	if ( !Radio.length && Radio.value && Radio.checked ) {
		return true;
	}

	for (i = 0; i < Radio.length; i++) {
		if ( Radio[i].checked ) {
			count++;
		}
	}
	return count;
}

// THIS function just returns the value attributes of all the
// checkboxes, whether they're checked or not.
function GetAllCheckBoxValues(CheckBoxes) {

	var the_list = new Array();

	if ( ! CheckBoxes.length ) {
		the_list[0] = CheckBoxes.value;
	}
	else {
		for (var i = 0; i < CheckBoxes.length; i++) {
			// this (push) isnt supported by older browsers
			//		the_list.push(CheckBoxes[i].value);
			the_list[i] = CheckBoxes[i].value;
		}
	}

	return the_list;
}


function GetAllCheckBoxesChecked(CheckBoxes) {

	var checked_list = new Array();

	if ( ! CheckBoxes.length ) {
		if ( CheckBoxes.checked ) {
			checked_list[0] = CheckBoxes.value;
		}
	}
	else {
		// this was the whole function (except the var checked_list = new Array();
		var j = 0;
		for (var i = 0; i < CheckBoxes.length; i++) {
			if ( CheckBoxes[i].checked ) {
				// this (push) isnt supported by older browsers
				// checked_list.push(CheckBoxes[i].value);

//				checked_list[i] = CheckBoxes[i].value;

// changed 8-22-2003 - to avoid undef elements in the middle
				checked_list[j] = CheckBoxes[i].value;
				j++;
			}
		}
	}

	return checked_list;
}

function BlankOutAllCheckBoxes(CheckBoxes) {

	if( ! CheckBoxes.length ) {
		CheckBoxes.checked = 0;
	}
	else {
		// this was the whole function
		for (var i = 0; i < CheckBoxes.length; i++) {
			CheckBoxes[i].checked = 0;
		}
	}
}

function SetAllCheckBoxes(CheckBoxes) {

	if ( ! CheckBoxes.length ) {
		CheckBoxes.checked = 1;
	}
	else {
		for (var i = 0; i < CheckBoxes.length; i++) {
			CheckBoxes[i].checked = 1;
		}
	}
}


function SetCheckBoxes(CheckBoxes, Values) {
	var num_values = 0;
	var value_array;
	var i;

	for (i = 0; i < Values.length; i++) {
		if ( Values.charAt(i) == "," ) {
			num_values++;
		}
	}
	if ( Values.length != 0 ) {
		num_values++;
	} 

	value_array = new Array(num_values);
	value_array = Values.split(",");

	for (i = 0; i < CheckBoxes.length; i++) {
		if ( IsValueInArray(value_array, CheckBoxes[i].value) ) {
			CheckBoxes[i].checked = true;
		}
		else {
			CheckBoxes[i].checked = false;
		}
	}
}

function IsValueInArray(Array, Value) { 
	var i;

	for (i = 0; i < Array.length; i++) {
		if ( Array[i] == Value ) {
			return true;
		}
	}
	return false;
}

function isAnInteger(value) {

	for (var i = 0; i < value.length; i++) {
		if ( ! parseInt(value.charAt(i)) ) {
			if ( value.charAt(i) != '0' ) {
				return 0;
			}
		}
	}

	return 1;
}


function RemoveAllSelectOptions(selector) {

	if ( ! selector ) {
		return;
	}
	if ( ! selector.options ) {
		return;
	}

	for (var x = selector.options.length - 1; x >= 0; x--) {
		selector.options[x] = null;
	}
}


function AnySelectElementsSelected(Selection) {

	var index = Selection.selectedIndex;

	if ( index == -1 ) {
		return 0;
	}
	else if ( Selection.options[index].value == "" ) {
		return 0;
	}
	return 1;
}

function Sectioned_Select_Check(selection) {

	var index = selection.selectedIndex;

	if ( selection.options[index].value == -1 ) {
		alert("Headings are invalid selections");
		selection.selectedIndex = -1;
	}
}

function GetSelectedOptionsByValue(Selection) {

	var selected = new Array();
	var	size = Selection.options.length - 1;
	var	num_selected = 0;

	for (var i = 0; i <= size; i++) {
		if ( Selection.options[i].selected ) {
			num_selected++;
			selected[num_selected] = i;
		}
	}
	selected[0] = num_selected;

	return selected;
}


function ClearSelectElement(Selection) {

	if ( Selection.options[0].value == "" ) {
		Selection.selectedIndex = 0;
	}
	else {
		Selection.selectedIndex = -1;
	}
}

function SetCheckBoxes(CheckBoxes, Values) {

	CheckBoxes.Checked = true;
}


// the following are moved from search_check.js 3-24-2003

function ZipCodeJumpHandler(ThisForm, from_field, to_field) {

	if ( ThisForm.elements[from_field].value.length == 5 ) {
		ThisForm.elements[to_field].focus();
	}
}

function FieldJumpHandler(ThisForm, from_field, to_field, length) {

	if ( ThisForm.elements[from_field].value.length == length ) {
		ThisForm.elements[to_field].focus();
	}
}


/********************************************************************************

Function:		DateValidityCheck()
Description:	Checks date entry widgets to see if the proper parts are filled in.
				Specifically:
					if the day-of-month is filled in, the month must be filled.
					if the month if filled in, the year must be filled.

*** Not alerting here anymore, because there may be multiple alerts, so a complete
	search problem alert message is being put together higher up.

*** This may blow up for a quick search that doesnt contain the proper date fields!
		check it soon

********************************************************************************/
function DateValidityCheck(ThisForm, base_field) {

	var day_field = base_field + "__Day";
	var month_field = base_field + "__Month";
	var year_field = base_field + "__Year";

	if ( valued(ThisForm, day_field) && !valued(ThisForm, month_field) ) {
		return 0;
	}

	if ( valued(ThisForm, month_field) && !valued(ThisForm, year_field) ) {
		return 0;
	}

	return 1;
}


function valued(ThisForm, field) {

	var is_valid = 0;
	var element = ThisForm[field];

	// to eliminate the problem of spaces as valid values
	while ( element.value.substring(0,1) == " " ) {
		element.value = element.value.substring(1);
	}
	if ( element.value != "" ) {
		is_valid = 1;
	}
	return is_valid;
}

<!-- end of scripts -->

