// take the value of one select list and populate another with new values
// source is the source array to build the new list with
// target is the select list that will change
// val is the member of source that will be iterated to form new dropdown options
function change_other_dropdown(val,target,source)
{
	if(source[val])
	{
		var loc = source[val];
		var tgt = $(target);

		// get the currently selected value of dropdown 2 so we can try to maintain the state
		var selected = tgt.value;

		// clear out the current target dropdown
		while(tgt.options.length > 0) { tgt.options[tgt.options.length-1] = null; }

		// populate the new list
		var a = 0;
		for (var i in loc)
		{
			select = (i == selected ? true : false);
			tgt.options[a++] = new Option(loc[i],i,select);
		}
	}
}
