Dayside ionospheric response to changes in IMF polarity: optical and plasma-flow observations