Browser Sniffer to Identify Firefox

Can anyone show me or point me to a tutorial that will illustrate how to write a browser sniffer script which will identify firefox and call a function if the user is in firefox.

thanks.