Setting textField focus borderColor

This is frustrating me beyond belief.

How can I write a function that checks to see if a text box is in focus, and if it is, turn the border color to red… if not, turn it to grey?

PLEASE!