title: Do something before closing the browser window
body: <p>we have an web-application built in flash (it's actually just getting built :D) where is very important to be notified, when user closes his window.</p>
  
  <p>Since it's in flash, we do not worry about Javascript, we do not support non-javascript users.</p>
  
  <p>What is the safest (meaning it's 100% sure it gets called) X-browser way to call php script to close session, make some db changes, etc.?</p>
  
  <p>Thank you</p>