hi all Guru's

i have a to design a test in which i am testing various web browsers. when i open a web page one ad is displayed in another browser window after about 5 seconds. so the focus changes from the initial page to the new ad window.i need to create a test which actually checks for this change in the focus of the window to the ad window.

can some one tell me how to do this ....

thanks a lot