How to do remember choice image.

How to do remember choice image.

Hello,
  I have this for a script to change the images in the background. 
  1. $(document).ready(function(){
  2. $('#menu').click(function(){
  3. $('#thumb').slideToggle('slow');
  4. });
  5. $('li img').click(function(){
  6. var imgbg = $(this).attr('dir');
  7. $('body').css({backgroundImage: "url("+imgbg+")"});
  8. });
  9. $('#bgimage').click(function(){
  10. $('#thumb').hide();
  11. });
  12. });
It's just that after the change and refresh the page returns to its original state. Let us take to the selected image wyśiwietlał all the time (ie. selection remembered)?