Alert like facebook, if user's session expired

Alert like facebook, if user's session expired

Hi everybody,

I want to alert message using javascript, if user's logged in  session is expired. What i have to do? Please help.

Thanks
Madan