I'd look into some sort of Javascript framework for using selectors and effects. jQuery: The Write Less, Do More, JavaScript Library for instance is a nice library.

And specifically you might want...