var darkbox = {
  close: function(element)
  {
    $('div.background').fadeOut('fast', function() { $(this).remove() });
    $('body').css('overflow', 'visible');
    $(element).fadeOut();
  },

  open: function(element)
  {
    element = $(element).hide();

    $('body').
      prepend(
        $('<div class="background"/>').
          click(function() { darkbox.close(element) }).
          css({'z-index': 20, 'opacity': .8}).
          hide().
          fadeIn('fast')).
      prepend(
        element.
          css('z-index', 21).
          fadeIn());
  }
}
