/*
DESC: Javascript list handling routines
AUTH: RP
VERS: 1.0
DATE: 11 Oct 99

To use the functions provided in this file add the following
inside the <HEAD> section of your HTML page:

	<SCRIPT LANGUAGE="JavaScript" SRC="js/list.js"></SCRIPT>
*/

function selectListItem(lst, sValue)
	//selects the item on the list with value=sValue if it exists.
	{
		var i;
		i = getListItemIndex(lst, sValue);
		if (i > -1) 
			lst.selectedIndex = i;
	}

function getListItemIndex(lst, sValue)
	//returns the index of the item on the list with value=sValue
	{
	var i;
	
	for (i=0 ;i<lst.length; i++)
		if (lst.options[i].value == sValue) 
			return i;
	
	return -1;
	}

function getListSelection(lst)
	{
	if (lst.selectedIndex == -1)
		return -1;
	else
		return lst.options[lst.selectedIndex].value;
	}

function getListSelectionText(lst)
	{
	if (lst.selectedIndex == -1)
		return '';
	else
		return lst.options[lst.selectedIndex].text;
	}
