Is it possible to call a javascript function when the forward or back browser buttons are pressed?

I have a site that loads content into iframes using javscript functions, however this means that the back button doesn't track the history of the user through the site.

Thanks,

Tom