function setDynaList(frm, cbx1, cbx2, arr){
	var oList1 	= document.forms[frm].elements[cbx1];
	var oList2 	= document.forms[frm].elements[cbx2];
	
	clearDynaList(oList2);
	
	if (oList1.selectedIndex == -1){
		oList1.selectedIndex = 0;
	}
	
	populateDynaList(oList2, oList1[oList1.selectedIndex].value, arr);
	return true;
}
 
function clearDynaList(oList){
	for (var i = oList.options.length; i >= 0; i--){
		oList.options[i] = null;
	}	
	oList.selectedIndex = -1;
}

function populateDynaList(oList, nIndex, aArray){
	//oList[oList.length]= new Option("[ SELECT ARRIVAL CITY ]");
	for (var i = 0; i < aArray.length; i= i + 3){
		if (aArray[i] == nIndex){
			oList.options[oList.options.length] = new Option(aArray[i + 1], aArray[i + 2]);
		}
	}
	oList.selectedIndex = 0;
}

function setDefaList(sList, sDefault){
	_List = document.getElementById(sList);
	var found = false;
	for (var i = 0; ((i < _List.options.length) && (!found)) ; i++){
		if (_List.options[i].value == sDefault){
			_List.options[i].setAttribute('selected', 'true');
			_List.options[i].selected = true;
			found = true;
		}
	}	
}

function populateSelectWithArray(selectId, x, v, f, d)
{
	document.getElementById(selectId).innerHTML = "";
	for (i=0;i<x.length;i++)
		for (j=0;j<x[i][2].length;j++)
			if ((x[i][2][j] == f ) || (f == "") || (x[i][0] == d )) {
				var optionElement = document.createElement('OPTION');
				optionElement.setAttribute('value', x[i][0]);
				if ((x[i][1] == v ) || (x[i][0] == d )) optionElement.setAttribute('selected', 'true');
				var theData = document.createTextNode(x[i][1]);
				optionElement.appendChild(theData);
				document.getElementById(selectId).appendChild(optionElement);
				j = x[i][2].length;
			}
	
}