alert dialog window from newbee...

Hi everybody !

I would need some help concerning alert windows. My goal would be that “if there is an alert window popping up”, “click ok”. The thing is that I do not know how to reference the alert/dialog window. It become “window1” in safari when it appears, but how can I reference to “window1” when I do not know whether an alert popped up or not (I do not want to click on the main safari window that is normally window1…). Any idea/example on how to deal with an alert in my case ?

Thanks a lot in advance for any help !!!