function galleryInit() {
  $("#ceramics-icons").hide();
  
  // make first icon current and load its image
  var firstIcon = $('.gallery-icons').find(".icon").eq(0);
  swapGalleryImage(firstIcon);
  
  // get icon click event and swap image
  $(".icon").click(function(event) {
    swapGalleryImage(this);
    event.preventDefault();
  })
  
  // swap gallery icon listing
  $("#gallery-painting").click(function(event) {
    $("#gallery-nav").find("a").removeClass("current");
    $(this).addClass("current");
    $("#ceramics-icons").hide();
    $("#painting-icons").show();
    var firstIcon = $('#painting-icons').find(".icon").eq(0);
    swapGalleryImage(firstIcon);
    event.preventDefault();
  })
  
  $("#gallery-ceramics").click(function(event) {
    $("#gallery-nav").find("a").removeClass("current");
    $(this).addClass("current");
    $("#painting-icons").hide();
    $("#ceramics-icons").show();
    var firstIcon = $('#ceramics-icons').find(".icon").eq(0);
    swapGalleryImage(firstIcon);
    event.preventDefault();
  })
  
  // swap gallery image 
  function swapGalleryImage(selected) {
    $("#gallery-image").attr('src', $(selected).attr('href'));
    $(".icon").removeClass("current-icon");
    $(selected).addClass("current-icon");
    $("#caption").html($(selected).attr('title'));
    $("#availability").html($(selected).find("span").html());
  }
}
