I'm working on a script that controls Safari, Firefox and/or iCab.

When any of these browsers display pages that have some specific ads and
javascript they will crash or cause the Finder to crash.

My script can detect when the browser or the finder have unexpectedly quit
and can clear the dialog and relaunch.

What I can't do is figure out how to determine if the browser has frozen and
is not responding, and how to force quit the browser.

I'm also looking for a way to force restart the mac, without worrying about
saving or logging off nicely.

These scripts are running on mac minis who's only functon in life is to
display web pages.

Any suggestions? 

ES