// $Id: select.js,v 1.1 2007/05/16 14:35:23 jsan Exp $

// fills a selection box with the contents of an listay
// selBox = the selection box object
// list = the 2 dimensional array of caption / value pairs
// selId = optional selected index, default = 0
function changeOptions(selBox, list, selId)
{
	// clear all options
	selBox.length = 0
	// default selection index
	if (!selId) selId = 0;
	
	// add all options
	for (var i=0; i < list.length; i++) {
		selBox.options[selBox.length] = new Option(list[i][0], list[i][1]);
	}

	// select an option
	selBox.selectedIndex = selId;
}


function clearSelection(selBox)
{
	selBox.length = 0;
	selBox.options[0] = new Option('','');
	selBox.selectedIndex = 0;
}
