
// ***************************************************
// Set the option text & value to the same values in the given 2D array
function SetSelect (sel, selectData) {
	sel.length = selectData.length
	var index = 0
	for (var i in selectData) {
		sel.options[i].text = selectData[i]
		sel.options[i].value = selectData[i]
	}
	sel.selectedIndex = 0 // Set Selected To The First Item
}

// ***************************************************
// Set the option text & value to the different values in the given 2D array
function SetSelectTextValue (sel, selectData) {
	sel.length = selectData.length/2
	var index = 0
	for (i=0; i<(selectData.length/2); i++) {
		sel.options[i].text = selectData[i*2]
		sel.options[i].value = selectData[(i*2)+1]
	}
	sel.selectedIndex = 0 // Set Selected To The First Item
}

// ***************************************************
// Select the option with the given VALUE/TEXT
function SelectItem(sbox, item_type, item_text) {
	if (sbox!=null) {
		with (sbox) {
			if (item_type=='VALUE') {
				for (i=0; i<length; i++) {
					if (options[i].value==item_text) {selectedIndex=i; return;}
				}
			} else { // 'TEXT' presumably!
				for (i=0; i<length; i++) {
					if (options[i].text==item_text) {selectedIndex=i; return;}
				}
			}
		}
	}
}

// ***************************************************
// Returns the index of the option with the given VALUE/TEXT	
function IndexOfItem(sbox, item_type,item_text) {
	if (sbox!=null) {
		with (sbox) {
			if (item_type=='VALUE') {
				for (i=0; i<length; i++) {
					if (options[i].value==item_text) {return i}
				}
			} else { // 'TEXT' presumably!
				for (i=0; i<length; i++) {
					if (options[i].text==item_text) {return i}
				}
			}
		}
	}
	return -1
}

// ***************************************************
// Reject a selection if it's value matches reject_str
function CheckOption(SelectBox,reject_str) {
	if (SelectBox.options[SelectBox.selectedIndex].value==reject_str) {
		SelectBox.selectedIndex=-1;
	}
}

// ***************************************************
// Reject a selection if it's value matches reject_str
function RejectOption(SelectBox,reject_str) {
	if (SelectBox.options[SelectBox.selectedIndex].value==reject_str) {
		SelectBox.selectedIndex=-1;
	}
}