var texture = props.globals.getNode("/instrumentation/airspeed-indicator/texture", 1);
var texture_hwm = props.globals.getNode("/instrumentation/airspeed-indicator[1]/texture", 1);

var check_asi_unit = func ( i ) {
	if(i.getValue()=="kph"){
		texture.setValue(2);
	}else if(i.getValue()=="kts"){
		texture.setValue(1);
	}else if(i.getValue()=="mph"){
		texture.setValue(0);
	}
}

var check_hwm_unit = func ( i ) {
	if(i.getValue() == "kph" ){
		texture_hwm.setValue(1);
	} else if ( i.getValue() == "mph" ){
		texture_hwm.setValue(0);
	}
}

setlistener("/instrumentation/airspeed-indicator/unit", func(i) {
	check_asi_unit(i);
});
setlistener("/instrumentation/airspeed-indicator[1]/unit", func(i) {
	check_hwm_unit(i);
});	
setlistener("/sim/signals/fdm-initialized", func() {
	check_asi_unit(props.globals.getNode("/instrumentation/airspeed-indicator/unit"));
	check_hwm_unit(props.globals.getNode("/instrumentation/airspeed-indicator[1]/unit"));
});
