function GallerySet(_items, _parent) {
  
  // ================================================================
  // == PRIVATE =====================================================
  // ================================================================
  
  var currIdx = -1;
  var galleries = [];
  var ui = {
    back: null,      // the "back to list" navigation element
    cont: null,      // container
    list: null,      // list of galleries
    gcont: null,     // content of galleries
    parent: _parent
  };
  
  var that = this;
  
  
  // ----------------------------------------------------------------
  function construct() {
    ui.cont = $$("div", ui.parent, null, "gallery-set");
    ui.back = $$("div", ui.cont, null, "gallery-set-back", "back to gallery list");
    ui.back.onclick = function (e) { pub.getOut(); };
    
    ui.list = $$("table", ui.cont);
    ui.list.setAttribute("cellpadding", "0");
    ui.list.setAttribute("cellspacing", "0");
    var tbody = $$("tbody", ui.list);
    
    ui.gcont = $$("div", ui.cont);  // add after the table holding the list of galleries
    
    for (var i=0, ni=_items.length; i < ni; i++) {
      var item = _items[i];
      var tr = $$("tr", tbody);
      var td01 = $$("td", tr, null, "gallery-set-item-01");
      var td02 = $$("td", tr, null, "gallery-set-item-02");
      
      var img = $$("img", td01, null, "gallery-set-item");
      img.setAttribute("src", item.dir + "/title/off.jpg");
      img.setAttribute("alt", "");
      img.onclick = function(gallerySet, idx) {
        return function (e) {
          gallerySet.getIn(idx);
        };
      }(pub,i);
      img.onmouseover = function (img,src) {
        return function (e) {
          img.setAttribute("src", src);
          img.className = "gallery-set-item gallery-set-item-on";
        }
      }(img, item.dir + "/title/on.jpg");
      img.onmouseout = function (img,src) {
        return function (e) {
          img.setAttribute("src", src);
          img.className = "gallery-set-item";
        }
      }(img, item.dir + "/title/off.jpg");
      
      var span = $$("span", td02, null, "gallery-set-title", item.title);
      if (item.subtitle) $$("span", td02, null, "gallery-set-subtitle", "<br />" + item.subtitle);
      
      galleries.push(Gallery(item, ui.gcont, pub.getOut));
    }
  }
  
  
  // ================================================================
  // == PUBLIC ======================================================
  // ================================================================
  
  var pub = {
    
    // ----------------------------------------------------------------
    getIn: function (idx) {
      ui.list.style.display = "none";
      //ui.back.style.display = "block";
      galleries[idx].show();
      currIdx = idx;
    },
    
    
    // ----------------------------------------------------------------
    getOut: function () {
      galleries[currIdx].hide();
      //ui.back.style.display = "none";
      ui.list.style.display = "block";
      currIdx = -1;
    }
    
  };
  
  
  // ================================================================
  // == CONSTRUCT ===================================================
  // ================================================================
  
  construct();
  return pub;
};
