function ftSynchronize3(oChangedElement) {

	var idSource = oChangedElement.id;
	var idTarget;
	
	switch (idSource) {
		case 'linea_llegada':
			idTarget = 'cod_la_llegada';
			break;
			
		case 'cod_la_llegada':
			idTarget = 'linea_llegada';
			break;
		
		case 'selFlightTrackerDepap':
			idTarget = 'txtFlightTrackerDepap';
			break;
			
		case 'txtFlightTrackerDepap':
			idTarget = 'selFlightTrackerDepap';
			break;
			
		case 'selFlightTrackerArrap':
			idTarget = 'txtFlightTrackerArrap';
			break;
			
		case 'txtFlightTrackerArrap':
			idTarget = 'selFlightTrackerArrap';
			break;
			
		default:
			alert('Unknown source id: ' + idSource);
			return;
	}
				
			
	var oSource = document.getElementById(idSource);
	var oTarget = document.getElementById(idTarget);
	
	if (oSource == null) {
		alert('Cannot find source object: ' + idSource);
		return;
	}
	
	if (oTarget == null) {
		alert('Cannot find target object: ' + idTarget);
		return;
	}
	
	ftSynchronizeSelTxt(oSource, oTarget);
}


function ftSynchronizeSelTxt(oElementSource, oElementTarget) {
	if (oElementSource.id.substring(10,3) == 'sel'
			|| oElementSource.id == 'linea_llegada') {
		// Source is a select element, target is a text input.
		var selectedOption = oElementSource.options[oElementSource.selectedIndex];
		oElementTarget.value = selectedOption.value;
	} else {
		// Source is a text input, target is a select element.
		var targetCode = oElementSource.value.toUpperCase();
		
		var i = 0;
		var found = false;
		
		while (!found && i < oElementTarget.length) {
			var currOption = oElementTarget.options[i];
			if (currOption.value == targetCode) {
				currOption.selected = true;
				found = true;
			}
			i++;
		}
	
		if (!found) {
			// Option still not found, select default in pulldown...
			oElementTarget.selectedIndex = 0;
		}
	}
}

