Dynamical and functional mechanisms of visual attention