var adelie = {
  history: function( hash ) {
    if ( hash != '' ) {
      jQuery('.adelie-gallery .gallery-item')
        .removeClass('active-gallery-item');
        /*.find('.item-info').hide()
        .siblings('.show-item-info').show();*/
      jQuery(".adelie-gallery .gallery-item a[href*="+hash+"]").parent().addClass('active-gallery-item');
    }
  }
};

jQuery(document).ready( function($) {
  $.history.init(adelie.history);
  $(".adelie-gallery .show-item-info").click( function() {
    $(this).hide();
    $(this).siblings('.item-info').show();
    return false;
  });
  $(".adelie-gallery .attachment-thumbnail").parent().click( function() {
    $.history.load(this.href.replace(/.*\/(.*)\.\w+$/, "$1"));
    return false;
  });
  
  
  $('.portfolio-list .portfolio-thumbnail a').click( function() {
    var $entry = $(this).parents('.hentry').children('.portfolio-entry').clone();
    $('.portfolio-staging').empty().append($entry);
    return false;
  });
  $('.portfolio-staging').append($('.portfolio-list .hentry:first-child .portfolio-entry').clone());
});